MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / merge_patch

Function merge_patch

lesson6-Segmentation/json.hpp:25133–25157  ·  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

25131 @since version 3.0.0
25132 */
25133 void merge_patch(const basic_json& apply_patch)
25134 {
25135 if (apply_patch.is_object())
25136 {
25137 if (!is_object())
25138 {
25139 *this = object();
25140 }
25141 for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
25142 {
25143 if (it.value().is_null())
25144 {
25145 erase(it.key());
25146 }
25147 else
25148 {
25149 operator[](it.key()).merge_patch(it.value());
25150 }
25151 }
25152 }
25153 else
25154 {
25155 *this = apply_patch;
25156 }
25157 }
25158
25159 /// @}
25160};

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected