2.1.26.44 tree_get_node_names


Description

Walk tree and copy all the node name into given string vector

Syntax

void tree_get_node_names( TreeNode & tr, vector<string> & vs, bool bSubNodeOnly = false )

Parameters

tr
[Input]TreeNode to walk
vs
[Output]a linearized array of string values that should map to every tree node
bSubNodeOnly
[Input]true, only walk Sub Node; false, go through entire tree

Return

Examples

EX1

void tree_get_node_names_ex1()
{
    Tree tr;
    tr.Math.Score.dVal = 90.5;
    tr.Math.Bookname.strVal = "Advanced Math";
    tr.English.Score.dVal = 95.5;
    tr.English.Bookname.strVal = "English 1";    
    vector<string>    vsOnlySubNode, vsAllNodes;
    tree_get_node_names(tr, vsOnlySubNode, true);
    tree_get_node_names(tr, vsAllNodes, false);
}

Remark

See Also

Header to Include

origin.h

Reference