Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
00001 /* Copyright (C) 2009 Tim Janik 00002 * GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 00003 */ 00004 #ifndef __RAPICORN_DEBUG_TOOLS_HH__ 00005 #define __RAPICORN_DEBUG_TOOLS_HH__ 00006 00007 #include <rcore/utilities.hh> 00008 #include <rcore/strings.hh> 00009 00010 namespace Rapicorn { 00011 00012 /* --- test dump --- */ 00013 class TestStream { 00014 RAPICORN_CLASS_NON_COPYABLE (TestStream); 00015 public: 00016 typedef enum { TEXT, NODE, VALUE, INTERN, INDENT, POPNODE, POPINDENT } Kind; 00017 protected: 00018 /*Con*/ TestStream (); 00019 virtual void ddump (Kind kind, const String &name, const String &val) = 0; 00020 public: 00021 virtual ~TestStream (); 00022 void dump (const String &text) { ddump (TEXT, "", text); } 00023 template<typename Value> 00024 void dump (const String &name, Value v) { ddump (VALUE, name, string_from_type (v)); } 00025 template<typename Value> 00026 void dump_intern (const String &name, Value v) { ddump (INTERN, name, string_from_type (v)); } 00027 void push_node (const String &name) { ddump (NODE, name, ""); } 00028 void pop_node () { ddump (POPNODE, "", ""); } 00029 void push_indent (void) { ddump (INDENT, "", ""); } 00030 void pop_indent (void) { ddump (POPINDENT, "", ""); } 00031 virtual void filter_matched_nodes (const String &matchpattern) = 0; 00032 virtual void filter_unmatched_nodes (const String &matchpattern) = 0; 00033 virtual String string () = 0; 00034 static 00035 TestStream* create_test_stream (); 00036 }; 00037 00038 } // Rapicorn 00039 00040 #endif /* __RAPICORN_DEBUG_TOOLS_HH__ */ 00041 /* vim:set ts=8 sts=2 sw=2: */