XML Library
|
An iterator for enumerating an XML document according to an XPath expression. More...
#include <XPathIterator.hpp>
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. | |
XPathIterator & | operator++ () |
Advance the iterator. | |
bool | equals (const XPathIterator &RHS) const |
Compare two iterators for equivalence. | |
Private Types | |
typedef std::vector< NodePtr > | Nodes |
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. |
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.
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.
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.
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.
tstring XML::XPathIterator::m_strQuery [private] |
The query.
NodePtr XML::XPathIterator::m_pNode [private] |
The context XML node.
Nodes XML::XPathIterator::m_vecNodes [private] |
The query results.
NodeIterator XML::XPathIterator::m_itNode [private] |
The iterator into the query results.