Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

OptionsRecorder Class Reference

#include <options_recorder.hh>

Collaboration diagram for OptionsRecorder:

Collaboration graph
[legend]
List of all members.

Public Methods

 OptionsRecorder (PropRegistry &registry_)
void setOption (const string &key, const string &value) throw (ParseException)
void setOption (const string &key, const char *value) throw (ParseException)
void setOption (const string &key, int value) throw (ParseException)
void setOption (const string &key, bool value) throw (ParseException)
void checkName (const string &key, OptDesc::t_kinds kind) throw (ParseException)
void dumpRegistry ()

Private Types

typedef struct OptionsRecorder::t_OptDesc  OptDesc

Private Attributes

PropRegistryregistry

Static Private Attributes

OptDesc optDescriptors []

Detailed Description

This class receives the <key, value> pairs from the OPTIONS section and does the validity checking, then adds them into the registry.

Definition at line 59 of file options_recorder.hh.


Member Typedef Documentation

typedef struct OptionsRecorder::t_OptDesc OptionsRecorder::OptDesc [private]
 

This structure describes an option: its name, its default value and its type. The default value is the string representation of an int or bool if the value is of that kind, otherwise the value itself, whatever.


Constructor & Destructor Documentation

OptionsRecorder::OptionsRecorder ( PropRegistry & registry_ )
 

Creates a new OptionsRecorder object. The values it receives will be stored into the given registry opbject. As pasrt of the construction, the default values for the options are stored into the registry.

Definition at line 81 of file options_recorder.cc.


Member Function Documentation

void OptionsRecorder::setOption ( const string & key,
const string & value ) throw (ParseException)
 

Adds a new string option into the registry.

Definition at line 118 of file options_recorder.cc.

Referenced by OptionsRecorder(), OptionsRecorder_setBoolOption(), OptionsRecorder_setIntOption(), and OptionsRecorder_setStringOption().

void OptionsRecorder::setOption ( const string & key,
const char * value ) throw (ParseException)
 

Definition at line 125 of file options_recorder.cc.

void OptionsRecorder::setOption ( const string & key,
int value ) throw (ParseException)
 

Adds a new int option into the registry.

Definition at line 133 of file options_recorder.cc.

void OptionsRecorder::setOption ( const string & key,
bool value ) throw (ParseException)
 

Adds a new boolean option into the registry.

Definition at line 142 of file options_recorder.cc.

void OptionsRecorder::checkName ( const string & key,
OptDesc::t_kinds kind ) throw (ParseException)
 

Throws a ParseException if an option with the given name and value type is not allowed.

Definition at line 102 of file options_recorder.cc.

void OptionsRecorder::dumpRegistry ( )
 

Dumps the registry's contents to stderr.

Definition at line 153 of file options_recorder.cc.

Referenced by OptionsRecorder_dumpOptions().


Member Data Documentation

OptDesc OptionsRecorder::optDescriptors [static, private]
 

Initial value:

  {
    {OptionsRecorder::OptDesc::o_bool,   "DEBUG_PARSER",       "false"},
    {OptionsRecorder::OptDesc::o_bool,   "DEBUG_SCANNER" ,     "false"},
    {OptionsRecorder::OptDesc::o_bool,   "CASE_SENSITIVE",     "true"},
    {OptionsRecorder::OptDesc::o_bool,   "USE_EXCEPTIONS",     "true"},
    {OptionsRecorder::OptDesc::o_int,    "DEFAULT_LOOKAHEAD",  "1"},
    {OptionsRecorder::OptDesc::o_bool,   "TOKENS_SPAN_EOF",    "false"},
    
    
    {OptionsRecorder::OptDesc::o_bool,   "COUNT_COLUMNS",      "true"},
    {OptionsRecorder::OptDesc::o_bool,   "SHARP_LINES",        "true"},
    {OptionsRecorder::OptDesc::o_string, "PROFILING_FILE",     ""},
    
    
    {OptionsRecorder::OptDesc::o_int,    NULL,                 NULL},
  }
This is a hardcoded table (see options_recorder.cc) containing the allowed opptions. If an options appears in the options section and its key is not here, the setOption call for it will result in an badOptException. The options descriptors vectors must end with an empty entry (name = NULL, dfault value = NULL, kind doesn't matter).

Definition at line 132 of file options_recorder.hh.

PropRegistry & OptionsRecorder::registry [private]
 

Options that are added through this interface are stored into this registry object.

Definition at line 138 of file options_recorder.hh.


The documentation for this class was generated from the following files:
Generated at Tue Jul 9 21:07:55 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001