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

Method FindModule

Source/ModuleContainer.cpp:405–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405IDrawableModule* ModuleContainer::FindModule(std::string name, bool fail)
406{
407 /*string ownerPath = "";
408 if (mOwner)
409 ownerPath = mOwner->Path();
410 if (strstr(name.c_str(), ownerPath.c_str()) != name.c_str()) //path doesn't start with ownerPath
411 return nullptr;
412
413 name = name.substr(ownerPath.length());*/
414
415 if (name == "")
416 return nullptr;
417
418 for (int i = 0; i < mModules.size(); ++i)
419 {
420 if (name == mModules[i]->Name())
421 return mModules[i];
422 std::vector<std::string> tokens = ofSplitString(name, "~");
423 if (mModules[i]->GetContainer())
424 {
425 if (tokens[0] == mModules[i]->Name())
426 {
427 ofStringReplace(name, tokens[0] + "~", "", true);
428 return mModules[i]->GetContainer()->FindModule(name, fail);
429 }
430 }
431 if (tokens.size() == 2 && tokens[0] == mModules[i]->Name())
432 {
433 IDrawableModule* child = nullptr;
434 try
435 {
436 child = mModules[i]->FindChild(tokens[1], fail);
437 }
438 catch (UnknownModuleException& e)
439 {
440 }
441 if (child)
442 return child;
443 }
444 }
445
446 if (fail)
447 throw UnknownModuleException(name);
448 return nullptr;
449}
450
451IUIControl* ModuleContainer::FindUIControl(std::string path)
452{

Callers

nothing calls this directly

Calls 7

ofSplitStringFunction · 0.85
ofStringReplaceFunction · 0.85
sizeMethod · 0.80
FindChildMethod · 0.80
NameMethod · 0.45
GetContainerMethod · 0.45

Tested by

no test coverage detected