ionflux.org | Impressum

Ionflux::Tools::TokenTypeMap Class Reference
[String tokenizer]

Token type lookup map. More...

#include <TokenTypeMap.hpp>

Inheritance diagram for Ionflux::Tools::TokenTypeMap:

Inheritance graph
[legend]
Collaboration diagram for Ionflux::Tools::TokenTypeMap:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TokenTypeMap ()
 Constructor.
virtual ~TokenTypeMap ()
 Destructor.
virtual void addTokenType (const TokenType &newTokenType)
 Add token type.
virtual void removeTokenType (const TokenType &removeTokenType)
 Remove token type.
virtual TokenType getTokenType (unsigned char testChar) const
 Get token type.
virtual void addTokenTypeAnything (const TokenType &newTokenType)
 Add special token type 'anything'.
virtual void clear ()
 Clear map.
virtual unsigned int getNumTokenTypes () const
 Get number of token types.

Static Public Attributes

static const unsigned int TYPE_MAP_SIZE = 256
 Size of token type lookup map.

Protected Attributes

TokenType ** typeMap
 Token type lookup map.
std::vector< TokenType * > types
 Token types.

Detailed Description

Token type lookup map.

A lookup map for mapping bytes to token types.


Constructor & Destructor Documentation

Ionflux::Tools::TokenTypeMap::TokenTypeMap  ) 
 

Constructor.

Construct new TokenTypeMap object.

Ionflux::Tools::TokenTypeMap::~TokenTypeMap  )  [virtual]
 

Destructor.

Destruct TokenTypeMap object.


Member Function Documentation

void Ionflux::Tools::TokenTypeMap::addTokenType const TokenType newTokenType  )  [virtual]
 

Add token type.

Add a token type to the map.

Parameters:
newTokenType Token type to be added.

void Ionflux::Tools::TokenTypeMap::addTokenTypeAnything const TokenType newTokenType  )  [virtual]
 

Add special token type 'anything'.

Add special token type 'anything' to the map. The 'anything' token type matches any character that is not matched by another token in the current setup.

Note:
If you have already added a token type 'anything', calling this function again will have no effect. In order to change the 'anything' token type, you will either have to remove the one you have added previously (by calling removeTokenType()) or clear the entire map (by calling clear()).
Parameters:
newTokenType Token type to be added as special type 'anything'.

void Ionflux::Tools::TokenTypeMap::clear  )  [virtual]
 

Clear map.

Clears all entries from the token type map.

unsigned int Ionflux::Tools::TokenTypeMap::getNumTokenTypes  )  const [virtual]
 

Get number of token types.

Returns:
Number of token types in the type map.

TokenType Ionflux::Tools::TokenTypeMap::getTokenType unsigned char  testChar  )  const [virtual]
 

Get token type.

Perform a token type lookup for the specified character.

Parameters:
testChar Character to look up.
Returns:
The token type testChar belongs to, or Tokenizer::TT_INVALID if testChar is not part of any valid token.

void Ionflux::Tools::TokenTypeMap::removeTokenType const TokenType removeTokenType  )  [virtual]
 

Remove token type.

Remove a token type from the map.

Parameters:
removeTokenType Token type to be removed.


Member Data Documentation

const unsigned int Ionflux::Tools::TokenTypeMap::TYPE_MAP_SIZE = 256 [static]
 

Size of token type lookup map.

TokenType** Ionflux::Tools::TokenTypeMap::typeMap [protected]
 

Token type lookup map.

std::vector<TokenType *> Ionflux::Tools::TokenTypeMap::types [protected]
 

Token types.


The documentation for this class was generated from the following files:
Generated on Tue Mar 14 21:11:23 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6