MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / merge_patch

Function merge_patch

native/thirdpart/json/json.hpp:22581–22605  ·  view source on GitHub ↗

! @brief applies a JSON Merge Patch The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value. The function implements the following algorithm from Section 2 of [RFC 7396 (JSON Merge Patch)](https://tools.i

Source from the content-addressed store, hash-verified

22579 @since version 3.0.0
22580 */
22581 void merge_patch(const basic_json& apply_patch)
22582 {
22583 if (apply_patch.is_object())
22584 {
22585 if (not is_object())
22586 {
22587 *this = object();
22588 }
22589 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
22590 {
22591 if (it.value().is_null())
22592 {
22593 erase(it.key());
22594 }
22595 else
22596 {
22597 operator[](it.key()).merge_patch(it.value());
22598 }
22599 }
22600 }
22601 else
22602 {
22603 *this = apply_patch;
22604 }
22605 }
22606
22607 /// @}
22608};

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected