diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-05-23 00:52:25 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-05-23 00:52:25 +0000 |
commit | 1401a527643c4bd8712b9612821f5df7a408481e (patch) | |
tree | 4f9fcd02491766a5546d167373ae458ab07c0ae7 /libs/pbd/xml++.cc | |
parent | 8b4eea3c7714965c081e9316df7e346e6f649ec2 (diff) |
* changed return type for pbd/xml++ xpath support to use boost::shared_ptr
git-svn-id: svn://localhost/ardour2/branches/3.0@3402 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/xml++.cc')
-rw-r--r-- | libs/pbd/xml++.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 9881dc5bee..8dff34c678 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -13,7 +13,7 @@ static XMLNode *readnode(xmlNodePtr); static void writenode(xmlDocPtr, XMLNode *, xmlNodePtr, int); -static XMLNodeList *find_impl(xmlXPathContext* ctxt, const string xpath); +static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string xpath); XMLTree::XMLTree() : _filename(), @@ -285,14 +285,15 @@ XMLNode::add_child_copy(const XMLNode& n) return copy; } -XMLNodeList* +boost::shared_ptr<XMLSharedNodeList> XMLNode::find(const string xpath) const { xmlDocPtr doc = xmlNewDoc((xmlChar *) XML_VERSION); writenode(doc, (XMLNode *) this, doc->children, 1); xmlXPathContext* ctxt = xmlXPathNewContext(doc); - XMLNodeList* result = find_impl(ctxt, xpath); + boost::shared_ptr<XMLSharedNodeList> result = + boost::shared_ptr<XMLSharedNodeList>(find_impl(ctxt, xpath)); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); @@ -497,7 +498,7 @@ writenode(xmlDocPtr doc, XMLNode * n, xmlNodePtr p, int root = 0) } } -static XMLNodeList* find_impl(xmlXPathContext* ctxt, const string xpath) +static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string xpath) { xmlXPathObject* result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt); @@ -519,12 +520,12 @@ static XMLNodeList* find_impl(xmlXPathContext* ctxt, const string xpath) } xmlNodeSet* nodeset = result->nodesetval; - XMLNodeList* nodes = new XMLNodeList(); + XMLSharedNodeList* nodes = new XMLSharedNodeList(); if( nodeset ) { for (int i = 0; i < nodeset->nodeNr; ++i) { XMLNode* node = readnode(nodeset->nodeTab[i]); - nodes->push_back(node); + nodes->push_back(boost::shared_ptr<XMLNode>(node)); } } else |