MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / merge

Method merge

extlibs/vili/src/node.cpp:501–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499 }
500
501 void node::merge(node& value)
502 {
503 if (is_primitive() && value.is_primitive())
504 {
505 m_data = value.m_data;
506 }
507 else if (is<object>() && value.is<object>())
508 {
509 for (auto [key, val] : value.items())
510 {
511 if (this->contains(key))
512 this->at(key).merge(val);
513 else
514 (*this)[key] = val;
515 }
516 }
517 else if (is<array>() && value.is<array>())
518 {
519 for (node& node : value)
520 {
521 this->push(node);
522 }
523 }
524 else
525 {
526 throw exceptions::invalid_merge(
527 to_string(type()), to_string(value.type()), VILI_EXC_INFO);
528 }
529 }
530
531 bool node::contains(const std::string& key) const
532 {

Callers 4

loadMethod · 0.80
Loaders.cppFile · 0.80
pushMethod · 0.80
specialize_templateMethod · 0.80

Calls 8

containsMethod · 0.95
pushMethod · 0.95
invalid_mergeClass · 0.85
is_primitiveMethod · 0.80
to_stringFunction · 0.70
typeEnum · 0.50
atMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected