2.2.4.38.7 Project::AddTree

Description

Adds a Tree Object to a serializable Internal Tree Manager

Syntax

int AddTree( LPCSTR lpcszName, const TreeNode & tr )

Parameters

lpcszName
[input] name of the Tree, this is a globally unique tag used for future access of this tree
tr
[input] a tree node to be added to the internal manager

Return

returns the number of trees in the manager

Examples

EX1

//Add tree to the project and output the tree.
void Project_AddTree_Ex1()
{
    string strTreeName = "MyTree";

    Tree tr;
    tr.SetAttribute(STR_LABEL_ATTRIB, strTreeName);
    tr.node1.nVal = 1234;
    tr.node2.strVal = "abcd";
    
    int nTree = Project.AddTree(strTreeName, tr);
    
    TreeNode trGet;
    BOOL bRet = Project.GetTree(strTreeName, trGet);
    if(!trGet.IsValid())
        out_str("Error!");
    else
        out_tree(trGet);
}

Remark

See Also

Project::GetTreeNames, Project::DeleteTree, Project::GetTree

Header to Include

origin.h