summaryrefslogtreecommitdiff
path: root/json-glib/json-array.c
Commit message (Collapse)AuthorAgeFilesLines
* Update the JsonArray documentationEmmanuele Bassi2021-06-101-23/+23
|
* docs: Initial, rough port away from gtk-docEmmanuele Bassi2021-06-081-127/+132
| | | | | | | | | | Drop `SECTION` blurbs. Use gi-docgen syntax for internal links. Use summary lines for gi-docgen indices. Use Markdown syntax for code fragments.
* docs: Fix the Since tagsEmmanuele Bassi2016-03-011-4/+4
| | | | The newly added API is available since 1.2.
* core: Add JSON node, object, array hashesPhilip Withnall2016-03-011-7/+97
| | | | | | | | | | | | | | | | | | | Now that these objects can be marked as immutable, it is possible to calculate and cache hash values for each of them. This allows efficient hash-based deduplication of large numbers of JSON nodes, as needed by Walbottle for JSON test vector generation. To complement the new hash functions, each of JsonNode, JsonValue, JsonObject and JsonArray also now have an equal() comparison method. This compares them structurally and recursively, using the definition of equality from the JSON Schema specification, which seems as good as any other. http://json-schema.org/latest/json-schema-core.html#anchor9 https://bugzilla.gnome.org/show_bug.cgi?id=756121 Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* node: Add json_node_ref() and json_node_unref()Philip Withnall2016-03-011-3/+3
| | | | | | | | | | | | | | Add reference counting semantics to JsonNode, in addition to the existing init/unset and alloc/free semantics. json_node_free() must only be used with nodes allocated using json_node_alloc(). json_node_unref() may be used with all nodes (if correctly paired; it may be paired with json_node_alloc()). It is not valid to call json_node_free() on a node whose reference count is not 1. https://bugzilla.gnome.org/show_bug.cgi?id=756121
* core: Add immutability support to core objectsPhilip Withnall2016-03-011-0/+48
| | | | | | | | | | | Add an immutable mode to JsonNode, JsonObject, JsonArray and JsonValue. This is an optional mode which objects enter by calling json_*_seal(). It is a one-way transition, which means that we can build and manipulate objects as much as desired, before sealing them and enjoying the benefits of immutable objects: no need to take copies when handling them, persistent hash values (still to be implemented). https://bugzilla.gnome.org/show_bug.cgi?id=756121
* core: Remove atomic operations for reference countingPhilip Withnall2016-01-281-2/+2
| | | | They are not needed — json-glib is not at all thread safe.
* array: Ensure JsonArray is zero-initialisedPhilip Withnall2016-01-281-2/+2
|
* array: Do not create a null node for empty stringsEmmanuele Bassi2015-08-181-1/+1
| | | | | | The two are fairly different, and JsonObject does not behave this way. https://bugzilla.gnome.org/show_bug.cgi?id=730803
* Remove conditional inclusion of config.hEmmanuele Bassi2014-03-181-2/+0
| | | | All the platforms and build system we support have a config.h header.
* docs: Port to MarkDownEmmanuele Bassi2014-03-181-2/+2
| | | | | Drop the DocBook documentation, and move everything to the MarkDown format used by modern gtk-doc.
* Add missing annotationsEmmanuele Bassi2014-02-141-5/+5
| | | | | JsonNode, JsonObject, and JsonArray have various constructors, so we need to annotate them.
* Use the new typed JsonNode initializersEmmanuele Bassi2012-10-271-35/+19
| | | | | The typed setters in JsonArray and JsonObject should use the JsonNode typed initializers.
* Consolidate null handling in JsonArray and JsonObjectEmmanuele Bassi2012-10-271-1/+10
| | | | | | A null value is not only valid for JSON_NODE_NULL nodes, but also for JSON_NODE_ARRAY and JSON_NODE_OBJECT nodes that do not have a JsonArray or a JsonObject set.
* array: Relax preconditions on array and object methodsEmmanuele Bassi2012-10-261-2/+0
| | | | | Similarly to what we did for the add_string_element(), we need to relax the preconditions for add_array_element() and add_object_element().
* array: Relax add_string_element() preconditionsEmmanuele Bassi2012-10-261-2/+1
| | | | | The add_string_element() allows passing a NULL string as a shortcut to create a 'null' node; the preconditions on the arguments are too strict.
* Remove G_CONST_RETURN usageEmmanuele Bassi2011-06-091-1/+1
| | | | | | | | See GLib bug: https://bugzilla.gnome.org/show_bug.cgi?id=644611 The macro is going to be deprecated soon.
* Use the new atomic functions for refcountingEmmanuele Bassi2011-06-031-7/+2
| | | | | The newly added g_atomic_int_dec_and_test() simplified the logic for unreffing Object and Array.
* Add missing introspection annotations.Luca Bruno2011-01-101-4/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=638932
* Use G_DEFINE_BOXED_TYPE()Emmanuele Bassi2010-10-191-12/+1
|
* Add introspection annotationsEmmanuele Bassi2010-09-251-2/+2
|
* Allow NULL as a value for strings, arrays and objectsEmmanuele Bassi2010-06-161-9/+33
| | | | | We should not warn when asking for a string, array or object if the contents were 'null'.
* Update Introspection annotationsEmmanuele Bassi2009-11-121-9/+9
| | | | | | | • Fix the transfer rules for JsonNode, JsonObject and JsonArray getters. • Annotate the methods returning lists
* Auto-promote integer types to G_TYPE_INT64Emmanuele Bassi2009-08-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JSON RFC does not specify the size of the integer type, thus implicitly falling back to machine-size. This would all be fine and dandy if some demented Web Developer (and I use the term "developer" *very much* loosely) did not decide to use integers to store unique identifiers for objects; obviously, you can't have more than 2^32-1 status messages in a database with millions of users who update their status multiple times per day. Right, Twitter? Anyway, some languages do a type auto-promotion from Integer to Long, thus pushing the limit of allowed positive values -- until the next integer overflow, that is. C, and GLib, do not do that transparently for us so we need to: - always use gint64 when parsing a JSON data stream using JsonScanner - move all the Node, Object and Array APIs to gint64 - auto-promote G_TYPE_INT to G_TYPE_INT64 when setting a GValue manually - auto-promote and auto-demote G_TYPE_INT properties when (de)serializing GObjects. The GLib types used internally by JSON-GLib are, thus: integer -> G_TYPE_INT64 boolean -> G_TYPE_BOOLEAN float -> G_TYPE_DOUBLE string -> G_TYPE_STRING
* Fix license and copyright noticesEmmanuele Bassi2009-06-091-2/+6
| | | | | | | | THere is no such thing as the "Lesser General Public License version 2": the LGPL v2 is the "Library GPL", and has been superceded by v2.1 with the new "Lesser GPL" name. Also, the copyright is now Intel Corp.
* [node] Make JsonNode completely privateEmmanuele Bassi2009-06-091-8/+1
| | | | | | | | | | The JsonNode structure has always been meant to be completely opaque; we indirectly exposed the :type member, but only for access through the JSON_NODE_TYPE() macro. Since that macro has become a proxy for the json_node_get_node_type() function we can safely move everything into a private, uninstalled header file and let JsonNode be completely opaque to the developer.
* Add JsonArray iteration functionEmmanuele Bassi2009-05-171-0/+35
| | | | | | Similarly to commit 3057a172 for JsonObject, the newly added json_array_foreach_element() iterates over a JSON array data type.
* Intern the remaining type namesEmmanuele Bassi2009-04-171-1/+1
| | | | | JsonArray and JsonSerializable type names should be interned like the rest of the types.
* Add convenience accessors to JsonArrayEmmanuele Bassi2009-04-171-0/+386
| | | | | | | | | | Like commit 5bb6ea91 did for JsonObject, we should add typed convenience accessors to JsonArray in order to cut down the amount of nodes needed when parsing and generating JSON data streams. As for JsonObject, the amount of types is small enough to avoid the combinatorial API explosion.
* Wrap config.h include with conditionalsEmmanuele Bassi2007-12-251-0/+2
| | | | | Including the autotools generated config.h should always be conditional on the HAVE_CONFIG_H definitions.
* Add API to retrieve copies of the nodes inside objects and arraysEmmanuele Bassi2007-11-211-0/+29
| | | | | | Getting copies of the nodes might work better for high level languages binding the JSON-GLib API, because they can manage the lifetime of the returned values using their own rules.
* Fix compilation errors with extra maintainer CFLAGSEmmanuele Bassi2007-10-161-1/+1
|
* Add API for removing nodes from arrays and objectsEmmanuele Bassi2007-10-151-0/+18
| | | | | | | Write and document json_object_remove_member() and json_array_remove_element() which can be used to remove a JsonNode from a JsonObject or a JsonArray respectively. This way, the JsonObject and JsonArray are API-complete and the object model can be manipulated in code.
* Fix documentation about the ownership of the nodesEmmanuele Bassi2007-10-071-2/+5
| | | | | When adding a JsonNode to a JsonObject or a JsonArray, the containers take ownership of the node.
* Implement the GType functions for JsonObject and JsonArrayEmmanuele Bassi2007-10-051-0/+13
| | | | | | | | | | The type functions for the JsonObject and JsonArray types were declared, albeit with the wrong return value, but not implemented. This commit fixed the return value and implements them. JsonObject and JsonArray are boxed types because we don't need them to be GObjects (no signals, no inheritance and their implementation must be completely opaque for the developer).
* Document the new public functionsEmmanuele Bassi2007-10-011-0/+22
| | | | | Now that we moved the constructors and setters for the JSON data types into the public symbols we need to document them to get back to 100% doc coverage.
* Move data types ctors and setters into the public headersEmmanuele Bassi2007-10-011-1/+0
| | | | | | | Now that we are providing a generator class we need to provide the constructors and setters for JsonNode, JsonObject and JsonArray. This also means that the json-private.h header is now useless, so we can remove it from the build and repository.
* Add licensing informations to the source codeEmmanuele Bassi2007-10-011-0/+29
|
* Add JsonNode, a generic container for JSON typesEmmanuele Bassi2007-10-011-36/+28
| | | | | | | | | | | | | | | | | This huge commit removes JsonData and adds JsonNode, the generic container for fundamental and complex data types extracted from a JSON stream. The contents of a JsonNode can be extracted from it in form of a GValue for fundamental types (integers, floats, strings, booleans) or in form of JsonObject and JsonArray objects. JsonObject and JsonArray now accept JsonNodes instead of GValues. The JsonParser object builds the data model tree when parsing a JSON stream; the tree can be recursed by getting the root node and walking it using the GValue API for the fundamental types and the objects/arrays API for complex types. The API has been updated and the tests now recurse through the generated data model tree.
* Initial import of JSON-GLibEmmanuele Bassi2007-09-201-0/+176
JSON-GLib is a JSON parser library written with GLib and GObject. JSON is the JavaScript Object Notation, and it's used to define objects and object hierarchies in a human-readable way.