PIValueTree::applyValues

This commit is contained in:
2023-02-07 23:24:43 +03:00
parent df4dcd7f32
commit d743cc66d8
2 changed files with 15 additions and 0 deletions

View File

@@ -105,6 +105,19 @@ void PIValueTree::mergeAttributes(const PIVariantMap & a) {
}
void PIValueTree::applyValues(const PIValueTree & root) {
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());
break;
}
}
}
}
bool PIValueTree::contains(const PIString & name) const {
if (_is_null) return true;
for (const auto & c: _children)

View File

@@ -88,6 +88,8 @@ public:
void setAttribute(const PIString & n, const PIVariant & a);
void mergeAttributes(const PIVariantMap & a);
void applyValues(const PIValueTree & root);
const PIVector<PIValueTree> & children() const { return _children; }
void clearChildren() { _children.clear(); }