2.1.26.60 tree_remove_attribute


Description

Walk all tree nodes to delete specified attribute

Syntax

int tree_remove_attribute( TreeNode & tr, LPCSTR lpcszAttribute )

Parameters

tr
[Modify]TreeNode to walk
lpcszAttribute
[Input]attribute name to delete

Return

total number of nodes the specified attribute is deleted

Examples

EX1

void tree_remove_attribute_ex1()
{
    Tree tr;
    tr.First.DataID = 1;
    tr.Second.DataID = 2;
    tr.End.nVal = 0;
 
    int nCount = tree_remove_attribute(tr, STR_DATAID_ATTRIB); // return the count of treenodes removed attritute
    printf("%d\n", nCount); // nCount should be 2 here
    
    string strDataID;
	bool bRet = tr.Second.GetAttribute(STR_DATAID_ATTRIB, strDataID); //should return false here
	printf("bRet = %d, strDataID = %s\n", bRet, strDataID);    
}

Remark

See Also

Header to Include

origin.h

Reference