[json-glib] gobject: Make GObject<->JsonObject functions public



commit 373fa3d9b73391b38620fbd9ce9b69f358e5f4c8
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Tue Oct 27 18:10:19 2009 +0000

    gobject: Make GObject<->JsonObject functions public
    
    The functions mapping a GObject to and from a JsonObject should
    be public, as they can be used by parsers.

 json-glib/json-gobject.c |   30 ++++++++++++++++++++++++++++--
 json-glib/json-gobject.h |   16 ++++++++++------
 2 files changed, 38 insertions(+), 8 deletions(-)
---
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index fcabce1..9e0074a 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -417,7 +417,20 @@ flags_from_string (GType        type,
   return ret;
 }
 
-static GObject *
+/**
+ * json_gobject_new:
+ * @gtype: the type of the #GObject to create
+ * @object: a #JsonObject describing the object instance
+ *
+ * Creates a new #GObject of type @gtype, and constructs it
+ * using the members of the passed #JsonObject
+ *
+ * Return value: (transfer full): The newly created #GObject
+ *   instance. Use g_object_unref() when done
+ *
+ * Since: 0.10
+ */
+GObject *
 json_gobject_new (GType       gtype,
                   JsonObject *object)
 {
@@ -571,7 +584,20 @@ json_gobject_new (GType       gtype,
   return retval;
 }
 
-static JsonObject *
+/**
+ * json_gobject_dump:
+ * @gobject: a #GObject
+ *
+ * Creates a #JsonObject representing the passed #GObject
+ * instance. Each member of the returned JSON object will
+ * map to a property of the #GObject
+ *
+ * Return value: (transfer full): the newly created #JsonObject.
+ *   Use json_object_unref() when done
+ *
+ * Since: 0.10
+ */
+JsonObject *
 json_gobject_dump (GObject *gobject)
 {
   JsonSerializableIface *iface = NULL;
diff --git a/json-glib/json-gobject.h b/json-glib/json-gobject.h
index 207db52..a855fba 100644
--- a/json-glib/json-gobject.h
+++ b/json-glib/json-gobject.h
@@ -117,12 +117,16 @@ JsonNode *json_boxed_serialize               (GType                     gboxed_t
 gpointer  json_boxed_deserialize             (GType                     gboxed_type,
                                               JsonNode                 *node);
 
-GObject *json_construct_gobject (GType         gtype,
-                                 const gchar  *data,
-                                 gsize         length,
-                                 GError      **error);
-gchar *  json_serialize_gobject (GObject      *gobject,
-                                 gsize        *length) G_GNUC_MALLOC;
+GObject *   json_gobject_new       (GType       gtype,
+                                    JsonObject *object);
+JsonObject *json_gobject_dump      (GObject *gobject);
+
+GObject *   json_construct_gobject (GType         gtype,
+                                    const gchar  *data,
+                                    gsize         length,
+                                    GError      **error);
+gchar *     json_serialize_gobject (GObject      *gobject,
+                                    gsize        *length) G_GNUC_MALLOC;
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]