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

Class JsonUiDescriptionInternal

src/platforms/shared/ui/json/description.cpp.hpp:12–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace fl {
11
12class JsonUiDescriptionInternal : public JsonUiInternal {
13 private:
14 fl::string mText;
15
16 public:
17 // Constructor: Initializes the base JsonUiInternal with name, and sets the
18 // description text.
19 JsonUiDescriptionInternal(const fl::string &name, const fl::string &text)
20 FL_NOEXCEPT : JsonUiInternal(name), mText(text) {}
21
22 // Override toJson to serialize the description's data directly.
23 void toJson(fl::json &json) const FL_NOEXCEPT override {
24 json.set("name", name());
25 json.set("type", "description");
26 json.set("group", groupName());
27 json.set("id", id());
28 json.set("text", mText);
29 }
30
31 // Override updateInternal. Descriptions typically don't have update
32 // functionality from the UI, so this can be a no-op.
33 void updateInternal(const fl::json &json) FL_NOEXCEPT override {
34 FL_UNUSED(json);
35 // No update needed for description components
36 }
37
38 // Accessors for the description text.
39 const fl::string &text() const FL_NOEXCEPT { return mText; }
40 void setText(const fl::string &text) FL_NOEXCEPT { mText = text; }
41};
42
43JsonDescriptionImpl::JsonDescriptionImpl(const string &text) FL_NOEXCEPT {
44 // 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