| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
This way developers can use G_DECLARE_INTERFACE with Serializable as a
pre-condition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of relying on a separate file that requires being update every
time we add a new public function we should use compiler annotations to
let the linker know which symbols are public and exported.
In order to achieve this we have to:
* check for the visibility=hidden attribute
* add -fvisibility=hidden to the linker flags
* add a macro to annotate all public symbols
While we're at it, we should copy the versioned symbols macro layout
already used by GLib, GTK+, and other G* libraries, including the
ability to express the range of allowed versions of JSON-GLib that
third party code can compile against.
|
|
|
|
|
| |
Drop the DocBook documentation, and move everything to the MarkDown
format used by modern gtk-doc.
|
|
|
|
| |
We have deprecations warnings from the compiler, now.
|
|
|
|
|
| |
Instead of using a defined symbol to remove the deprecated functions
from the library, we should use compiler warnings.
|
| |
|
|
|
|
|
| |
This allows a Serializable implementation to override the property list,
and the setter and the getter function.
|
|
|
|
|
|
| |
gtk-doc complains that the argument name in the header does not match
the one in the documentation annotation for the GBoxed deserialization
function registration.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A GBoxed type defined as:
struct Boxed {
int foo;
gboolean bar;
int baz;
};
Can be represented either by a JSON object:
{
"foo" : 1,
"bar" : true,
"baz" : 3
}
Or by a JSON array:
[ 1, true, 3 ]
The current function for registering a serialization and a
deserialization pair does not allow registering more than one
deserialization function - which means that there can only be
one way to deserialize a GBoxed type into a specific JsonNode
type.
To allow having more than one JsonNodeType associated to a
GBoxed type and a deserialization function we need to split out
the registration of the serialization and deserialization functions
into two distinct functions.
|
|
|
|
|
|
|
|
|
|
| |
If you want to use the default implementation of serialize_property()
and/or deserialize_property() from an object class implementing
JsonSerializable you currently have to peek the interface vtable and
then call the vfunc pointers.
We can expose the default implementation through functions ourselves and
simplify the required code.
|
|
|
|
|
| |
This makes it easier to detect when building without
JSON_DISABLE_DEPRECATED.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Be more GLib-like, and use
<namespace>_<type>_from_data()
<namespace>_<type>_to_data()
Instead of the homebrew "construct" and "serialize", when dealing
with string buffers.
This means:
• adding json_gobject_from_data() to deprecate
json_construct_gobject()
• adding json_gobject_to_data() to deprecate
json_serialize_gobject()
The json_construct_gobject() function also contains a mistake: it
uses gsize with the special value of -1 meaning "slurp the whole
string", but gsize is an unsigned type. The newly added
json_gobject_from_data() correctly uses gssize instead.
|
|
|
|
|
|
|
|
|
| |
Rename json_gobject_new() to json_gobject_deserialize(), and
json_gobject_dump() to json_gobject_serialize(); this maps the
JSON GBoxed API.
Also for consistency, change the serialize() return value and
the deserialize() argument to be JsonNodes of type JSON_NODE_OBJECT.
|
|
|
|
|
| |
The functions mapping a GObject to and from a JsonObject should
be public, as they can be used by parsers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Serializing and deserializing GBoxed types is fairly complicated
currently. If a GObject implements JsonSerializable it is possible
for the class to intercept the JsonNode, parse it manually and
then set the value to the property.
This leaves a hole opened for:
• manual (de)serialization of GBoxed types
• (de)serialization of GBoxed properties in classes not
implementing JsonSerializable
In order to serialize and deserialize a GBoxed JSON-GLib should
provide a mechanism similar to the GValue transformation functions:
when registering the boxed type the developer should also be able
to register a serialization and a deserialization functions pair
matching the tuple:
(GBoxed type, JSON type)
The serialization function would be:
JsonNode *(* JsonBoxedSerializeFunc) (gconstpointer boxed);
And, conversely, the deserialization function would be:
gpointer (* JsonBoxedDeserializeFunc) (JsonNode *node);
Obviously, the whole machinery works only for GBoxed types that
register the serialization and deserialization functions.
|
|
|
|
|
|
|
|
| |
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 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.
|
|
|
|
|
|
|
| |
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.
|