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

Class JsonUiCheckboxInternal

src/platforms/shared/ui/json/checkbox.cpp.hpp:11–37  ·  view source on GitHub ↗

Definition of the internal class that was previously in checkbox_internal.h

Source from the content-addressed store, hash-verified

9
10// Definition of the internal class that was previously in checkbox_internal.h
11class JsonUiCheckboxInternal : public JsonUiInternal {
12private:
13 bool mValue;
14
15public:
16 // Constructor: Initializes the base JsonUiInternal with name, and sets initial value.
17 JsonUiCheckboxInternal(const fl::string& name, bool value = false)
18 FL_NOEXCEPT : JsonUiInternal(name), mValue(value) {}
19
20 // Override toJson to serialize the checkbox's data directly.
21 void toJson(fl::json& json) const FL_NOEXCEPT override {
22 json.set("name", name());
23 json.set("type", "checkbox");
24 json.set("group", groupName());
25 json.set("id", id());
26 json.set("value", mValue);
27 }
28
29 // Override updateInternal to handle updates from JSON.
30 void updateInternal(const fl::json& json) FL_NOEXCEPT override {
31 mValue = json | false;
32 }
33
34 // Accessors for the checkbox value.
35 bool value() const FL_NOEXCEPT { return mValue; }
36 void setValue(bool value) FL_NOEXCEPT { mValue = value; }
37};
38
39JsonCheckboxImpl::JsonCheckboxImpl(const fl::string &name, bool value) FL_NOEXCEPT {
40 // Create an instance of the new internal class

Callers

nothing calls this directly

Calls 2

idClass · 0.85
setMethod · 0.45

Tested by

no test coverage detected