From ca49f7cba731bd443c4a62184c8dec892b4ce5e7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 8 Jan 2007 20:51:26 +0000 Subject: 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 --- libs/pbd/pbd/xml++.h | 3 +++ libs/pbd/xml++.cc | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'libs') 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::iterator iter; + + if ((iter = _propmap.find(ns)) != _propmap.end()) { + return iter->second; + } + + return 0; +} + +XMLProperty * +XMLNode::property(const string & ns) +{ + map::iterator iter; + + if ((iter = _propmap.find(ns)) != _propmap.end()) { + return iter->second; } - return _propmap[ns]; + return 0; } XMLProperty * -- cgit v1.2.3