X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fxml%2B%2B.cc;h=80fc88242dc9884dc79b5351a10bcd37830c981c;hb=9fb78d091de6abcf155e73728b15ea3c311e124e;hp=6d260f252503e4098e85a5604df9dbe44ffc4e3b;hpb=ff05c823124135274e6274252eaa0487b93b7df1;p=ardour.git diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 6d260f2525..80fc88242d 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -6,7 +6,10 @@ */ #include + +#include "pbd/stacktrace.h" #include "pbd/xml++.h" + #include #include #include @@ -404,7 +407,32 @@ XMLNode::add_content(const string& c) return add_child_copy(XMLNode (string(), c)); } -XMLProperty* +XMLProperty const * +XMLNode::property(const char* n) const +{ + string ns(n); + map::const_iterator iter; + + if ((iter = _propmap.find(ns)) != _propmap.end()) { + return iter->second; + } + + return 0; +} + +XMLProperty const * +XMLNode::property(const string& ns) const +{ + map::const_iterator iter; + + if ((iter = _propmap.find(ns)) != _propmap.end()) { + return iter->second; + } + + return 0; +} + +XMLProperty * XMLNode::property(const char* n) { string ns(n); @@ -417,7 +445,7 @@ XMLNode::property(const char* n) return 0; } -XMLProperty* +XMLProperty * XMLNode::property(const string& ns) { map::iterator iter; @@ -429,6 +457,17 @@ XMLNode::property(const string& ns) return 0; } +bool +XMLNode::has_property_with_value (const string& key, const string& value) const +{ + map::const_iterator iter = _propmap.find(key); + if (iter != _propmap.end()) { + const XMLProperty* p = (iter->second); + return (p && p->value() == value); + } + return false; +} + XMLProperty* XMLNode::add_property(const char* n, const string& v) { @@ -523,7 +562,7 @@ void XMLNode::remove_nodes_and_delete(const string& propname, const string& val) { XMLNodeIterator i = _children.begin(); - XMLProperty* prop; + XMLProperty const * prop; while (i != _children.end()) { prop = (*i)->property(propname);