Walk tree and store attribute "OldValue" into all the nodes that has different value from the specified string. The vs array can be obtained by tree_get_values.
int tree_update_changes( TreeNode & tr, const vector<string> & vs )
Total number of nodes that has OldValue attributes added (changed)
EX1
void tree_update_changes_ex1() { Tree tr; TreeNode trFirst = tr.AddNode("First"); trFirst.SetAttribute(STR_CHANGED_ATTRIB, "Changed"); TreeNode trSecond = tr.AddNode("Second"); trSecond.SetAttribute(STR_CHANGED_ATTRIB, "Changed"); vector<string> vs={"First", "Second"}; int nCount = tree_update_changes(tr, vs); printf("%d nodes changed:\n", nCount); string strLabel; foreach(TreeNode trNode in tr.Children) { trNode.GetAttribute(STR_CHANGED_ATTRIB, strLabel); out_str(strLabel); } }
origin.h