summaryrefslogtreecommitdiff
path: root/json-glib
diff options
context:
space:
mode:
Diffstat (limited to 'json-glib')
-rw-r--r--json-glib/json-node.c23
-rw-r--r--json-glib/json-types-private.h2
2 files changed, 24 insertions, 1 deletions
diff --git a/json-glib/json-node.c b/json-glib/json-node.c
index a3562f6..a21d587 100644
--- a/json-glib/json-node.c
+++ b/json-glib/json-node.c
@@ -469,6 +469,23 @@ json_node_type_name (JsonNode *node)
switch (node->type)
{
case JSON_NODE_OBJECT:
+ case JSON_NODE_ARRAY:
+ case JSON_NODE_NULL:
+ return json_node_type_get_name (node->type);
+
+ case JSON_NODE_VALUE:
+ return g_type_name (G_VALUE_TYPE (&(node->data.value)));
+ }
+
+ return "unknown";
+}
+
+G_CONST_RETURN gchar *
+json_node_type_get_name (JsonNodeType node_type)
+{
+ switch (node_type)
+ {
+ case JSON_NODE_OBJECT:
return "JsonObject";
case JSON_NODE_ARRAY:
@@ -478,7 +495,11 @@ json_node_type_name (JsonNode *node)
return "NULL";
case JSON_NODE_VALUE:
- return g_type_name (G_VALUE_TYPE (&(node->data.value)));
+ return "Value";
+
+ default:
+ g_assert_not_reached ();
+ break;
}
return "unknown";
diff --git a/json-glib/json-types-private.h b/json-glib/json-types-private.h
index ac72316..d0e073e 100644
--- a/json-glib/json-types-private.h
+++ b/json-glib/json-types-private.h
@@ -59,6 +59,8 @@ struct _JsonObject
volatile gint ref_count;
};
+G_CONST_RETURN gchar *json_node_type_get_name (JsonNodeType node_type);
+
G_END_DECLS
#endif /* __JSON_TYPES_PRIVATE_H__ */