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

Method AddChild

Source/IDrawableModule.cpp:806–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804}
805
806void IDrawableModule::AddChild(IDrawableModule* child)
807{
808 if (dynamic_cast<IDrawableModule*>(child->GetParent()))
809 dynamic_cast<IDrawableModule*>(child->GetParent())->RemoveChild(child);
810 child->SetParent(this);
811 if (child->Name()[0] == 0)
812 child->SetName(("child" + ofToString(mChildren.size())).c_str());
813
814 for (int i = 0; i < mChildren.size(); ++i)
815 {
816 if (strcmp(mChildren[i]->Name(), child->Name()) == 0)
817 {
818 child->SetName(GetUniqueName(child->Name(), mChildren).c_str());
819 break;
820 }
821 }
822
823 mChildren.push_back(child);
824}
825
826void IDrawableModule::RemoveChild(IDrawableModule* child)
827{

Callers 2

AddModuleMethod · 0.80
TakeModuleMethod · 0.80

Calls 8

ofToStringFunction · 0.85
GetUniqueNameFunction · 0.85
GetParentMethod · 0.80
RemoveChildMethod · 0.80
SetParentMethod · 0.80
sizeMethod · 0.80
NameMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected