| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csList< T >::Iterator Class Reference

Iterator for the list. More...

`#include <csutil/list.h>`

List of all members.

## Public Member Functions
void | Clear ()
| Set iterator to non-existent element. HasCurrent() will return false.
T & | FetchCurrent () const
| Return current element.
T & | FetchNext () const
| Return next element but don't modify iterator.
T & | FetchPrev () const
T & | FetchPrevious () const
| Return previous element but don't modify iterator.
bool | HasCurrent () const
| Test if the Iterator is set to a valid element.
bool | HasNext () const
| Test if there is a next element.
bool | HasPrevious () const
| Test if there is a previous element.
bool | IsFirst () const
| Test if the Iterator is set to the first element.
bool | IsLast () const
| Test if the Iterator is set to the last element.
bool | IsReverse () const
| Test if the iterator is reversed.
| Iterator (const csList< T > &list, bool reverse=false)
| Constructor.
| Iterator (const Iterator &r)
| Copy constructor.
| Iterator ()
| Constructor.
T & | Next ()
| Advance to next element and return it.
T & | operator * () const
| Dereference operator (*).
| operator T * () const
| Cast operator.
Iterator & | operator++ ()
| Advance to next element and return it.
Iterator & | operator-- ()
| Backup to previous element and return it.
T * | operator-> () const
| Dereference operator (->).
Iterator & | operator= (const Iterator &r)
| Assignment operator.
T & | Prev ()
T & | Previous ()
| Backup to previous element and return it.
## Protected Member Functions
| Iterator (csListElement *element, bool visit=true, bool rev=false)
## Friends
class | csList< T >

## Detailed Description

### template<class T>
class csList< T >::Iterator

Iterator for the list.

Definition at line 72 of file list.h.

## Constructor & Destructor Documentation

template<class T>

csList< T >::Iterator::Iterator | ( |  | ) | `[inline]`

Constructor.

Definition at line 76 of file list.h.

template<class T>

csList< T >::Iterator::Iterator | ( | const Iterator & | r | ) | `[inline]`

Copy constructor.

Definition at line 79 of file list.h.

References csList< T >::Iterator::ptr, csList< T >::Iterator::reversed, and csList< T >::Iterator::visited.

template<class T>

csList< T >::Iterator::Iterator | ( | const csList< T > & | list,
|  | bool | reverse = `false` |
| ) |  |  | `[inline]`

Constructor.

Definition at line 82 of file list.h.

References csList< T >::head, and csList< T >::tail.

## Member Function Documentation

template<class T>

void csList< T >::Iterator::Clear | ( |  | ) | `[inline]`

Set iterator to non-existent element. HasCurrent() will return false.

Definition at line 121 of file list.h.

template<class T>

T& csList< T >::Iterator::FetchCurrent | ( |  | ) | const`[inline]`

Return current element.

Warning! Assumes there is a current element!

Definition at line 167 of file list.h.

References CS_ASSERT, and csList< T >::csListElement::data.

template<class T>

T& csList< T >::Iterator::FetchNext | ( |  | ) | const`[inline]`

Return next element but don't modify iterator.

Warning! Assumes there is a next element!

Definition at line 176 of file list.h.

References CS_ASSERT, csList< T >::csListElement::data, and csList< T >::csListElement::next.

template<class T>

T& csList< T >::Iterator::FetchPrevious | ( |  | ) | const`[inline]`

Return previous element but don't modify iterator.

Warning! Assumes there is a previous element!

Definition at line 185 of file list.h.

References CS_ASSERT, csList< T >::csListElement::data, and csList< T >::csListElement::prev.

Referenced by csList< T >::Iterator::FetchPrev().

template<class T>

bool csList< T >::Iterator::HasCurrent | ( |  | ) | const`[inline]`

Test if the Iterator is set to a valid element.

Definition at line 92 of file list.h.

Referenced by csList< T >::Delete(), csList< T >::InsertAfter(), csList< T >::InsertBefore(), csList< T >::MoveAfter(), and csList< T >::MoveBefore().

template<class T>

bool csList< T >::Iterator::HasNext | ( |  | ) | const`[inline]`

Test if there is a next element.

Definition at line 95 of file list.h.

References csList< T >::csListElement::next.

template<class T>

bool csList< T >::Iterator::HasPrevious | ( |  | ) | const`[inline]`

Test if there is a previous element.

Definition at line 98 of file list.h.

References csList< T >::csListElement::prev.

template<class T>

bool csList< T >::Iterator::IsFirst | ( |  | ) | const`[inline]`

Test if the Iterator is set to the first element.

Definition at line 101 of file list.h.

References csList< T >::csListElement::prev.

template<class T>

bool csList< T >::Iterator::IsLast | ( |  | ) | const`[inline]`

Test if the Iterator is set to the last element.

Definition at line 104 of file list.h.

References csList< T >::csListElement::next.

template<class T>

bool csList< T >::Iterator::IsReverse | ( |  | ) | const`[inline]`

Test if the iterator is reversed.

Definition at line 107 of file list.h.

Referenced by csList< T >::Delete().

template<class T>

T& csList< T >::Iterator::Next | ( |  | ) | `[inline]`

Advance to next element and return it.

Definition at line 127 of file list.h.

References CS_ASSERT, csList< T >::csListElement::data, and csList< T >::csListElement::next.

template<class T>

T& csList< T >::Iterator::operator * | ( |  | ) | const`[inline]`

Dereference operator (*).

Definition at line 114 of file list.h.

References CS_ASSERT, and csList< T >::csListElement::data.

template<class T>

csList< T >::Iterator::operator T * | ( |  | ) | const`[inline]`

Cast operator.

Definition at line 111 of file list.h.

References csList< T >::csListElement::data.

template<class T>

Iterator& csList< T >::Iterator::operator++ | ( |  | ) | `[inline]`

Advance to next element and return it.

Definition at line 147 of file list.h.

References csList< T >::csListElement::next.

template<class T>

Iterator& csList< T >::Iterator::operator-- | ( |  | ) | `[inline]`

Backup to previous element and return it.

Definition at line 155 of file list.h.

References csList< T >::csListElement::prev.

template<class T>

T* csList< T >::Iterator::operator-> | ( |  | ) | const`[inline]`

Dereference operator (->).

Definition at line 117 of file list.h.

References csList< T >::csListElement::data.

template<class T>

Iterator& csList< T >::Iterator::operator= | ( | const Iterator & | r | ) | `[inline]`

Assignment operator.

Definition at line 89 of file list.h.

References csList< T >::Iterator::ptr, csList< T >::Iterator::reversed, and csList< T >::Iterator::visited.

template<class T>

T& csList< T >::Iterator::Previous | ( |  | ) | `[inline]`

Backup to previous element and return it.

Definition at line 136 of file list.h.

References CS_ASSERT, csList< T >::csListElement::data, and csList< T >::csListElement::prev.

Referenced by csList< T >::Iterator::Prev().

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

- csutil/list.h