#include <ticpp.h>
Public Member Functions | |
| T * | begin (const Node *parent) const |
| For for loop comparisons. | |
| T * | end () const |
| For for loop comparisons. | |
| Iterator (const std::string &value="") | |
| Constructor. | |
| Iterator (T *node, const std::string &value="") | |
| Constructor. | |
| Iterator (const Iterator &it) | |
| Constructor. | |
| T * | Get () const |
| Gets internal pointer. | |
| Iterator & | operator= (const Iterator &it) |
| Sets internal pointer. | |
| Iterator & | operator= (T *p) |
| Sets internal pointer. | |
| Iterator & | operator++ () |
| Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings. | |
| Iterator | operator++ (int) |
| Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings. | |
| Iterator & | operator-- () |
| Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings. | |
| Iterator | operator-- (int) |
| Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings. | |
| bool | operator!= (const T *p) const |
| Compares internal pointer. | |
| bool | operator!= (const Iterator &it) const |
| Compares internal pointer. | |
| bool | operator== (T *p) const |
| Compares internal pointer*. | |
| bool | operator== (const Iterator &it) const |
| Compares internal pointer. | |
| T * | operator-> () const |
| So Iterator behaves like a STL iterator. | |
| T & | operator* () const |
| So Iterator behaves like a STL iterator. | |
TinyXML++ introduces iterators:
ticpp::Iterator< ticpp::Node > child; for ( child = child.begin( parent ); child != child.end(); child++ )
Iterators have the added advantage of filtering by type:
// Only iterates through Comment nodes ticpp::Iterator< ticpp::Comment > child; for ( child = child.begin( parent ); child != child.end(); child++ )
// Only iterates through Element nodes with value "ElementValue" ticpp::Iterator< ticpp::Element > child( "ElementValue" ); for ( child = child.begin( parent ); child != child.end(); child++ )
Finally, Iterators also work with Attributes
ticpp::Iterator< ticpp::Attribute > attribute; for ( attribute = attribute.begin( element ); attribute != attribute.end(); attribute++ )
| ticpp::Iterator< T >::Iterator | ( | const std::string & | value = "" |
) | [inline] |
Constructor.
| value | If not empty, this iterator will only visit nodes with matching value. // Only iterates through Element nodes with value "ElementValue" ticpp::Iterator< ticpp::Element > child( "ElementValue" ); for ( child = child.begin( parent ); child != child.end(); child++ ) |
| T* ticpp::Iterator< T >::begin | ( | const Node * | parent | ) | const [inline] |
For for loop comparisons.
| parent | The parent of the nodes to iterate. |
ticpp::Iterator< ticpp::Node > child; for ( child = child.begin( parent ); child != child.end(); child++ )
References ticpp::Node::IterateFirst().
| T* ticpp::Iterator< T >::end | ( | ) | const [inline] |
For for loop comparisons.
ticpp::Iterator< ticpp::Node > child; for ( child = child.begin( parent ); child != child.end(); child++ )
| T* ticpp::Iterator< T >::Get | ( | ) | const [inline] |
Gets internal pointer.
1.5.6