#include <list.h>
Inheritance diagram for lcs::ListIterator< T >:
Public Member Functions | |
ListIterator (void) | |
ListIterator (ListNode< T > *node) | |
ListIterator (const ListIterator &li) | |
virtual | ~ListIterator () |
virtual bool | hasNext (void) |
virtual T | next (void) |
virtual void | reset (void) |
Resets the iterator to the first element of the list. | |
void | setRootNode (ListNode< T > *node) |
lcs::ListIterator< T >::ListIterator | ( | void | ) |
Default constructor. An empty list is assumed unless a root node of the list is set using the ListIterator::setRootNode is used.
lcs::ListIterator< T >::ListIterator | ( | ListNode< T > * | node | ) |
The iterator is initialised with the first node of the list as the argument node
.
lcs::ListIterator< T >::ListIterator | ( | const ListIterator< T > & | li | ) |
Copy constructor.
virtual lcs::ListIterator< T >::~ListIterator | ( | ) | [inline, virtual] |
Destructor.
bool lcs::ListIterator< T >::hasNext | ( | void | ) | [virtual] |
Returns true if the list has further elements at from the current position of the iterator. Returns false if the iterator is at the end of the list.
Implements lcs::Iterator< T >.
T lcs::ListIterator< T >::next | ( | void | ) | [virtual] |
Returns the next element of the list if there exists one. Else, returns a dummy object of type T
.
Implements lcs::Iterator< T >.
void lcs::ListIterator< T >::setRootNode | ( | ListNode< T > * | node | ) |
Sets the root node of the list to iterate over. Use this function if you thoroughly understand what you are doing, or if the iterator was initialised through the default constructor.