2.1.26.19 tree_check_get_node_by_dataid


Description

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

Syntax

TreeNode tree_check_get_node_by_dataid( TreeNode & trParent, LPCSTR lpcszTag, int nDataID, LPCSTR lpcszLableAttrib = NULL, LPCSTR lpcszAttribVal = NULL )

Parameters

trParent
[Input]TreeNode to be checked if it exists
lpcszTag
[Input]the tagName of this TreeNode
nDataID
[Input]DataID of created TreeNode
lpcszLableAttrib
[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_by_dataid_ex1()
{
    Tree tr;
    int nDataID = 0x0001;
    string strLabel = "Just a testing";
    TreeNode trNode = tree_check_get_node_by_dataid(tr, "NewCreated", nDataID, STR_LABEL_ATTRIB, strLabel);
    out_tree(tr);
}

Remark

See Also

tree_check_get_node

Header to Include

origin.h

Reference