PUMA Library Reference Manual
Puma::UnitIterator Class Reference

#include <Puma/UnitIterator.h>

Description

Token unit iterator supporting iteration from the beginning of a unit or any token within that unit.

Public Member Functions

 UnitIterator ()
 Construct an empty iterator. More...
 
 UnitIterator (Unit &unit)
 Constructor. More...
 
 UnitIterator (ListElement &token)
 Constructor. More...
 
UnitIteratoroperator= (Unit &unit)
 Reset the iterator to iterate a unit starting at its first token. More...
 
UnitIteratoroperator= (ListElement &token)
 Reset the iterator to iterate a unit starting at the given token. More...
 
UnitIteratoroperator++ ()
 Move on to the next token in the unit. More...
 
UnitIteratoroperator-- ()
 Go back to the previous token in the unit. More...
 
Tokenoperator* () const
 Get the current token in the unit. More...
 
Tokenoperator-> () const
 Call a member on the current token. More...
 

Constructor & Destructor Documentation

◆ UnitIterator() [1/3]

Puma::UnitIterator::UnitIterator ( )

Construct an empty iterator.

◆ UnitIterator() [2/3]

Puma::UnitIterator::UnitIterator ( Unit unit)

Constructor.

Iterates a unit starting at its first token.

Parameters
unitThe unit to iterate.

◆ UnitIterator() [3/3]

Puma::UnitIterator::UnitIterator ( ListElement token)

Constructor.

Iterates a unit starting at the given token.

Parameters
tokenThe token from which to start to iterate.

Member Function Documentation

◆ operator*()

Token* Puma::UnitIterator::operator* ( ) const

Get the current token in the unit.

Returns
A pointer to the current token.

◆ operator++()

UnitIterator& Puma::UnitIterator::operator++ ( )

Move on to the next token in the unit.

Returns
A reference to this iterator.

◆ operator--()

UnitIterator& Puma::UnitIterator::operator-- ( )

Go back to the previous token in the unit.

Returns
A reference to this iterator.

◆ operator->()

Token* Puma::UnitIterator::operator-> ( ) const

Call a member on the current token.

Returns
A pointer to the current token on which the member is called.

◆ operator=() [1/2]

UnitIterator& Puma::UnitIterator::operator= ( ListElement token)

Reset the iterator to iterate a unit starting at the given token.

Parameters
tokenThe token from which to start to iterate.
Returns
A reference to this iterator.

◆ operator=() [2/2]

UnitIterator& Puma::UnitIterator::operator= ( Unit unit)

Reset the iterator to iterate a unit starting at its first token.

Parameters
unitThe unit to iterate.
Returns
A reference to this iterator.