DataID
TreeNode
public
int DataID
DataID is an treenode attribute. This ID not specific meaning. Unique or repeated also can be decided by user.
EX1
void TreeNode_DataID_ex1() { Tree tr; TreeNode tn1; tn1 = tr.AddNode("abc"); tn1.DataID = 1; // write tn1.DataID out_int("tn1.DataID = ", tn1.DataID); // read tn1.DataID // access DataID by TreeNode::SetAttribute and TreeNode::GetAttribute TreeNode tn2 = tr.AddNode("def"); tn2.SetAttribute(STR_DATAID_ATTRIB, 10); //Set tn2.DataID to 10 int dataid; if( tn2.GetAttribute(STR_DATAID_ATTRIB, dataid) ) //Get tn2.DataID { out_int("tn2.DataID = ", dataid); } else { out_str("Error, tn2.DataID attribute is not existed."); } }
Read or write treenode's DataID attribute.
origin.h
TreeNode::ID, TreeNode::GetAttribute, TreeNode::SetAttribute, TreeNode::AddNode