2.1.26.70 tree_set_values_by_nodeids
Description
Set tree node value by node id
Syntax
int tree_set_values_by_nodeids( TreeNode & trSetting, const vector<int> & vnNodeIDs, const vector<string> & vsValues )
Parameters
- trSetting
- [modify]the tree node that need setting values
- vnNodeIDs
- [input] the vector of node is
- vsValues
- [input] the vector of value
Return
number of the setted value tree node
Examples
EX1
void tree_set_values_by_nodeids_ex1()
{
Tree trTest;
TreeNode tn1, tn2, tn3;
tn1 = trTest.AddTextNode("node 1", "Node1");
tn2 = trTest.AddTextNode("node 2", "Node2");
tn3 = trTest.AddTextNode("node 3", "Node3", 6);
TreeNode tn1_1, tn1_2, tn1_3;
tn1_1 = tn1.AddTextNode("node 1.1", "Node1.1", 1);
tn1_2 = tn1.AddTextNode("node 1.2", "Node1.2", 2);
tn1_3 = tn1.AddTextNode("node 1.3", "Node1.3", 3);
TreeNode tn2_1, tn2_2;
tn2_1 = tn2.AddTextNode("node 2.1", "Node2.1", 4);
tn2_2 = tn2.AddTextNode("node 2.2", "Node2.2", 5);
out_tree(trTest);
vector<int> vn1 = {2, 4, 6};
vector<string> vs1 = {"2.1 edon", "1.2 edon", "3 edon"};
int nRet = tree_set_values_by_nodeids(trTest, vn1, vs1);
out_int("nRet = ", nRet);
out_tree(trTest);
}
Remark
See Also
tree_set_values_by_ids
Header to Include
origin.h
Reference
|