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

Method FindChild

Source/IDrawableModule.cpp:786–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

784}
785
786IDrawableModule* IDrawableModule::FindChild(const std::string name, bool fail) const
787{
788 if (name.empty())
789 return nullptr;
790 for (int i = 0; i < mChildren.size(); ++i)
791 {
792 if (strcmp(mChildren[i]->Name(), name.c_str()) == 0)
793 return mChildren[i];
794 }
795 if (mTypeName == "effectchain") // Due to an issue in the past where child modules of the effectchain module weren't saving their names correctly we are going to try and fix the loading here.
796 {
797 auto child = FindChild(name.substr(0, name.length() - 1), false);
798 if (child)
799 return child;
800 }
801 if (fail)
802 throw UnknownModuleException(name);
803 return nullptr;
804}
805
806void IDrawableModule::AddChild(IDrawableModule* child)
807{

Callers 1

FindModuleMethod · 0.80

Calls 5

emptyMethod · 0.80
sizeMethod · 0.80
lengthMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected