Walk tree and copy the specified attribute from all the nodes into given string vector. If the specified attribute does not exist for a node, it is considered as empty.
void tree_get_attributes( TreeNode & tr, vector<string> & vs, LPCSTR lpcszAttribute, bool bSubNodeOnly = false )
EX1
void tree_get_attributes_ex1() { Tree tr; tr.First.nVal = 1; tr.Second.nVal = 2; tr.First.SetAttribute(STR_LABEL_ATTRIB, "The First One"); tr.Second.SetAttribute(STR_LABEL_ATTRIB, "The Second One"); vector<string> vsAttribs; tree_get_attributes(tr, vsAttribs, STR_LABEL_ATTRIB); printf("Tree attributes:\n"); for(int ii=0;ii<vsAttribs.GetSize();ii++) printf("%s\n",vsAttribs[ii]); }
origin.h