PUMA Library Reference Manual
|
#include <Puma/UnitManager.h>
Class to manage the units built to parse the files of the source project.
Public Types | |
typedef std::map< std::string, Unit * > | UMap |
Name to unit map type. | |
typedef UMap::value_type | UMapEntry |
Name to unit map entry type. | |
typedef UMap::iterator | UMapIter |
Name to unit map iterator type. | |
Public Member Functions | |
UnitManager (ErrorStream &err) | |
Constructor. | |
virtual | ~UnitManager () |
Destructor. | |
UMap & | getTable () const |
Get the unit management table. | |
Tokenizer * | tokenizer () const |
Get the tokenizer (scanner) that is used by scanSource() to tokenize sources. | |
void | tokenizer (Tokenizer *tokenizer) |
Set the tokenizer (scanner) to be used by scanSource() to tokenize sources. | |
void | add (Unit *unit) |
Add a token unit to the manager. | |
Unit * | get (const char *name, bool isfile=false) const |
Get a managed unit by name. | |
void | discard (const char *name, bool isfile=false, bool destroy=true) const |
Discard a unit managed by this unit manager. | |
void | discardAll (bool destroy=true) const |
Discard all named units managed by this unit manager. | |
void | discardNonames () |
Discard all no-name units managed by this unit manager. | |
Unit * | scanSource (const char *name, Source *in=0, bool isfile=false) |
Scan the tokens from the given input source and create a unit from it. | |
void | print (const char *name, bool isfile=false, std::ostream &out=std::cout) const |
Print a named unit on the given output stream. | |
void | init () |
Initialize the unit manager and the managed units for the next parse process. | |
typedef std::map<std::string, Unit*> Puma::UnitManager::UMap |
Name to unit map type.
typedef UMap::value_type Puma::UnitManager::UMapEntry |
Name to unit map entry type.
typedef UMap::iterator Puma::UnitManager::UMapIter |
Name to unit map iterator type.
|
inline |
Constructor.
err | Error stream to use for reporting errors. |
|
virtual |
Destructor.
Deletes all managed units.
void Puma::UnitManager::add | ( | Unit * | unit | ) |
Add a token unit to the manager.
unit | The unit to add. |
void Puma::UnitManager::discard | ( | const char * | name, |
bool | isfile = false, | ||
bool | destroy = true ) const |
Discard a unit managed by this unit manager.
name | The name of the unit to remove. |
isfile | True to indicate that the given name refers to a file (defaults to false). |
destroy | True to indicate that the unit shall be destroyed (defaults to true). |
void Puma::UnitManager::discardAll | ( | bool | destroy = true | ) | const |
Discard all named units managed by this unit manager.
destroy | True to indicate that the units shall be destroyed (defaults to true). |
void Puma::UnitManager::discardNonames | ( | ) |
Discard all no-name units managed by this unit manager.
Unit * Puma::UnitManager::get | ( | const char * | name, |
bool | isfile = false ) const |
Get a managed unit by name.
name | The name of the unit to get. |
isfile | True to indicate that the given name refers to a file (defaults to false). |
|
inline |
Get the unit management table.
void Puma::UnitManager::init | ( | ) |
Initialize the unit manager and the managed units for the next parse process.
void Puma::UnitManager::print | ( | const char * | name, |
bool | isfile = false, | ||
std::ostream & | out = std::cout ) const |
Print a named unit on the given output stream.
name | The name of the unit to print. |
isfile | True to indicate that the given name refers to a file (defaults to false). |
out | The output stream, defaults to std::cout. |
Scan the tokens from the given input source and create a unit from it.
The new unit is added to the unit manager.
name | The name of the unit to create. |
in | The input source. |
isfile | True to indicate that the given name refers to a file (defaults to false). |
|
inline |
Get the tokenizer (scanner) that is used by scanSource() to tokenize sources.
|
inline |
Set the tokenizer (scanner) to be used by scanSource() to tokenize sources.
tokenizer | The tokenizer to use. |