summaryrefslogtreecommitdiff
path: root/json-glib/json-node.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix introspection annotationsEmmanuele Bassi2011-02-151-3/+4
|
* 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
|
* Update Introspection annotationsEmmanuele Bassi2009-11-121-7/+8
| | | | | | | • Fix the transfer rules for JsonNode, JsonObject and JsonArray getters. • Annotate the methods returning lists
* node: Add a private NodeType-to-string converterEmmanuele Bassi2009-10-271-1/+22
| | | | Useful for debugging and logging purposes.
* [node] Add JsonNode.set_parent()Emmanuele Bassi2009-09-061-0/+18
| | | | | Add the setter for JsonNode:parent, to be used in JsonParser instead of directly accessing the JsonNode structure.
* Auto-promote integer types to G_TYPE_INT64Emmanuele Bassi2009-08-121-12/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+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.
* [node] Add is_null() methodEmmanuele Bassi2009-04-171-0/+20
| | | | | The json_node_is_null() function is just a quick check for nodes set to null.
* [node] Add function version of JSON_NODE_TYPE macroEmmanuele Bassi2009-04-171-0/+18
| | | | | First pass at adding some type safety to the JsonNode type checks, and at removing every mention of the JsonNode interna fields.
* [node] Do not overwrite when copyingEmmanuele Bassi2009-04-141-1/+1
| | | | | | | | | | | | | | | | | Bug 1353 - Copying JSON_NODE_VALUE nodes unreliable at best When copying a JsonNode to another we do an implicit memcpy using: *copy = *src Which works well enough with pointers, but makes a mess out of the value-based nodes. We should just copy the type of the original JsonNode and leave the rest to the switch() block. In order to catch potential regressions, we also need a more thorough test unit for the JsonNode copy operation.
* Documentation fixes in JsonNodeEmmanuele Bassi2008-04-191-3/+3
|
* Do not copy node data if it's not thereEmmanuele Bassi2008-04-191-4/+13
| | | | | If the source JsonNode does not contain data yet, do not try and copy it.
* Allow null nodes to return a value without a warningEmmanuele Bassi2008-04-121-6/+15
| | | | | | Value nodes might contain 'null' as a valid value, so the fast accessors should not barf out when encountering a JSON_NODE_NULL instead of the expected JSON_NODE_VALUE.
* Wrap config.h include with conditionalsEmmanuele Bassi2007-12-251-0/+3
| | | | | Including the autotools generated config.h should always be conditional on the HAVE_CONFIG_H definitions.
* Initialise to zero when creating/copying a JsonNodeEmmanuele Bassi2007-12-251-4/+5
| | | | Avoid feeding garbage to the callers by using g_slice_new0().
* Fix member name in json_node_get_value_type()Emmanuele Bassi2007-11-131-1/+1
| | | | JsonNode payload is inside a union.
* Add a GType for JsonNodeEmmanuele Bassi2007-11-131-0/+48
| | | | | | We need a GType for nodes if we want to add JsonNode properties or signal marshallers to a GObject class. We could use pointers, but we'd loose type safety, so it's a no-no.
* Check if the payload is set in json_node_free()Emmanuele Bassi2007-10-291-2/+4
| | | | | Before calling json_object_unref() or json_array_unref() in json_node_free() we need to check if the payload of JsonNode is set to avoid a critical.
* Add json_node_dup_string()Emmanuele Bassi2007-10-081-0/+20
| | | | | The newly added json_node_dup_string() is a convenience function for getting a copy of the string contained inside a JsonNode.
* Add convenience accessors for fundamental types in JsonNodeEmmanuele Bassi2007-10-051-0/+201
| | | | | | This commit adds some convenience accessors for setting and getting fundamental types in and from a JsonNode, to avoid jumping through all the GValue hoops.
* Document the new public functionsEmmanuele Bassi2007-10-011-0/+78
| | | | | 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.
* Implement json_node_get_parent()Emmanuele Bassi2007-10-011-0/+16
| | | | | It seems that the parent accessor fell through. This commit implements the declared json_node_get_parent() function.
* Add licensing informations to the source codeEmmanuele Bassi2007-10-011-8/+44
|
* Add API reference for JSON-GLibEmmanuele Bassi2007-10-011-1/+1
| | | | | Use gtk-doc to build the various bits and pieces of the API reference for JSON-GLib.
* Add JsonNode, a generic container for JSON typesEmmanuele Bassi2007-10-011-0/+269
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.