[opengtl-commits] [621] add a function to dump the content of a metadata store to the console output

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 621
Author:   cyrille
Date:     2009-03-14 17:26:48 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
add a function to dump the content of a metadata store to the console output

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt

Added Paths:
-----------
    trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.h


Modified: trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt	2009-03-14 13:47:19 UTC (rev 620)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt	2009-03-14 16:26:48 UTC (rev 621)
@@ -63,6 +63,7 @@
   VirtualMachine_p.cpp
   Visitor_p.cpp
 # Metadata
+  Metadata/Debug_p.cpp
   Metadata/Entry.cpp
   Metadata/Group.cpp
   Metadata/ParameterEntry.cpp

Added: trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.cpp	2009-03-14 16:26:48 UTC (rev 621)
@@ -0,0 +1,58 @@
+/*
+ *  Copyright (c) 2009 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "Debug_p.h"
+
+#include "../Debug.h"
+#include "../Macros_p.h"
+
+#include "Group.h"
+#include "ParameterEntry.h"
+#include "TextEntry.h"
+#include "ValueEntry.h"
+
+#include <iostream>
+
+using namespace GTLCore::Metadata;
+
+void GTLCore::Metadata::dumpAll( const Entry* _entry, const GTLCore::String& _indent )
+{
+  if( const Group* group = _entry->asGroup() )
+  {
+    if( _entry->asParameterEntry() )
+    {
+      std::cout << _indent << "Parameter: ";
+    } else {
+      std::cout << _indent << "Group: ";
+    }
+    std::cout << _entry->name() << std::endl;
+    foreach( const Entry* entry, group->entries())
+    {
+      dumpAll( entry, _indent + "" );
+    }
+  } else if( const TextEntry* text = _entry->asTextEntry())
+  {
+    std::cout << _indent << "Text: " << text->name() << ", " << text->text() << std::endl;
+  } else if( const ValueEntry* value = _entry->asValueEntry())
+  {
+    std::cout << _indent << "Value: " << value->name() << ", " << value->value() << std::endl;
+  } else {
+    std::cout << _indent << "Unknown: " << _entry->name() << std::endl;
+  }
+}

Added: trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.h	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Metadata/Debug_p.h	2009-03-14 16:26:48 UTC (rev 621)
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (c) 2009 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GTLCORE_METADATA_DEBUG_H_
+#define _GTLCORE_METADATA_DEBUG_H_
+
+#include <GTLCore/Metadata/Entry.h>
+
+namespace GTLCore {
+  class Entry;
+  namespace Metadata {
+    void dumpAll( const Entry* _entry, const GTLCore::String& _indent = "" );
+  }
+}
+#endif


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/