summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-01-08 20:51:26 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-01-08 20:51:26 +0000
commitca49f7cba731bd443c4a62184c8dec892b4ce5e7 (patch)
tree5c10cc5b82b1e22a6a205c4843b1dc6343906d0a /libs
parent57bafcd1f4277ba9805bfb4ed05b8eaffaa7a5ce (diff)
fix audio clock restore, provide XMLNode::property (string) and speed up the property methods by not scanning the map twice. sorry about the recompile
git-svn-id: svn://localhost/ardour2/trunk@1286 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/pbd/xml++.h3
-rw-r--r--libs/pbd/xml++.cc20
2 files changed, 20 insertions, 3 deletions
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h
index 70e231e717..bf26a6f685 100644
--- a/libs/pbd/pbd/xml++.h
+++ b/libs/pbd/pbd/xml++.h
@@ -95,8 +95,11 @@ public:
const XMLPropertyList & properties() const { return _proplist; };
XMLProperty *property(const char * );
+ XMLProperty *property(const std::string&);
const XMLProperty *property(const char * n) const
{ return ((XMLNode *) this)->property(n); };
+ const XMLProperty *property(const std::string& ns) const
+ { return ((XMLNode *) this)->property(ns); };
XMLProperty *add_property(const char *, const string &);
XMLProperty *add_property(const char *, const char * = "");
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc
index 8d783d59f2..5507f658e9 100644
--- a/libs/pbd/xml++.cc
+++ b/libs/pbd/xml++.cc
@@ -289,11 +289,25 @@ XMLProperty *
XMLNode::property(const char * n)
{
string ns(n);
- if (_propmap.find(ns) == _propmap.end()) {
- return 0;
+ map<string,XMLProperty*>::iterator iter;
+
+ if ((iter = _propmap.find(ns)) != _propmap.end()) {
+ return iter->second;
+ }
+
+ return 0;
+}
+
+XMLProperty *
+XMLNode::property(const string & ns)
+{
+ map<string,XMLProperty*>::iterator iter;
+
+ if ((iter = _propmap.find(ns)) != _propmap.end()) {
+ return iter->second;
}
- return _propmap[ns];
+ return 0;
}
XMLProperty *