diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-28 16:23:39 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-28 16:23:39 +0000 |
commit | 8f8ce87730fc0bf102a707e84c4f6106b215cfab (patch) | |
tree | 974c53123f5b9873e85c976a98185643120f2563 /json-glib/json-gobject.h | |
parent | 00b4d200849e232cd904d23d3593d6f95252b483 (diff) | |
download | json-glib-8f8ce87730fc0bf102a707e84c4f6106b215cfab.tar.gz |
gobject: Use from/to data naming convention
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.
Diffstat (limited to 'json-glib/json-gobject.h')
-rw-r--r-- | json-glib/json-gobject.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/json-glib/json-gobject.h b/json-glib/json-gobject.h index d294702..8b6568d 100644 --- a/json-glib/json-gobject.h +++ b/json-glib/json-gobject.h @@ -121,12 +121,22 @@ JsonNode *json_gobject_serialize (GObject *gobject) GObject * json_gobject_deserialize (GType gtype, JsonNode *node); +GObject * json_gobject_from_data (GType gtype, + const gchar *data, + gssize length, + GError **error); +gchar * json_gobject_to_data (GObject *gobject, + gsize *length); + +#ifndef JSON_DISABLE_DEPRECATED GObject * json_construct_gobject (GType gtype, const gchar *data, gsize length, GError **error); gchar * json_serialize_gobject (GObject *gobject, gsize *length) G_GNUC_MALLOC; +#endif + G_END_DECLS |