Walk all nodes, look for nodes with ID, and apply it to destination tree nodes that has same ID
int tree_copy_values_by_id( const TreeNode & trSrc, TreeNode & trDest )
number of nodes that the values are copied or 0 if none.
EX1
void tree_copy_values_by_id_ex1() { Tree trSrc; Tree trDes; trSrc.China.SetAttribute(STR_DATAID_ATTRIB,1); trSrc.China.strVal = "Asia"; trSrc.France.SetAttribute(STR_DATAID_ATTRIB,2); trSrc.France.strVal = "Europe"; trSrc.Egypt.SetAttribute(STR_DATAID_ATTRIB,3); trSrc.Egypt.strVal = "Africa"; trDes.India.SetAttribute(STR_DATAID_ATTRIB,1); trDes.England.SetAttribute(STR_DATAID_ATTRIB,2); trDes.Congo.SetAttribute(STR_DATAID_ATTRIB,3); int nRet = tree_copy_values_by_id(trSrc , trDes); out_int("nRet = ", nRet); out_str(trDes.India.strVal); out_str(trDes.England.strVal); out_str(trDes.Congo.strVal); }
tree_copy_values
origin.h