MCPcopy Create free account
hub / github.com/axmolengine/axmol / add

Method add

core/2d/ComponentContainer.cpp:50–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool ComponentContainer::add(Component* com)
51{
52 bool ret = false;
53 AXASSERT(com != nullptr, "Component must be non-nil");
54 AXASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
55 do
56 {
57 auto componentName = com->getName();
58
59 if (_componentMap.find(componentName) != _componentMap.end())
60 {
61 AXASSERT(false, "ComponentContainer already have this kind of component");
62 break;
63 }
64 hlookup::set_item(_componentMap, componentName, com); //_componentMap[componentName] = com;
65 com->retain();
66 com->setOwner(_owner);
67 com->onAdd();
68
69 ret = true;
70 } while (0);
71 return ret;
72}
73
74bool ComponentContainer::remove(std::string_view componentName)
75{

Callers 1

addComponentMethod · 0.45

Calls 8

set_itemFunction · 0.85
setOwnerMethod · 0.80
getOwnerMethod · 0.45
getNameMethod · 0.45
findMethod · 0.45
endMethod · 0.45
retainMethod · 0.45
onAddMethod · 0.45

Tested by

no test coverage detected