[json-glib] [node] Add function version of JSON_NODE_TYPE macro



commit d1e7d1ecd05687624f7149dad75a5fac9a645e72
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Fri Apr 17 15:36:09 2009 +0100

    [node] Add function version of JSON_NODE_TYPE macro
    
    First pass at adding some type safety to the JsonNode type checks,
    and at removing every mention of the JsonNode interna fields.
---
 doc/reference/json-glib-sections.txt |    1 +
 json-glib/json-node.c                |   18 ++++++++++++++++++
 json-glib/json-types.h               |    5 +++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/doc/reference/json-glib-sections.txt b/doc/reference/json-glib-sections.txt
index 615654c..a7f3336 100644
--- a/doc/reference/json-glib-sections.txt
+++ b/doc/reference/json-glib-sections.txt
@@ -115,6 +115,7 @@ json_node_dup_string
 json_node_get_parent
 json_node_type_name
 json_node_get_value_type
+json_node_get_node_type
 
 <SUBSECTION Private>
 JSON_TYPE_NODE
diff --git a/json-glib/json-node.c b/json-glib/json-node.c
index 7043de3..508b3dd 100644
--- a/json-glib/json-node.c
+++ b/json-glib/json-node.c
@@ -689,3 +689,21 @@ json_node_get_boolean (JsonNode *node)
 
   return FALSE;
 }
+
+/**
+ * json_node_get_node_type:
+ * @node: a #JsonNode
+ *
+ * Retrieves the #JsonNodeType of @node
+ *
+ * Return value: the type of the node
+ *
+ * Since: 0.8
+ */
+JsonNodeType
+json_node_get_node_type (JsonNode *node)
+{
+  g_return_val_if_fail (node != NULL, JSON_NODE_NULL);
+
+  return node->type;
+}
diff --git a/json-glib/json-types.h b/json-glib/json-types.h
index 8d60a9d..d9cfa8b 100644
--- a/json-glib/json-types.h
+++ b/json-glib/json-types.h
@@ -99,7 +99,10 @@ GType                 json_node_get_type        (void) G_GNUC_CONST;
 JsonNode *            json_node_new             (JsonNodeType  type);
 JsonNode *            json_node_copy            (JsonNode     *node);
 void                  json_node_free            (JsonNode     *node);
+JsonNodeType          json_node_get_node_type   (JsonNode     *node);
 GType                 json_node_get_value_type  (JsonNode     *node);
+JsonNode *            json_node_get_parent      (JsonNode     *node);
+G_CONST_RETURN gchar *json_node_type_name       (JsonNode     *node);
 
 void                  json_node_set_object      (JsonNode     *node,
                                                  JsonObject   *object);
@@ -130,8 +133,6 @@ gdouble               json_node_get_double      (JsonNode     *node);
 void                  json_node_set_boolean     (JsonNode     *node,
                                                  gboolean      value);
 gboolean              json_node_get_boolean     (JsonNode     *node);
-JsonNode *            json_node_get_parent      (JsonNode     *node);
-G_CONST_RETURN gchar *json_node_type_name       (JsonNode     *node);
 
 /*
  * JsonObject



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