Esempio n. 1
0
CTreeItem *CProjectItem::findSiblingChildInstanceOf(ClassDef *classDef, CTreeItem *startItem) const {
    for (CTreeItem *treeItem = startItem->getParent()->getNextSibling();
            treeItem; treeItem = treeItem->getNextSibling()) {
        for (CTreeItem *childItem = treeItem->getFirstChild();
                childItem; childItem = childItem->getNextSibling()) {
            if (childItem->isInstanceOf(classDef))
                return childItem;
        }
    }

    return nullptr;
}
Esempio n. 2
0
CDontSaveFileItem *CProjectItem::getDontSaveFileItem() const {
    for (CTreeItem *treeItem = getFirstChild(); treeItem; treeItem = treeItem->getNextSibling()) {
        if (treeItem->isInstanceOf(CDontSaveFileItem::_type))
            return dynamic_cast<CDontSaveFileItem *>(treeItem);
    }

    return nullptr;
}
Esempio n. 3
0
CTreeItem *CProjectItem::findChildInstance(ClassDef *classDef) const {
    CTreeItem *treeItem = getFirstChild();
    if (treeItem == nullptr)
        return nullptr;

    do {
        CTreeItem *childItem = treeItem->getFirstChild();
        if (childItem) {
            do {
                if (childItem->isInstanceOf(classDef))
                    return childItem;
            } while ((childItem = childItem->getNextSibling()) != nullptr);
        }
    } while ((treeItem = treeItem->getNextSibling()) != nullptr);

    return nullptr;
}
Esempio n. 4
0
CViewItem *CProjectItem::findView(int roomNumber, int nodeNumber, int viewNumber) {
    CTreeItem *treeItem = getFirstChild();
    CRoomItem *roomItem = nullptr;

    // Scan for the specified room
    if (treeItem) {
        do {
            CTreeItem *childItem = treeItem->getFirstChild();
            CRoomItem *rItem = dynamic_cast<CRoomItem *>(childItem);
            if (rItem && rItem->_roomNumber == roomNumber) {
                roomItem = rItem;
                break;
            }
        } while ((treeItem = treeItem->getNextSibling()) != nullptr);
    }
    if (!roomItem)
        return nullptr;

    // Scan for the specified node within the room
    CNodeItem *nodeItem = nullptr;

    CNodeItem *nItem = dynamic_cast<CNodeItem *>(
                           roomItem->findChildInstanceOf(CNodeItem::_type));
    for (; nItem && !nodeItem; nItem = dynamic_cast<CNodeItem *>(
                                           findNextInstanceOf(CNodeItem::_type, nItem))) {
        if (nItem->_nodeNumber == nodeNumber)
            nodeItem = nItem;
    }
    if (!nodeItem)
        return nullptr;

    // Scan for the specified view within the node
    CViewItem *viewItem = dynamic_cast<CViewItem *>(
                              nodeItem->findChildInstanceOf(CViewItem::_type));
    for (; viewItem; viewItem = dynamic_cast<CViewItem *>(
                                    findNextInstanceOf(CViewItem::_type, viewItem))) {
        if (viewItem->_viewNumber == viewNumber)
            return viewItem;
    }

    return nullptr;
}