|
From: <ar...@us...> - 2007-06-25 16:35:30
|
Revision: 589
http://svn.sourceforge.net/xml-cppdom/?rev=589&view=rev
Author: aronb
Date: 2007-06-25 09:35:32 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
Add getPath() that returns the path of a Node.
Modified Paths:
--------------
trunk/cppdom/cppdom.cpp
trunk/cppdom/cppdom.h
Modified: trunk/cppdom/cppdom.cpp
===================================================================
--- trunk/cppdom/cppdom.cpp 2007-06-25 16:34:49 UTC (rev 588)
+++ trunk/cppdom/cppdom.cpp 2007-06-25 16:35:32 UTC (rev 589)
@@ -826,6 +826,18 @@
return mParent;
}
+ std::string Node::getPath()
+ {
+ std::string path(getName());
+ Node* parent = getParent();
+ while (parent != NULL)
+ {
+ path = parent->getName() + "/" + path;
+ parent = parent->getParent();
+ }
+ return path;
+ }
+
/** \exception throws cppdom::Error when a streaming or parsing error occur */
void Node::load(std::istream& in, ContextPtr& context)
{
Modified: trunk/cppdom/cppdom.h
===================================================================
--- trunk/cppdom/cppdom.h 2007-06-25 16:34:49 UTC (rev 588)
+++ trunk/cppdom/cppdom.h 2007-06-25 16:35:32 UTC (rev 589)
@@ -624,6 +624,11 @@
*/
Node* getParent() const;
+ /**
+ * Returns the full path of this node.
+ */
+ std::string getPath();
+
void addChild(NodePtr& node);
bool removeChild(NodePtr& node);
bool removeChild(std::string& childName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|