eyBuildLib API Reference : eyBuildLib
ebtree - tree operate lib
treeInsChild( ) - insert pnew as last child node of pnode
treeAddChild( ) - insert pnew as last child node of pnode
treeDelete( ) - delete specify node and its sub tree nodes from root tree
treeParent( ) - get parent node of current node
treeChild( ) - get first child node of current node
treeChildNth( ) - get tree child by index(from 0)
treeSiblingNum( ) - get the number of sibling nodes, not include sub layer
treeChildNum( ) - get the number of child nodes, but not include sub layer
treeForEachChild( ) - done user hook for each child node, but not sub tree
forEachNode( ) - done user hook for each node in current subtree
treeFree( ) - free current tree and sub tree
tree operate lib
treeInsChild( ) - insert pnew as last child node of pnode
int treeInsChild ( TNODE * pnode, /* where insert into */ TNODE * pnew, /* what insert into */ int index /* index insert as */ )
this routine is to insert pnew as last child node of pnode
OK/ERROR
treeAddChild( ) - insert pnew as last child node of pnode
int treeAddChild ( TNODE * pnode, TNODE * pnew )
this routine is to insert pnew as last child node of pnode
OK/ERROR
treeDelete( ) - delete specify node and its sub tree nodes from root tree
int treeDelete ( TNODE * pnode, void (* free)(void * ) )
this routine is to delete specify node and its sub tree nodes from root tree, if pnode is the root of tree, this routine is same with treeFree( ).
OK/ERROR
treeParent( ) - get parent node of current node
TNODE * treeParent ( TNODE * pnode )
this routine is to get parent node of current node
parent, or NULL
treeChild( ) - get first child node of current node
TNODE * treeChild ( TNODE * pnode )
this routine is to get first child node of current node
first child node, or NULL
treeChildNth( ) - get tree child by index(from 0)
TNODE * treeChildNth ( TNODE * pnode, int num )
this routine is to get first child node of current node
first child node, or NULL
treeSiblingNum( ) - get the number of sibling nodes, not include sub layer
int treeSiblingNum ( TNODE * pnode )
this routine is to get the number of sibling nodes, but not include sub layer
number of sibling, or ERROR if pnode invalid
treeChildNum( ) - get the number of child nodes, but not include sub layer
int treeChildNum ( TNODE * pnode )
this routine is to get the number of child of current node
number of child, or ERROR if pnode invalid
treeForEachChild( ) - done user hook for each child node, but not sub tree
void treeForEachChild ( TNODE * pnode, /* pointer to tree node descriptor */ FUN_FOR_EACH done, /* for each hook */ void * cookie, /* hook parameter */ ... )
this routine is to done user hook for each child node, but not sub tree. it means it only process directly child layer one by one.
you can at most transfer 4 parameter to done hook.
N/A
forEachNode( ) - done user hook for each node in current subtree
void treeForEach ( TNODE * pnode, /* pointer to tree node descriptor */ BOOL order, /* !0: preorder, 0 post order */ FUN_FOR_EACH done, /* for each hook */ void * cookie, /* hook parameter */ ... )
this routine is to done user hook for each node in current subtree. the preorder is to specify the traverse order. 0 means post-order, otherwise traverse with pre-order.
N/A
treeFree( ) - free current tree and sub tree
void treeFree ( TNODE * proot, void (* free)(void * ) )
this routine is to done user hook for each node in current subtree
N/A