PIValueTree::applyValues now can be recursive
This commit is contained in:
@@ -105,12 +105,13 @@ void PIValueTree::mergeAttributes(const PIVariantMap & a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIValueTree::applyValues(const PIValueTree & root) {
|
void PIValueTree::applyValues(const PIValueTree & root, bool recursive) {
|
||||||
if (_is_null) return;
|
if (_is_null) return;
|
||||||
for (const auto & c: root._children) {
|
for (const auto & c: root._children) {
|
||||||
for (auto & i: _children) {
|
for (auto & i: _children) {
|
||||||
if (c.name() == i.name()) {
|
if (c.name() == i.name()) {
|
||||||
i._value.setValueFromString(c.value().toString());
|
i._value.setValueFromString(c.value().toString());
|
||||||
|
if (recursive) i.applyValues(c, recursive);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
void setAttribute(const PIString & n, const PIVariant & a);
|
void setAttribute(const PIString & n, const PIVariant & a);
|
||||||
void mergeAttributes(const PIVariantMap & a);
|
void mergeAttributes(const PIVariantMap & a);
|
||||||
|
|
||||||
void applyValues(const PIValueTree & root);
|
void applyValues(const PIValueTree & root, bool recursive = true);
|
||||||
|
|
||||||
const PIVector<PIValueTree> & children() const { return _children; }
|
const PIVector<PIValueTree> & children() const { return _children; }
|
||||||
void clearChildren() { _children.clear(); }
|
void clearChildren() { _children.clear(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user