MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / merge_patch

Function merge_patch

include/behaviortree_cpp/contrib/json.hpp:24424–24448  ·  view source on GitHub ↗

@brief applies a JSON Merge Patch @sa https://json.nlohmann.me/api/basic_json/merge_patch/

Source from the content-addressed store, hash-verified

24422 /// @brief applies a JSON Merge Patch
24423 /// @sa https://json.nlohmann.me/api/basic_json/merge_patch/
24424 void merge_patch(const basic_json& apply_patch)
24425 {
24426 if (apply_patch.is_object())
24427 {
24428 if (!is_object())
24429 {
24430 *this = object();
24431 }
24432 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
24433 {
24434 if (it.value().is_null())
24435 {
24436 erase(it.key());
24437 }
24438 else
24439 {
24440 operator[](it.key()).merge_patch(it.value());
24441 }
24442 }
24443 }
24444 else
24445 {
24446 *this = apply_patch;
24447 }
24448 }
24449
24450 /// @}
24451};

Callers

nothing calls this directly

Calls 6

is_objectFunction · 0.85
eraseFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected