PIValueTree::applyValues now can be recursive

This commit is contained in:
2023-03-21 14:55:55 +03:00
parent 0cd1206f94
commit 49f5de26eb
2 changed files with 3 additions and 2 deletions

View File

@@ -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;
for (const auto & c: root._children) {
for (auto & i: _children) {
if (c.name() == i.name()) {
i._value.setValueFromString(c.value().toString());
if (recursive) i.applyValues(c, recursive);
break;
}
}

View File

@@ -88,7 +88,7 @@ public:
void setAttribute(const PIString & n, const PIVariant & 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; }
void clearChildren() { _children.clear(); }