summaryrefslogtreecommitdiff
path: root/json-glib/json-gobject.h
Commit message (Collapse)AuthorAgeFilesLines
* Update the JSON/GObject API documentationEmmanuele Bassi2021-06-101-11/+13
|
* Update the documentation for the GBoxed APIEmmanuele Bassi2021-06-081-2/+50
|
* Add autoptr clean up definition for JsonSerializableEmmanuele Bassi2017-03-111-0/+4
| | | | | This way developers can use G_DECLARE_INTERFACE with Serializable as a pre-condition.
* Use compiler annotations to determine symbol visibilityEmmanuele Bassi2014-03-181-4/+22
| | | | | | | | | | | | | | | | | 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.
* docs: Port to MarkDownEmmanuele Bassi2014-03-181-1/+1
| | | | | Drop the DocBook documentation, and move everything to the MarkDown format used by modern gtk-doc.
* Remove JSON_DISABLE_DEPRECATEDEmmanuele Bassi2012-01-141-3/+0
| | | | We have deprecations warnings from the compiler, now.
* Use the new GLib deprecation schemeEmmanuele Bassi2011-10-171-2/+4
| | | | | Instead of using a defined symbol to remove the deprecated functions from the library, we should use compiler warnings.
* docs: Fix API reference missing symbolsEmmanuele Bassi2011-06-151-0/+6
|
* serializable: Allow introspecting propertiesEmmanuele Bassi2011-06-011-0/+22
| | | | | This allows a Serializable implementation to override the property list, and the setter and the getter function.
* docs: Fix argument name mismatchEmmanuele Bassi2009-11-281-1/+1
| | | | | | 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.
* boxed: Split (de)serialization registrationEmmanuele Bassi2009-11-231-31/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* serializable: Add methods proxying default implementationsEmmanuele Bassi2009-11-121-9/+19
| | | | | | | | | | 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.
* gobject: Add deprecation annotationsEmmanuele Bassi2009-11-121-2/+2
| | | | | This makes it easier to detect when building without JSON_DISABLE_DEPRECATED.
* gobject: Use from/to data naming conventionEmmanuele Bassi2009-10-281-0/+10
| | | | | | | | | | | | | | | | | | | | | | 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.
* gobject: Uniform JSON<->GObject mapping codeEmmanuele Bassi2009-10-281-5/+5
| | | | | | | | | 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.
* gobject: Make GObject<->JsonObject functions publicEmmanuele Bassi2009-10-271-6/+10
| | | | | The functions mapping a GObject to and from a JsonObject should be public, as they can be used by parsers.
* gobject: Add experimental GBoxed<->JSON transformationEmmanuele Bassi2009-10-271-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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.
* Initial implementation of GObject deserialization functionEmmanuele Bassi2007-11-101-2/+6
| | | | | | | | | | 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.
* Add the JsonSerializable interfaceEmmanuele Bassi2007-10-161-0/+51
| | | | | | | 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.
* Add GObject serialization support for JSON-GLibEmmanuele Bassi2007-10-021-0/+33
This commit adds json-gobject.h and json_serialize_gobject() to JSON-GLib, to serialize a GObject instance into a JSON data stream.