MCPcopy Create free account
hub / github.com/davemoore22/sorcery / get_custom

Method get_custom

src/resources/componentstore.cpp:116–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116auto Sorcery::ComponentStore::get_custom(std::string_view screen)
117 -> std::optional<std::vector<Component>> {
118
119 // First check if we need to reload if anything has changed!
120 if (need_refresh())
121 load(_file);
122
123 // Else return the requested components for the screen
124 std::vector<Component> results;
125 if (_loaded) {
126
127 for (const auto &[unique_key, component] : _components) {
128 if ((component.form == screen) &&
129 (component.drawmode == Enums::Layout::DrawMode::MANUAL)) {
130 results.push_back(component);
131 }
132 }
133
134 // Sort by priority
135 std::sort(results.begin(), results.end(),
136 [](const auto &first, const auto &second) {
137 return first.priority < second.priority;
138 });
139
140 return results;
141 }
142
143 return std::nullopt;
144}
145
146auto Sorcery::ComponentStore::load(const std::filesystem::path filename)
147 -> bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected