PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::UnitTokenSrc Class Reference

#include <Puma/UnitTokenSrc.h>

+ Inheritance diagram for Puma::UnitTokenSrc:

Description

Token unit iterator implementing the token source interface.

Public Member Functions

 UnitTokenSrc (Unit &unit)
 Constructor.
 
void current (Token *token)
 Set the current token in the unit that is iterated.
 
Token * next ()
 Get the next token in the unit.
 
Token * current () const
 Get the current token in the unit.
 
Unit * unit () const
 Get the token being iterated.
 
bool hasNext () const
 Check if the current token is not the last in the unit.
 
- Public Member Functions inherited from Puma::TokenSource
virtual ~TokenSource ()
 Destructor.
 

Constructor & Destructor Documentation

◆ UnitTokenSrc()

Puma::UnitTokenSrc::UnitTokenSrc ( Unit &  unit)
inline

Constructor.

Parameters
unitThe unit to iterate.

Member Function Documentation

◆ current() [1/2]

Token * Puma::UnitTokenSrc::current ( ) const
inline

Get the current token in the unit.

Returns
A pointer to the current token.

◆ current() [2/2]

void Puma::UnitTokenSrc::current ( Token *  token)
inline

Set the current token in the unit that is iterated.

Parameters
tokenThe new current token.

◆ hasNext()

bool Puma::UnitTokenSrc::hasNext ( ) const
inline

Check if the current token is not the last in the unit.

Returns
True, if the end of the unit isn't reached yet.

◆ next()

Token * Puma::UnitTokenSrc::next ( )
inlinevirtual

Get the next token in the unit.

Returns
A pointer to the next token.

Implements Puma::TokenSource.

◆ unit()

Unit * Puma::UnitTokenSrc::unit ( ) const
inline

Get the token being iterated.

Returns
A pointer to the unit.