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

Method findUiComponent

src/platforms/shared/ui/json/ui_manager.cpp.hpp:129–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129JsonUiInternalPtr JsonUiManager::findUiComponent(const char* id_or_name) FL_NOEXCEPT {
130 auto components = getComponents();
131
132 for (auto &component : components) {
133 int id = component->id();
134 string componentIdStr;
135 componentIdStr.append(id);
136
137 if (fl::string::strcmp(componentIdStr.c_str(), id_or_name) == 0) {
138 //FL_WARN("*** Found component with ID " << id);
139 return component;
140 }
141 }
142
143 // If we didn't find it by id, try to find it by name
144 for (auto &component : components) {
145 if (fl::string::strcmp(component->name().c_str(), id_or_name) == 0) {
146 return component;
147 }
148 }
149
150 return JsonUiInternalPtr(); // Return null pointer if not found
151}
152
153void JsonUiManager::updateUiComponents(const char* jsonStr) FL_NOEXCEPT {
154 //FL_WARN("*** JsonUiManager::updateUiComponents ENTRY ***");

Callers

nothing calls this directly

Calls 5

strcmpFunction · 0.85
idMethod · 0.45
appendMethod · 0.45
c_strMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected