Count all node number of the given tree by attribute or attribute and value.
int tree_count_items_by_attribute( TreeNode & tr, LPCSTR lpcszAttribute = NULL, LPCSTR lpcszValue = NULL, bool bMissingIsMatch = true, bool bRecursive = true )
total number of sub nodes with attribute or all sub nodes.
EX1
void tree_count_items_by_attribute_ex1() { Tree tr; tr.Math.Grade.dVal = 90.5; tr.DataID = 12; tr.Math.DataID = 13; tr.English.Grade.dVal = 95.5; tr.English.Grade.DataID = 12; tr.Math.Bookname.strVal = "Advanced Math"; tr.Math.Bookname.DataID = 12; tr.English.Bookname.strVal = "English 1"; int nCount = tree_count_items_by_attribute(tr); ASSERT(nCount == 6); int nSections; nCount = tree_count_items_by_attribute(tr, STR_DATAID_ATTRIB, "12"); }
tree_count_items
origin.h