summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorDaniel Sheeler <dsheeler@pobox.com>2017-05-28 15:46:22 -0500
committerDaniel Sheeler <dsheeler@pobox.com>2017-05-29 15:42:27 -0500
commitd67436af3bf6d1f71ae062d4a50054d847bfb18b (patch)
tree0d733d4d8ddcd6bb96648f24ced085d2de409c4e /libs/pbd
parentb21c4b41a39c4ace711b52c2ee02617e8c274aae (diff)
duplicate routes start off unsoloed to avoid issues related to upstream / downstream buses
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/pbd/xml++.h2
-rw-r--r--libs/pbd/xml++.cc16
2 files changed, 18 insertions, 0 deletions
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h
index 476e367383..6c099dc0c3 100644
--- a/libs/pbd/pbd/xml++.h
+++ b/libs/pbd/pbd/xml++.h
@@ -184,6 +184,8 @@ public:
void remove_nodes_and_delete(const std::string&);
/** Remove and delete all nodes with property prop matching val */
void remove_nodes_and_delete(const std::string& propname, const std::string& val);
+ /** Remove and delete first node with given name and prop matching val */
+ void remove_node_and_delete(const std::string& n, const std::string& propname, const std::string& val);
void dump (std::ostream &, std::string p = "") const;
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc
index c46c5638b8..d5d863e9e5 100644
--- a/libs/pbd/xml++.cc
+++ b/libs/pbd/xml++.cc
@@ -658,6 +658,22 @@ XMLNode::remove_nodes_and_delete(const string& propname, const string& val)
}
}
+void
+XMLNode::remove_node_and_delete(const string& n, const string& propname,
+ const string& val)
+{
+ for (XMLNodeIterator i = _children.begin(); i != _children.end(); ++i) {
+ if ((*i)->name() == n) {
+ XMLProperty const * prop = (*i)->property (propname);
+ if (prop && prop->value() == val) {
+ delete *i;
+ _children.erase(i);
+ break;
+ }
+ }
+ }
+}
+
XMLProperty::XMLProperty(const string& n, const string& v)
: _name(n)
, _value(v)