QUB_TreeIter

Bidirectional iterator over the children of a QUB_Tree.
The preferred tool for inserting and removing child nodes.

QUB_TreeIter

Unidirectional (forward) iterator over the children of a QUB_Tree.
The most efficient way to loop through children, but can't insert or remove children.



Both QUB_TreeIter and QUB_TreeMonoIter have the same methods; it's just that some of QUB_TreeMonoIter's methods don't work (operator--, prev, insert, remove).
You can assign one kind to the other to make them point to the same child.



QUB_Tree operator*()

Returns the current node. If "current" is one-past-the-last, the node returned is null.

QUB_TreeIter& operator++()

Moves to the next child and returns *this.

QUB_TreeIter& operator--()

Moves to the previous child and returns *this.

Not applicable to QUB_TreeMonoIter

QUB_TreeIter& next( string childName )

Moves to the next child with that name and returns *this.
If none, moves to parent.end()

QUB_TreeIter& prev( string childName )

Moves to the previous child with that name and returns *this.
If none, moves to parent.end().

Not applicable to QUB_TreeMonoIter

QUB_TreeIter& nextByTest( Predicate test )

test      bool test( QUB_Tree n )

Moves to the next child for which test(child) is true.
If none, moves to parent.end().

int index()

Returns the index of the current child.
Might be totally wrong if the children were changed outside this iterator.

void insert( string newChildName )

void insert( QUB_Tree newChild )

Inserts newChild before the current node. If newChild already has a parent, it will be removed first.
newChild becomes the current node.

Not applicable to QUB_TreeMonoIter

QUB_Tree remove()

Removes the current node from parent and returns it. The removed node's former .sibling() becomes the current node.

Not applicable to QUB_TreeMonoIter

QUB_Tree getParent()

Returns the parent of the child nodes being iterated through.