Replace nodes with AllocationFailures inside the tree when needed

This commit is contained in:
Léa Saviot
2018-06-29 14:21:10 +02:00
parent cb77fbe2ff
commit 2684b2f09f
15 changed files with 139 additions and 83 deletions

View File

@@ -127,6 +127,14 @@ int TreeNode::indexOfChild(const TreeNode * child) const {
return indexOfChildByIdentifier(child->identifier());
}
int TreeNode::indexInParent() const {
TreeNode * p = parentTree();
if (p == nullptr) {
return -1;
}
return p->indexOfChildByIdentifier(m_identifier);
}
bool TreeNode::hasChild(const TreeNode * child) const {
if (child == nullptr) {
return false;