MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / CheckHeldKeysMatch

Function CheckHeldKeysMatch

Source/ModuleFactory.cpp:583–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581namespace
582{
583 bool CheckHeldKeysMatch(juce::String name, std::string heldKeys, bool continuous)
584 {
585 name = name.toLowerCase();
586
587 if (name.isEmpty() || heldKeys.empty())
588 return false;
589
590 if (continuous)
591 return name.contains(heldKeys);
592
593 if (name[0] != heldKeys[0])
594 return false;
595
596 int stringPos = 0;
597 int end = name.indexOfChar('.');
598 if (end == -1)
599 end = name.indexOfChar(' ');
600 if (end == -1)
601 end = name.length() - 1;
602 for (size_t j = 1; j < heldKeys.length(); ++j)
603 {
604 stringPos = name.substring(stringPos + 1, end + 1).indexOfChar(heldKeys[j]);
605 if (stringPos == -1) //couldn't find key in remaining string
606 return false;
607 }
608
609 return true;
610 }
611}
612
613std::vector<ModuleFactory::Spawnable> ModuleFactory::GetSpawnableModules(std::string keys, bool continuousString)

Callers 1

GetSpawnableModulesMethod · 0.85

Calls 3

emptyMethod · 0.80
containsMethod · 0.80
lengthMethod · 0.80

Tested by

no test coverage detected