* eet_node: Make eet_node_dump fully functionnal.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 28 Dec 2009 16:52:27 +0000 (16:52 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 28 Dec 2009 16:52:27 +0000 (16:52 +0000)
Next step, generate Eet_Node directly inside eet_data_decode.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eet@44748 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/eet_node.c

index 7539043..749af88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * More work on eet_node dump code.
 
+2009-12-28  Cedric BAIL
+
+       * Add fully functionnal eet_node dump code.
 
index fdd2759..ea75d6d 100644 (file)
@@ -389,15 +389,41 @@ eet_node_dump_group_end(int level, void (*dumpfunc) (void *data, const char *str
 void
 eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc) (void *data, const char *str), void *dumpdata)
 {
+   Eet_Node *it;
+
+   if (!n) return ;
+
    switch (n->type)
      {
-      case EET_G_HASH:
-      case EET_G_UNKNOWN:
       case EET_G_VAR_ARRAY:
       case EET_G_ARRAY:
+      case EET_G_UNKNOWN:
+      case EET_G_HASH:
       case EET_G_LIST:
-        eet_node_dump_group_start(dumplevel, dumpfunc, dumpdata, n->type, n->name);
-        /* FIXME: Handle content of group. */
+        eet_node_dump_group_start(dumplevel + 1, dumpfunc, dumpdata, n->type, n->name);
+
+        if (n->type == EET_G_VAR_ARRAY
+            || n->type == EET_G_ARRAY)
+          {
+             char tbuf[256];
+
+             eet_node_dump_level(dumplevel, dumpfunc, dumpdata);
+             dumpfunc(dumpdata, "    count ");
+             eina_convert_itoa(n->count, tbuf);
+             dumpfunc(dumpdata, tbuf);
+             dumpfunc(dumpdata, ";\n");
+          }
+        else if (n->type == EET_G_HASH)
+          {
+             eet_node_dump_level(dumplevel, dumpfunc, dumpdata);
+             dumpfunc(dumpdata, "    key \"");
+             eet_node_dump_string_escape(dumpdata, dumpfunc, n->key);
+             dumpfunc(dumpdata, "\";\n");
+          }
+
+        for (it = n->values; it != NULL; it = it->next)
+          eet_node_dump(it, dumplevel + 2, dumpfunc, dumpdata);
+
         eet_node_dump_group_end(dumplevel, dumpfunc, dumpdata);
         break;
       case EET_T_STRING: