#include <rtiterator.h>
Public Methods | |
| Iterator (const Iterator< T > &iter) | |
| Creates a duplicate of the given iterator. | |
| Iterator (IIteratorImpl< T > *impl) | |
| Creates an iterator, using the iterator implementation impl. | |
| IIteratorImpl< T > * | getImpl () |
| Returns the iterator implementation this iterator is using. | |
| ~Iterator () | |
| Deletes the iterator implementation this iterator is using. | |
| Iterator< T > | operator++ (int) |
| Proceeds to the next element of the collection. | |
| Iterator< T > | operator-- (int) |
| Moves to the previous element of the collection. | |
| bool | operator== (const Iterator< T > &it) const |
Checks if this iterator and it are at the same position of the same collection object. | |
| Iterator< T > & | operator= (const Iterator< T > &it) |
Moves to the position at which it stands. | |
| T & | operator * () |
| Returns the element at the current position, or an invalid reference if there isn't any. More... | |
| const T & | operator * () const |
| Returns the element at the current position, or an invalid reference if there isn't any. More... | |
| Iterator< T > & | operator++ () |
| Proceeds to the next element of the collection. | |
| Iterator< T > & | operator-- () |
| Moves to the previous element of the collection. | |
| bool | hasElement () const |
| Checks if there is an element at the current position of this iterator. | |
| bool | hasNext () const |
| Checks if there is an element at the next position of this iterator. | |
| bool | hasPrev () const |
| Checks if there is an element at the previous position of this iterator. | |
| T & | next () |
| Returns the element at the current position, and moves forward thereafter. More... | |
| T & | prev () |
| Returns the element at the current position, and moves to the previous element thereafter. More... | |
| T & | get () |
| Returns the element at the current position, or an invalid reference if there isn't any. More... | |
| const T & | get () const |
| Returns the element at the current position, or an invalid reference if there isn't any. More... | |
| bool | canModify () const |
Returns true if the iterator can modify its collection. More... | |
| void | remove () |
| Removes the element at the current position, and advances to the next element. More... | |
| Iterator< T > | getNext () const |
| Returns a new iterator pointing to the next element of the collection. | |
| Iterator< T > | getPrev () const |
| Returns a new iterator pointing to the previous element of the collection. | |
Protected Methods | |
| Iterator< T > | clone () const |
| Clones this iterator by cloning its implementation. | |
This class is just a wrapper class for higher comfort for any iterator implementations. Collections which provide access using iterators, should implement the IIteratorImpl interface in a YourCollection::Iterator class and then return Iterator<T>(new YourCollection::Iterator()) in any access methods (where T is the element type of YourCollection).
|
|||||||||
|
Returns (e.g. remove elements from it.) |
|
|||||||||
|
Returns the element at the current position, or an invalid reference if there isn't any. You should use hasElement() to check the current position before using get(). |
|
|||||||||
|
Returns the element at the current position, or an invalid reference if there isn't any. You should use hasElement() to check the current position before using get(). |
|
|||||||||
|
Returns the element at the current position, and moves forward thereafter. You should use hasElement() to check the current position before using next(). |
|
|||||||||
|
Returns the element at the current position, or an invalid reference if there isn't any. You should use hasElement() to check the current position before dereferencing the iterator. |
|
|||||||||
|
Returns the element at the current position, or an invalid reference if there isn't any. You should use hasElement() to check the current position before dereferencing the iterator. |
|
|||||||||
|
Returns the element at the current position, and moves to the previous element thereafter. You should use hasElement() to check the current position before using prev(). |
|
|||||||||
|
Removes the element at the current position, and advances to the next element. If the iterator cannot be modified, does nothing.
|