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

    return nullptr;
}
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;
}
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;
}