MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / merge_patch

Function merge_patch

extern/json/json.hpp:24313–24337  ·  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

24311 /// @brief applies a JSON Merge Patch
24312 /// @sa https://json.nlohmann.me/api/basic_json/merge_patch/
24313 void merge_patch(const basic_json& apply_patch)
24314 {
24315 if (apply_patch.is_object())
24316 {
24317 if (!is_object())
24318 {
24319 *this = object();
24320 }
24321 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
24322 {
24323 if (it.value().is_null())
24324 {
24325 erase(it.key());
24326 }
24327 else
24328 {
24329 operator[](it.key()).merge_patch(it.value());
24330 }
24331 }
24332 }
24333 else
24334 {
24335 *this = apply_patch;
24336 }
24337 }
24338
24339 /// @}
24340};

Callers

nothing calls this directly

Calls 7

is_objectFunction · 0.85
eraseFunction · 0.70
objectFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected