TreeNode::Clone

Description

Clones a tree node. If bDeep is true, copies the whole branch.

Syntax

TreeNode Clone( BOOL bDeep = TRUE )

Parameters

bDeep
[input] TRUE for coping the whole branch, FALSE for only this node

Return

The cloned node

Examples

EX1

void TreeNode_Clone_ex1()
{
    Tree myTree1;    
    TreeNode tn1 = myTree1.AddTextNode("abc", "node1", 2);
    TreeNode tn2 = tn1.AddTextNode("efg", "node2", 3);//add node2 to node1 as child
    out_tree(myTree1);
    
    Tree myTree2;
    TreeNode tn3 = tn1.Clone(TRUE); //TRUE, copies the node1 as well as its sub-branch             
    myTree2.AddNode(tn3);
    out_tree(myTree2);
}

Remark

Creates a clone of a node i.e., creates an exact copy of a node and its contents. If bDeep is true, copies the whole branch.

See Also

header to Include

origin.h