| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
Drop `SECTION` blurbs.
Use gi-docgen syntax for internal links.
Use summary lines for gi-docgen indices.
Use Markdown syntax for code fragments.
|
|
|
|
| |
The newly added API is available since 1.2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
They are not needed — json-glib is not at all thread safe.
|
| |
|
|
|
|
|
|
| |
The two are fairly different, and JsonObject does not behave this way.
https://bugzilla.gnome.org/show_bug.cgi?id=730803
|
|
|
|
| |
All the platforms and build system we support have a config.h header.
|
|
|
|
|
| |
Drop the DocBook documentation, and move everything to the MarkDown
format used by modern gtk-doc.
|
|
|
|
|
| |
JsonNode, JsonObject, and JsonArray have various constructors, so we
need to annotate them.
|
|
|
|
|
| |
The typed setters in JsonArray and JsonObject should use the JsonNode
typed initializers.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Similarly to what we did for the add_string_element(), we need to relax
the preconditions for add_array_element() and add_object_element().
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
See GLib bug:
https://bugzilla.gnome.org/show_bug.cgi?id=644611
The macro is going to be deprecated soon.
|
|
|
|
|
| |
The newly added g_atomic_int_dec_and_test() simplified the logic for
unreffing Object and Array.
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=638932
|
| |
|
| |
|
|
|
|
|
| |
We should not warn when asking for a string, array or object if the
contents were 'null'.
|
|
|
|
|
|
|
| |
• Fix the transfer rules for JsonNode, JsonObject and JsonArray
getters.
• Annotate the methods returning lists
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Similarly to commit 3057a172 for JsonObject, the newly added
json_array_foreach_element() iterates over a JSON array data
type.
|
|
|
|
|
| |
JsonArray and JsonSerializable type names should be interned like
the rest of the types.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Including the autotools generated config.h should always be conditional
on the HAVE_CONFIG_H definitions.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
When adding a JsonNode to a JsonObject or a JsonArray, the containers
take ownership of the node.
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
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.
|