[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Usata-commits] Changes to usata2/src/object.cpp
From: |
David Lau |
Subject: |
[Usata-commits] Changes to usata2/src/object.cpp |
Date: |
Tue, 01 Mar 2005 19:27:12 -0500 |
Index: usata2/src/object.cpp
diff -u usata2/src/object.cpp:1.7 usata2/src/object.cpp:1.8
--- usata2/src/object.cpp:1.7 Sat Jan 15 19:25:19 2005
+++ usata2/src/object.cpp Wed Mar 2 00:27:11 2005
@@ -143,6 +143,45 @@
}
+Object_sp
+node_path_lookup(const std::string& pPath, Object_sp& start_node)
+{
+ using namespace boost;
+ typedef std::vector<std::string> StringVect;
+
+
+ Object_sp retval;
+
+ StringVect ps;
+ std::string path = node_path_check(pPath);
+ ps.reserve(std::count(path.begin(), path.end(), '/'));
+
+ algorithm::split(ps,path,algorithm::is_any_of("/"));
+
+ StringVect::iterator it(ps.begin()), it_end(ps.end());
+ Object_sp obj =start_node;
+ NodeObject_sp ni;
+ bool success=true;
+ for (;it!=it_end; it++)
+ {
+ ni = dynamic_pointer_cast<NodeObject>(obj);
+ if (ni)
+ obj = ni->get_child(*it);
+ if (!obj || !ni)
+ {
+ success = false;
+ break;
+ }
+
+ }
+
+ if (success)
+ retval = obj;
+
+ return retval;
+
+}
+
namespace exceptions
{
- [Usata-commits] Changes to usata2/src/object.cpp,
David Lau <=