MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / merge_patch

Function merge_patch

examples/server/json.hpp:24269–24293  ·  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

24267 /// @brief applies a JSON Merge Patch
24268 /// @sa https://json.nlohmann.me/api/basic_json/merge_patch/
24269 void merge_patch(const basic_json& apply_patch)
24270 {
24271 if (apply_patch.is_object())
24272 {
24273 if (!is_object())
24274 {
24275 *this = object();
24276 }
24277 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
24278 {
24279 if (it.value().is_null())
24280 {
24281 erase(it.key());
24282 }
24283 else
24284 {
24285 operator[](it.key()).merge_patch(it.value());
24286 }
24287 }
24288 }
24289 else
24290 {
24291 *this = apply_patch;
24292 }
24293 }
24294
24295 /// @}
24296};

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