Iterator Class Reference

API: cQueue::Iterator Class Reference
API
cQueue::Iterator Class Reference

Public Member Functions

 Iterator (const cQueue &q, bool reverse=false)
void init (const cQueue &q, bool reverse=false)
cObjectoperator* () const
bool end () const
Iteratoroperator++ ()
Iterator operator++ (int)
Iteratoroperator-- ()
Iterator operator-- (int)

Description

Walks along a cQueue.

Constructor & Destructor Documentation

◆ Iterator()

Iterator ( const cQueue & q,
bool reverse = false )
inline

Constructor. Iterator will walk on the queue passed as argument. The iterator can be initialized for forward (front-to-back, using ++) or reverse (back-to-front, using --) iteration.

References cQueue::cQueue(), and init().

Referenced by operator++(), operator++(), operator--(), and operator--().

Member Function Documentation

◆ init()

void init ( const cQueue & q,
bool reverse = false )
inline

Reinitializes the iterator object.

References cQueue::cQueue().

Referenced by Iterator().

◆ operator*()

cObject * operator* ( ) const
inline

Returns the current object.

◆ end()

bool end ( ) const
inline

Returns true if the iterator has reached either end of the queue.

Referenced by operator++(), operator++(), operator--(), and operator--().

◆ operator++() [1/2]

Iterator & operator++ ( )
inline

Prefix increment operator (++it). Moves the iterator to the next object in the queue. It has no effect if the iterator has reached either end of the queue.

References end(), and Iterator().

◆ operator++() [2/2]

Iterator operator++ ( int )
inline

Postfix increment operator (it++). Moves the iterator to the next object in the queue, and returns the iterator's previous state. It has no effect if the iterator has reached either end of the queue.

References end(), and Iterator().

◆ operator--() [1/2]

Iterator & operator-- ( )
inline

Prefix decrement operator (–it). Moves the iterator to the previous object in the queue. It has no effect if the iterator has reached either end of the queue.

References end(), and Iterator().

◆ operator--() [2/2]

Iterator operator-- ( int )
inline

Postfix decrement operator (it–). Moves the iterator to the previous object in the queue, and returns the iterator's previous state. It has no effect if the iterator has reached either end of the queue.

References end(), and Iterator().