| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When converting from a JsonArray of strings to a GStrv we need to
add a NULL at the end of the GPtrArray we use to perform the
conversion.
This two lines patch fixes the issue.
See bug 1203.
Patch by: Kouhei Sutou <kou@cozmixng.org>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
|
|
|
|
|
|
|
|
|
| |
Instead of building a GString by concatenating every string inside
an array to deserialize the array into a string vector property,
use a GPtrArray. This is far more efficient (no reallocations are
necessary, as we know the size of the array) and safe (the separator
used to build the string buffer and then split it might exist in
one of the original strings).
|
|
|
|
|
| |
Do not free the root node returned by the get_root() method in the
JSON-GObject API and in the JsonParser tests.
|
|
|
|
|
| |
Including the autotools generated config.h should always be conditional
on the HAVE_CONFIG_H definitions.
|
|
|
|
|
|
|
|
| |
The JsonSerializable interface can provide a default implementation, using
the powers of GTypeInterface. This means that classes implementing the
interface can opt to implement both, either or none of the JsonSerializable
methods, and still be able to retain some basic functionality for the methods
they decide not to implement.
|
|
|
|
|
| |
Update json_construct_gobject() to the change of behaviour in the
root node getter function of JsonParser.
|
|
|
|
|
|
|
|
| |
If the target value is a G_TYPE_ENUM or a G_TYPE_FLAGS we can effectively
deserialize a string into the corresponding value (or bit mask) using
the introspection API for the GEnum and GFlags types.
This code is taken from ClutterScript and it was adapted from GtkBuilder.
|
|
|
|
|
| |
We provide fallbacks in case a JsonSerializable object does not translate
a property into a JSON object member and vice versa.
|
|
|
|
|
|
|
| |
To avoid reimplementing the same code all over again, if the implementation
of the serialize_property virtual function of JsonSerializable returns NULL
we will fall back to the simple value-to-node generator we provide for
non-serializable classes.
|
|
|
|
|
|
| |
We need to skip if the CONSTRUCT_ONLY flag is set, not unset. We also need
to copy the value from the JSON node into the target GValue, not the other
way around.
|
|
|
|
|
|
|
|
|
| |
The fallback parser for json_construct_gobject() is invoked if the GType
does not implement the JsonSerializable interface, or if the interface
was not handling the property.
It will natively convert integers, booleans, strings and double precision
floating point values; it also handles string vectors in form of arrays.
|
|
|
|
|
|
|
|
|
|
| |
The json_construct_gobject() function takes a GType and a JSON data stream
and constructs a new instance for the given type. If the type is a
JsonSerializable, it will use the JsonSerializable interface for parsing
the JsonNodes of each object member.
This is the initial implementation of the function: the JsonNode-to-GValue
fallback parser is just a stub.
|
|
|
|
| |
A placeholder, while syntactically correct, won't do.
|
|
|
|
|
|
|
| |
The JsonSerializable interface allows implementations to override the
GObject-to-JSON serialization process, by providing two virtual methods
to control the (de)serialization of GObject properties. This way it's
possible to serialize GObjects with properties holding complex data types.
|
|
This commit adds json-gobject.h and json_serialize_gobject() to
JSON-GLib, to serialize a GObject instance into a JSON data stream.
|