2.2.3.17.25 TreeNode::NextLeaf

ClassName

TreeNode

AccessType

public

Name

NextLeaf

Declaration

TreeNode NextLeaf

Remark

Examples

EX1

void TreeNode_NextLeaf_ex1()
{
    Tree myTree1;
    TreeNode tn1, tn11, tn12, tn121, tnTmp;
    tn1 = myTree1.AddTextNode("abc", "Name", 1);
    tn11 = tn1.AddTextNode("def", "Phone", 11);
    tn12 = tn1.AddTextNode("ghi", "Addr", 12);
    tn121 = tn12.AddTextNode("jkl", "Mail", 121);
    out_tree(myTree1);
    /*
            myTree1
               |
            Name(abc)
           /        \
     Phone(def)  Addr(ghi)
     				 \
     			 Mail(jkl)
    */
 
    tnTmp = tn1.NextLeaf;	// Start enumerating from the first leaf
    while(tnTmp.IsValid())
    {
    	out_str("Tag name = " + tnTmp.strVal);
    	tnTmp = tnTmp.NextLeaf;	// Forward visiting
    }
}

Description

readOnly. The next adjacent leaf of this node.

Header to Include

origin.h

See Also

TreeNode::NextNode, TreeNode::PrevNode, TreeNode::FirstNode, TreeNode::LastNode

Reference