2.1.26.41 tree_get_node_by_id


Description

get TreeNode by ID matching

Syntax

TreeNode tree_get_node_by_id( const TreeNode & tr, int nID, bool bRecursive = false )

Parameters

tr
[input]TreeNode to walk
nID
[input]tree node ID to be used
bRecursive
[input]true, go through all the tree node in tr;
false, just go through the Children of tr

Return

Returns the TreeNode be found, invalid tree node if not found.

Examples

EX1

void tree_get_node_by_id_ex1()
{
    Tree myTree;
    TreeNode tn1, tn2, tn3;
    tn1 = myTree.AddNode("Tom", 1);
    tn2 = myTree.AddTextNode("Girl", "Jane", 2);
    tn3 = tn2.AddTextNode("12", "Age", 3);
    TreeNode trAge;
    trAge = tree_get_node_by_id(myTree, 3, false); //trAge is invalid
    trAge = tree_get_node_by_id(myTree, 3, true);  //trAge is valid here    
}

Remark

See Also

tree_get_node_by_dataid

Header to Include

origin.h

Reference