mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-14 05:08:39 -05:00
Add macro group helper functions
This commit is contained in:
@@ -117,6 +117,34 @@ GetMacroConditions(Macro *macro)
|
||||
return macro->Conditions();
|
||||
}
|
||||
|
||||
bool IsGroupMacro(Macro *macro)
|
||||
{
|
||||
return macro && macro->IsGroup();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Macro>> GetGroupMacroEntries(Macro *macro)
|
||||
{
|
||||
if (!macro || !macro->IsGroup()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Macro>> entries;
|
||||
entries.reserve(macro->GroupSize());
|
||||
|
||||
const auto ¯os = GetTopLevelMacros();
|
||||
for (auto it = macros.begin(); it < macros.end(); it++) {
|
||||
if ((*it)->Name() != macro->Name()) {
|
||||
continue;
|
||||
}
|
||||
for (uint32_t i = 1; i <= macro->GroupSize(); i++) {
|
||||
entries.emplace_back(*std::next(it, i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
std::condition_variable &GetMacroWaitCV()
|
||||
{
|
||||
static std::condition_variable cv;
|
||||
|
||||
Reference in New Issue
Block a user