2.1.26.20 tree_check_get_node


Description

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

Syntax

TreeNode tree_check_get_node( TreeNode & tr, LPCSTR lpcszTag, int nID = 0, LPCSTR lpcszAttribName = NULL, LPCSTR lpcszAttribVal = NULL )

Parameters

tr
[Input]TreeNode to be checked if it exists
lpcszTag
[Input]the tagName of this TreeNode
nID
[Input]node ID of created TreeNode
lpcszAttribName
[Input]specify Attribute name, it can be NULL
lpcszAttribVal
[Input]specify Attribute value, it must be NULL when lpcszAttribName is not specified.

Return

found TreeNode, or returns created TreeNode if not found

Examples

EX1

void tree_check_get_node_ex1()
{
    Tree tr;
    int nID = 0x0001;
    string strLabel = "Just a testing";
    TreeNode trNode = tree_check_get_node(tr, "NewCreated", nID, STR_LABEL_ATTRIB, strLabel);
    out_tree(tr);
}

Remark

See Also

tree_get_node

Header to Include

origin.h

Reference