diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-27 17:43:38 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-27 17:43:38 +0000 |
commit | 7f6a73a0964b66b15e8b5a9858b9bc76b010f67b (patch) | |
tree | dd060d80c496cf591480197ca1a2f152212dff08 /json-glib/json-node.c | |
parent | 3f8990f7a4c362590f19e427aae2f68f27303fe6 (diff) | |
download | json-glib-7f6a73a0964b66b15e8b5a9858b9bc76b010f67b.tar.gz |
node: Add a private NodeType-to-string converter
Useful for debugging and logging purposes.
Diffstat (limited to 'json-glib/json-node.c')
-rw-r--r-- | json-glib/json-node.c | 23 |
1 files changed, 22 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"; |