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

Function update

dependencies/json/json.hpp:22340–22363  ·  view source on GitHub ↗

! @brief updates a JSON object from another object, overwriting existing keys Inserts all values from JSON object @a j and overwrites existing keys. @param[in] j JSON object to read values from @throw type_error.312 if called on JSON values other than objects; example: `"cannot use update() with string"` @complexity O(N*log(size() + N)), where N is the number of elemen

Source from the content-addressed store, hash-verified

22338 @since version 3.0.0
22339 */
22340 void update(const_reference j)
22341 {
22342 // implicitly convert null value to an empty object
22343 if (is_null())
22344 {
22345 m_type = value_t::object;
22346 m_value.object = create<object_t>();
22347 assert_invariant();
22348 }
22349
22350 if (JSON_HEDLEY_UNLIKELY(!is_object()))
22351 {
22352 JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
22353 }
22354 if (JSON_HEDLEY_UNLIKELY(!j.is_object()))
22355 {
22356 JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name())));
22357 }
22358
22359 for (auto it = j.cbegin(); it != j.cend(); ++it)
22360 {
22361 m_value.object->operator[](it.key()) = it.value();
22362 }
22363 }
22364
22365 /*!
22366 @brief updates a JSON object from another object, overwriting existing keys

Callers 15

setPerLEDMethod · 0.50
mousePressEventMethod · 0.50
mouseMoveEventMethod · 0.50
mouseReleaseEventMethod · 0.50
resizeEventMethod · 0.50
updateSelectionMethod · 0.50
selectLedMethod · 0.50
selectLedsMethod · 0.50
selectSegmentMethod · 0.50
selectZoneMethod · 0.50
setSelectionColorMethod · 0.50
setColorMethod · 0.50

Calls 7

is_nullFunction · 0.70
is_objectFunction · 0.70
createFunction · 0.70
type_nameFunction · 0.70
operator[]Method · 0.45
keyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected