|
|
@@ -57,20 +57,22 @@ namespace logging {
|
|
|
})}
|
|
|
})};
|
|
|
|
|
|
+ static properties mergeKey(std::string const & key,
|
|
|
+ properties const & defVal,
|
|
|
+ properties const & other) {
|
|
|
+ return other.contains(key) ? defVal.mergedWith(other[key]) : defVal;
|
|
|
+ }
|
|
|
+
|
|
|
properties properties::mergedWith(properties const & other) const {
|
|
|
if (data.is<object_t>()) {
|
|
|
properties out;
|
|
|
for (auto & pair : object()) {
|
|
|
auto & to = out.data.get<object_t>()[pair.first];
|
|
|
- if (other.contains(pair.first)) {
|
|
|
- to = pair.second.mergedWith(other[pair.first]);
|
|
|
- } else {
|
|
|
- to = pair.second;
|
|
|
- }
|
|
|
+ to = mergeKey(pair.first, pair.second, other);
|
|
|
}
|
|
|
return out;
|
|
|
} else {
|
|
|
- return other;
|
|
|
+ return other.data.valid() ? other : *this;
|
|
|
}
|
|
|
}
|
|
|
|