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

Class JsonUiHelpInternal

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

Source from the content-addressed store, hash-verified

9namespace fl {
10
11class JsonUiHelpInternal : public JsonUiInternal {
12 private:
13 fl::string mMarkdownContent;
14
15 public:
16 // Constructor: Initializes the base JsonUiInternal with name, and sets the
17 // help content.
18 JsonUiHelpInternal(const fl::string &name,
19 const fl::string &markdownContent)
20 FL_NOEXCEPT : JsonUiInternal(name), mMarkdownContent(markdownContent) {}
21
22 // Override toJson to serialize the help's data directly.
23 void toJson(fl::json &json) const FL_NOEXCEPT override {
24 json.set("name", name());
25 json.set("type", "help");
26 json.set("group", groupName());
27 json.set("id", id());
28 json.set("markdownContent", mMarkdownContent);
29 }
30
31 // Override updateInternal. Help components 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 // No update needed for help components
35 FL_UNUSED(json);
36 }
37
38 // Accessors for the help content.
39 const fl::string &markdownContent() const FL_NOEXCEPT { return mMarkdownContent; }
40 void setMarkdownContent(const fl::string &markdownContent) FL_NOEXCEPT {
41 mMarkdownContent = markdownContent;
42 }
43};
44
45JsonHelpImpl::JsonHelpImpl(const string &markdownContent) FL_NOEXCEPT {
46 // 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