Example #1
0
TWidget::ChildRef TWidget::FindChild(const Name& key) {
    const auto parts = String::split(key, keySep());
    Child currentObject = shared_from_this();
    for(const auto& part : parts) {
        if (currentObject == nullptr) {
            break;
        }
        if (currentObject->children.count(part) == 0) {
            currentObject.reset();
        } else {
            currentObject = currentObject->children.at(part);
        }
    }
    if (currentObject.get() == this) {
        currentObject.reset();
    }
    return currentObject;
}
Example #2
0
testlist::Child testlist::Child::create()  {
    if(instanceCount() == 0)
        return Child();
    Child result = popFreeChild();
    if(!result.isValid())
    {
        if(getUsed() >= instanceCount())
            reallocInstances(instanceCount() << 1);
        result = Child(getUsed());
        setUsed(getUsed() + 1);
    }
    result.reset();
    result.onCreate();
    return result;
}