C4 Engine
C4 Engine API Documentation

Tree::GetPreviousTreeNode

Defined in:  TSTree.h
Returns the previous node in a traversal of a tree.
Prototype

type *GetPreviousTreeNode(const Tree<type> *node) const;

Parameters
node A pointer to the current node in the traversal.
Description
To iterate backward through the subnode hierarchy of a tree, the GetPreviousTreeNode function should be repeatedly called for the root node of the tree until it returns nullptr. The root node is considered the first node visited in the tree. The second node is obtained by calling GetPreviousTreeNode with the node parameter set to a pointer to the root node. The traversal occurs in depth-first order, meaning that a particular node's entire subtree is visited before the previous node at the same level in the tree. The traversal is also a pre-order traversal, meaning that a particular node is visited before any of its subnodes are visited.
See Also

Tree::GetLastSubnode

Tree::GetPreviousLevelNode

Tree::GetNextTreeNode

Tree::GetNextLevelNode

Tree::GetPreviousSubnode

Tree::GetNextSubnode

Tree::GetSuperNode

Tree::GetRootNode