MCPcopy Create free account
hub / github.com/FastLED/FastLED / set

Method set

src/fl/stl/json.h:703–718  ·  view source on GitHub ↗

Set methods for building objects

Source from the content-addressed store, hash-verified

701
702 // Set methods for building objects
703 void set(const fl::string& key, const json& value) FL_NOEXCEPT {
704 if (!mValue || !mValue->is_object()) {
705 mValue = fl::make_shared<json_value>(json_object{});
706 }
707 // Directly assign the value to the object without going through json::operator[]
708 auto objPtr = mValue->data.ptr<json_object>();
709 if (objPtr) {
710 // Create or update the entry directly
711 if (value.mValue) {
712 (*objPtr)[key] = value.mValue;
713 } else {
714 // If value has null mValue, create a null json_value
715 (*objPtr)[key] = fl::make_shared<json_value>(nullptr);
716 }
717 }
718 }
719
720 void set(const fl::string& key, bool value) FL_NOEXCEPT { set(key, json(value)); }
721 void set(const fl::string& key, int value) FL_NOEXCEPT { set(key, json(value)); }

Callers

nothing calls this directly

Calls 3

setClass · 0.70
jsonClass · 0.70
is_objectMethod · 0.45

Tested by

no test coverage detected