From 542372cd18393d9760da61d0798af5905344517f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 May 2010 00:46:33 +0000 Subject: Add debug() method to dump XML nodes. git-svn-id: svn://localhost/ardour2/branches/3.0@7083 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/xml++.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libs/pbd/xml++.cc') diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 91d169d8bf..d691b0bd82 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -5,6 +5,7 @@ * Modified for Ardour and released under the same terms. */ +#include #include "pbd/xml++.h" #include #include @@ -589,3 +590,17 @@ static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string& xpath) return nodes; } +/** Dump a node, its properties and children to a stream */ +void +XMLNode::debug (ostream& s, string p) +{ + s << p << _name << " "; + for (XMLPropertyList::iterator i = _proplist.begin(); i != _proplist.end(); ++i) { + s << (*i)->name() << "=" << (*i)->value() << " "; + } + s << "\n"; + + for (XMLNodeList::iterator i = _children.begin(); i != _children.end(); ++i) { + (*i)->debug (s, p + " "); + } +} -- cgit v1.2.3