MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / merge

Function merge

include/jsoncons/basic_json.hpp:4278–4307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4276 // merge
4277
4278 void merge(const basic_json& source)
4279 {
4280 switch (source.storage_kind())
4281 {
4282 case json_storage_kind::empty_object:
4283 break;
4284 case json_storage_kind::object:
4285 switch (storage_kind())
4286 {
4287 case json_storage_kind::empty_object:
4288 create_object_implicitly();
4289 cast<object_storage>().value().merge(source.cast<object_storage>().value());
4290 break;
4291 case json_storage_kind::object:
4292 cast<object_storage>().value().merge(source.cast<object_storage>().value());
4293 break;
4294 case json_storage_kind::json_ref:
4295 cast<json_ref_storage>().value().merge(source);
4296 break;
4297 default:
4298 JSONCONS_THROW(json_runtime_error<std::domain_error>("Attempting to merge a value that is not an object"));
4299 }
4300 break;
4301 case json_storage_kind::json_ref:
4302 merge(source.cast<json_ref_storage>().value());
4303 break;
4304 default:
4305 JSONCONS_THROW(json_runtime_error<std::domain_error>("Attempting to merge a value that is not an object"));
4306 }
4307 }
4308
4309 void merge(basic_json&& source)
4310 {

Callers

nothing calls this directly

Calls 4

storage_kindFunction · 0.85
create_object_implicitlyFunction · 0.85
mergeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected