XML Library
Public Member Functions | Private Types | Private Member Functions | Private Attributes
XML::XPathIterator Class Reference

An iterator for enumerating an XML document according to an XPath expression. More...

#include <XPathIterator.hpp>

List of all members.

Public Member Functions

 XPathIterator ()
 Default constructor.
 XPathIterator (const tstring &strQuery, const NodePtr &pNode)
 Construction from a query and a context node.
 ~XPathIterator ()
 Destructor.
NodePtr operator* () const
 Dereference operator.
XPathIteratoroperator++ ()
 Advance the iterator.
bool equals (const XPathIterator &RHS) const
 Compare two iterators for equivalence.

Private Types

typedef std::vector< NodePtrNodes
 The results container type.
typedef Nodes::const_iterator NodeIterator
 The results container iterator type.
typedef tstring::const_iterator QueryIterator
 The query iterator type.

Private Member Functions

void start ()
 Start the iteration.
void next ()
 Continue the iteration.
void reset ()
 End the iteration.
void parse (QueryIterator begin, QueryIterator end, const NodePtr &pContext)
 Parse the next part of the query.

Private Attributes

tstring m_strQuery
 The query.
NodePtr m_pNode
 The context XML node.
Nodes m_vecNodes
 The query results.
NodeIterator m_itNode
 The iterator into the query results.

Detailed Description

An iterator for enumerating an XML document according to an XPath expression.

To keep the code simple the iterator runs the entire query up front and just iterates the results.


Member Typedef Documentation

typedef std::vector<NodePtr> XML::XPathIterator::Nodes [private]

The results container type.

typedef Nodes::const_iterator XML::XPathIterator::NodeIterator [private]

The results container iterator type.

typedef tstring::const_iterator XML::XPathIterator::QueryIterator [private]

The query iterator type.


Constructor & Destructor Documentation

Default constructor.

XML::XPathIterator::XPathIterator ( const tstring &  strQuery,
const NodePtr pNode 
)

Construction from a query and a context node.

Construction from a query and a document.

Destructor.


Member Function Documentation

NodePtr XML::XPathIterator::operator* ( ) const

Dereference operator.

XPathIterator & XML::XPathIterator::operator++ ( )

Advance the iterator.

bool XML::XPathIterator::equals ( const XPathIterator RHS) const

Compare two iterators for equivalence.

NB: As they are not copyable the only iterator they can be equivalent to is an end iterator.

void XML::XPathIterator::start ( ) [private]

Start the iteration.

void XML::XPathIterator::next ( ) [private]

Continue the iteration.

void XML::XPathIterator::reset ( ) [private]

End the iteration.

void XML::XPathIterator::parse ( QueryIterator  begin,
QueryIterator  end,
const NodePtr pContext 
) [private]

Parse the next part of the query.


Member Data Documentation

tstring XML::XPathIterator::m_strQuery [private]

The query.

The context XML node.

The query results.

The iterator into the query results.


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