From 0533bf991e946b09053753566f209940f500d368 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 16 Dec 2014 15:05:47 +0100 Subject: Debugging routines to print out XML, SP Object, and Display Item trees. (bzr r13802) --- src/sp-object.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/sp-object.cpp') diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 4e45eb824..3b09d80e8 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -1523,6 +1523,22 @@ char* SPObject::textualContent() const return g_string_free(text, FALSE); } +// For debugging: Print SP tree structure. +void SPObject::recursivePrintTree( unsigned level ) +{ + if (level == 0) { + std::cout << "SP Object Tree" << std::endl; + } + std::cout << "SP: "; + for (unsigned i = 0; i < level; ++i) { + std::cout << " "; + } + std::cout << (getId()?getId():"No object id") << std::endl; + for (SPObject *child = children; child; child = child->next) { + child->recursivePrintTree( level+1 ); + } +} + /* Local Variables: mode:c++ -- cgit v1.2.3