MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / merge_patch

Function merge_patch

dependencies/json/json.hpp:25216–25240  ·  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

25214 @since version 3.0.0
25215 */
25216 void merge_patch(const basic_json& apply_patch)
25217 {
25218 if (apply_patch.is_object())
25219 {
25220 if (!is_object())
25221 {
25222 *this = object();
25223 }
25224 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
25225 {
25226 if (it.value().is_null())
25227 {
25228 erase(it.key());
25229 }
25230 else
25231 {
25232 operator[](it.key()).merge_patch(it.value());
25233 }
25234 }
25235 }
25236 else
25237 {
25238 *this = apply_patch;
25239 }
25240 }
25241
25242 /// @}
25243};

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected