tree_check_get_node_by_label

 

Description

Get a tree node and check if it is already present by label attribute, if not, create it first

Syntax

TreeNode tree_check_get_node_by_label(TreeNode& tr, LPCSTR lpcszLabel, BOOL bCaseSensitive = FALSE)

Parameters

tr
[Input]TreeNode to be checked if it exists
lpcszLabel
[Input]the label attribute name
bCaseSensitive
[input] the label attribute name if case sensitive

Return

found TreeNode, or returns created TreeNode if not found

Examples

EX1

void tree_check_get_node_by_label_ex1()
{
    Tree tr;
    tr.abc.SetAttribute(STR_LABEL_ATTRIB, "this is a test");
    tr.def.nVal = 1;
    
    TreeNode trNode = tree_check_get_node_by_label(tr, "this is a test"); // should return abc treenode
    if( trNode)
        out_str(trNode.tagName); // shoule output "abc"
}

Remark

See Also

tree_get_node, tree_get_node_by_dataid

header to Include

origin.h

Reference