Xalan-C++ API Reference  1.12.0
Public Member Functions | Protected Member Functions | List of all members
xalanc::TreeWalker Class Referenceabstract

#include <xalanc/DOMSupport/TreeWalker.hpp>

Inheritance diagram for xalanc::TreeWalker:
[legend]

Public Member Functions

 TreeWalker ()
 Constructor. More...
 
virtual ~TreeWalker ()
 
const XalanNodetraverse (const XalanNode *pos)
 Perform a document-order traversal. More...
 
XalanNodetraverse (XalanNode *pos)
 Perform a document-order traversal. More...
 
const XalanNodetraverse (const XalanNode *pos, const XalanNode *parent)
 Perform a document-order traversal stopping at the provided parent node. More...
 
XalanNodetraverse (XalanNode *pos, XalanNode *parent)
 Perform a document-order traversal stopping at the provided parent node. More...
 
virtual void traverseSubtree (const XalanNode *pos)
 Perform a pre-order traversal. More...
 
virtual void traverseSubtree (XalanNode *pos)
 Perform a pre-order traversal. More...
 

Protected Member Functions

virtual bool startNode (const XalanNode *node)=0
 Called when first walking a node. More...
 
virtual bool startNode (XalanNode *node)=0
 Called when first walking a node. More...
 
virtual bool endNode (const XalanNode *node)=0
 Called when leaving a node. More...
 
virtual bool endNode (XalanNode *node)=0
 Called when leaving a node. More...
 

Detailed Description

Definition at line 36 of file TreeWalker.hpp.

Constructor & Destructor Documentation

◆ TreeWalker()

xalanc::TreeWalker::TreeWalker ( )

Constructor.

◆ ~TreeWalker()

virtual xalanc::TreeWalker::~TreeWalker ( )
virtual

Member Function Documentation

◆ endNode() [1/2]

virtual bool xalanc::TreeWalker::endNode ( const XalanNode node)
protectedpure virtual

Called when leaving a node.

Parameters
nodeThe node
Returns
return false if the walk should continue, or true if it should not.

Implemented in xalanc::XalanDocumentPrefixResolver::NamespaceNodesTreeWalker, xalanc::NodeNameTreeWalker, and xalanc::FormatterTreeWalker.

◆ endNode() [2/2]

virtual bool xalanc::TreeWalker::endNode ( XalanNode node)
protectedpure virtual

Called when leaving a node.

Parameters
nodeThe node
Returns
return false if the walk should continue, or true if it should not.

Implemented in xalanc::XalanDocumentPrefixResolver::NamespaceNodesTreeWalker, xalanc::NodeNameTreeWalker, and xalanc::FormatterTreeWalker.

◆ startNode() [1/2]

virtual bool xalanc::TreeWalker::startNode ( const XalanNode node)
protectedpure virtual

Called when first walking a node.

Parameters
nodeThe node
Returns
return false if the walk should continue, or true if it should not.

Implemented in xalanc::XalanDocumentPrefixResolver::NamespaceNodesTreeWalker, xalanc::NodeNameTreeWalker, and xalanc::FormatterTreeWalker.

◆ startNode() [2/2]

virtual bool xalanc::TreeWalker::startNode ( XalanNode node)
protectedpure virtual

Called when first walking a node.

Parameters
nodeThe node
Returns
return false if the walk should continue, or true if it should not.

Implemented in xalanc::XalanDocumentPrefixResolver::NamespaceNodesTreeWalker, xalanc::NodeNameTreeWalker, and xalanc::FormatterTreeWalker.

◆ traverse() [1/4]

const XalanNode* xalanc::TreeWalker::traverse ( const XalanNode pos)

Perform a document-order traversal.

Derived classes and stop the traversal by returning true from startNode() or endNode(). If that happens, the function will return the next node in document order. If desired, the caller can start traversing the tree again from that point. Note that terminal nodes will always have startNode() and endNode() called before the traversal terminates.

Parameters
posThe node in the tree with which to start the walk
Returns
0 if the traversal completes, or the next node if the traversal doesn't complete.

◆ traverse() [2/4]

const XalanNode* xalanc::TreeWalker::traverse ( const XalanNode pos,
const XalanNode parent 
)

Perform a document-order traversal stopping at the provided parent node.

Derived classes and stop the traversal by returning true from startNode() or endNode(). If that happens, the function will return the next node in document order. If desired, the caller can start traversing the tree again from that point. Note that terminal nodes will always have startNode() and endNode() called before the traversal terminates.

Parameters
posThe node in the tree with which to start the walk
parentThe parent of pos. Note that for multiple calls that continue the traversal, this node must remain the same.
Returns
parent if the traversal completes, or the next node if the traversal doesn't complete.

◆ traverse() [3/4]

XalanNode* xalanc::TreeWalker::traverse ( XalanNode pos)

Perform a document-order traversal.

Derived classes and stop the traversal by returning true from startNode() or endNode(). If that happens, the function will return the next node in document order. If desired, the caller can start traversing the tree again from that point. Note that terminal nodes will always have startNode() and endNode() called before the traversal terminates.

Parameters
posThe node in the tree with which to start the walk
Returns
0 if the traversal completes, or the next node if the traversal doesn't complete.

◆ traverse() [4/4]

XalanNode* xalanc::TreeWalker::traverse ( XalanNode pos,
XalanNode parent 
)

Perform a document-order traversal stopping at the provided parent node.

Derived classes and stop the traversal by returning true from startNode() or endNode(). If that happens, the function will return the next node in document order. If desired, the caller can start traversing the tree again from that point. Note that terminal nodes will always have startNode() and endNode() called before the traversal terminates.

Parameters
posThe node in the tree with which to start the walk
parentThe parent of pos. Note that for multiple calls that continue the traversal, this node must remain the same.
Returns
parent if the traversal completes, or the next node if the traversal doesn't complete.

◆ traverseSubtree() [1/2]

virtual void xalanc::TreeWalker::traverseSubtree ( const XalanNode pos)
virtual

Perform a pre-order traversal.

Parameters
posstarting node

◆ traverseSubtree() [2/2]

virtual void xalanc::TreeWalker::traverseSubtree ( XalanNode pos)
virtual

Perform a pre-order traversal.

Parameters
posstarting node

The documentation for this class was generated from the following file: