Project::DeleteTree

Description

Deletes the tree referred to by name, lpcszName

Syntax

BOOL DeleteTree( LPCSTR lpcszName )

Parameters

lpcszName
[input] name of the Tree to be deleted

Return

Returns non zero if successful, else zero

Examples

EX1

//Deletes the tree referred to by name.
void Project_DeleteTree_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);
    vector<string> vsTreeNames;
    int nV = Project.GetTreeNames(vsTreeNames);
    if(!nV)
    {
        out_str("No tree in Project!");
        return;
    }
    else
    {
        printf("Trees in the project :\n");
        for(int ii=0; ii<nV; ii++)
            printf("(%d) %s\n", ii+1,vsTreeNames[ii]);
    }
    
    BOOL bRet = Project.DeleteTree(strTreeName);
    if(!bRet)
    {
        out_str("Error");
        return;
    }
    out_str("\nDelete tree "+ strTreeName+"\n");
    nV = Project.GetTreeNames(vsTreeNames);
    if(!nV)
        out_str("No tree in Project!");
    else
    {
        printf("Trees in the project :\n");
        for(int ii=0; ii<nV; ii++)
            printf("(%d) %s\n", ii+1,vsTreeNames[ii]);
    }
    return;
}

Remark

See Also

Project::AddTree, Project::GetTree

header to Include

origin.h