Main Page | Compound List | Compound Members | Examples

TPT::Symbols Class Reference

List of all members.

Public Member Functions

 Symbols (bool setdefaults=true)
 Symbols (const Symbols &s)
 ~Symbols ()
void copy (const Symbols &s)
bool set (const SymbolKeyType &id, const SymbolValueType &value)
bool set (const SymbolKeyType &id, int value)
bool set (const SymbolKeyType &id, const SymbolArrayType &value)
bool set (const SymbolKeyType &id, const SymbolHashType &value)
bool set (const SymbolKeyType &id, Object &value)
bool push (const SymbolKeyType &id, const SymbolValueType &value)
bool push (const SymbolKeyType &id, const SymbolArrayType &value)
bool push (const SymbolKeyType &id, const SymbolHashType &value)
bool push (const SymbolKeyType &id, Object &value)
bool exists (const SymbolKeyType &id) const
bool empty (const SymbolKeyType &id) const
bool isscalar (const SymbolKeyType &id) const
bool isarray (const SymbolKeyType &id) const
bool ishash (const SymbolKeyType &id) const
unsigned size (const SymbolKeyType &id) const
bool get (const SymbolKeyType &id, SymbolValueType &val) const
bool get (const SymbolKeyType &id, SymbolArrayType &sym) const
bool unset (const SymbolKeyType &id)
Symbolsoperator= (const Symbols &)

Friends

class Parser_Impl

Detailed Description

The Symbols class holds the symbols table for passing variables to the parser.

Author:
Isaac W. Foraker
Exceptions:
tptexception 


Constructor & Destructor Documentation

TPT::Symbols::Symbols bool  setdefaults = true  ) 
 

Construct an instance of the Symbols class.

Parameters:
setdefaults When true, set the default variables (default true).
Returns:
nothing

TPT::Symbols::Symbols const Symbols s  ) 
 

Construct a copy of the specified Symbols class.

Parameters:
s The Symbols table to copy.
Returns:
nothing

TPT::Symbols::~Symbols  ) 
 

Destruct this instance of the Symbols class.

Returns:
nothing


Member Function Documentation

void TPT::Symbols::copy const Symbols sym  ) 
 

Copy the specified symbols table. This differs from the operator= copy function in that it does not remove existing symbols unless the symbol also exists in the source symbols table.

Parameters:
sym The source symbols table.
Returns:
nothing

bool TPT::Symbols::empty const SymbolKeyType &  id  )  const
 

Check if a symbol is empty.

Parameters:
id ID of symbol to retrieve.
Returns:
true if symbol is empty;

false if symbol is not empty.

bool TPT::Symbols::exists const SymbolKeyType &  id  )  const
 

Check whether the specified id exists in the symbol table.

Parameters:
id ID of symbol to retrieve.
Returns:
true if symbol exists;

false if symbol does not exist, or id invalid.

bool TPT::Symbols::get const SymbolKeyType &  id,
SymbolArrayType &  outval
const
 

Get the array of values specified by id from the symbols table, recursing to process embedded symbols as needed.

Parameters:
id ID of symbol to retrieve.
outval Symbol array to receive value(s).
Returns:
false on success;

true if symbol is invalid.

bool TPT::Symbols::get const SymbolKeyType &  id,
SymbolValueType &  outval
const
 

Get the value specified by id from the symbols table, recursing to process embedded symbols as needed.

Parameters:
id ID of symbol to retrieve.
outval Symbol array to receive value(s).
Returns:
false on success;

true if symbol is invalid.

bool TPT::Symbols::isarray const SymbolKeyType &  id  )  const
 

Check if a symbol is a multielement array.

Parameters:
id ID of the symbol.
Returns:
true if symbols is an array;

false if symbol is not an array, or does not exist;

bool TPT::Symbols::ishash const SymbolKeyType &  id  )  const
 

Check if a symbol is a hash.

Parameters:
id ID of the symbol.
Returns:
true if symbols is an hash;

false if symbol is not an hash, or does not exist;

bool TPT::Symbols::isscalar const SymbolKeyType &  id  )  const
 

Check if a symbol is a multielement scalar.

Parameters:
id ID of the symbol.
Returns:
true if symbols is an scalar;

false if symbol is not an scalar, or does not exist;

Symbols & TPT::Symbols::operator= const Symbols sym  ) 
 

Symbols copy operator

Parameters:
sym A Symbols table to copy.
Returns:
Reference to *this instance of Symbols.

bool TPT::Symbols::push const SymbolKeyType &  id,
Object value
 

Push a symbol's hash values

Parameters:
id ID of the array to receive object.
value Object to be pushed onto array.
Returns:
nothing

bool TPT::Symbols::push const SymbolKeyType &  id,
const SymbolHashType &  value
 

Push a symbol's hash values

Parameters:
id ID of the array to receive hash.
value Array values of the symbol to be pushed.
Returns:
nothing

bool TPT::Symbols::push const SymbolKeyType &  id,
const SymbolArrayType &  value
 

Push a symbol's array values

Parameters:
id ID of the array to receive array.
value Array values of the symbol to be pushed.
Returns:
nothing

bool TPT::Symbols::push const SymbolKeyType &  id,
const SymbolValueType &  value
 

Push a symbol's value

Parameters:
id ID of the array to receive string.
value Value of the symbol to be pushed.
Returns:
false on success;

true if invalid id.

bool TPT::Symbols::set const SymbolKeyType &  id,
Object value
 

Assign an Object into the specified symbol.

Parameters:
id ID of symbol to set.
value Reference to Object to assign.
Returns:
nothing

bool TPT::Symbols::set const SymbolKeyType &  id,
const SymbolHashType &  value
 

Copy a string hash to the specified symbol.

Parameters:
id ID of the hash to be set.
value Hash to be copied.
Returns:
nothing

bool TPT::Symbols::set const SymbolKeyType &  id,
const SymbolArrayType &  value
 

Copy an array of strings to the specified symbol.

Parameters:
id ID of the array to be set.
value Array values to be copied.
Returns:
nothing

bool TPT::Symbols::set const SymbolKeyType &  id,
int  value
 

Set a symbol's value.

Parameters:
id ID of the scalar to be set.
value Integer to be copied.
Returns:
false on success;

true if invalid id.

bool TPT::Symbols::set const SymbolKeyType &  id,
const SymbolValueType &  value
 

Set a symbol's value.

Parameters:
id ID of the scalar to be set.
value String to be copied.
Returns:
false on success;

true if invalid id.

unsigned TPT::Symbols::size const SymbolKeyType &  id  )  const
 

Get size of the specified array.

Parameters:
id ID of the array.
Returns:
size of the array;

0 if array is empty, symbol is not an array, or symbold does not exist;

bool TPT::Symbols::unset const SymbolKeyType &  id  ) 
 

Unset a symbols

Parameters:
id ID of the symbol to clear.
Returns:
true if symbol unset;

false if symbol does not exist, or id invalid.


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 16:06:08 2004 for LibTPT by doxygen 1.3.3