Config Class Reference

Singleton for configuration variables. More...

#include <config.h>

List of all members.

Public Member Functions

QListIterator< ConfigOptioniterator ()
void writeTemplate (QTextStream &t, bool shortIndex, bool updateOnly)
void convertStrToVal ()
void substituteEnvironmentVars ()
void check ()
void init ()
bool parseString (const char *fn, const char *str)
bool parse (const char *fn)
void create ()
Getting configuration values.
QCString & getString (const char *fileName, int num, const char *name) const
QStrList & getList (const char *fileName, int num, const char *name) const
QCString & getEnum (const char *fileName, int num, const char *name) const
int & getInt (const char *fileName, int num, const char *name) const
bool & getBool (const char *fileName, int num, const char *name) const
ConfigOptionget (const char *name) const
Adding configuration options.
ConfigInfoaddInfo (const char *name, const char *doc)
ConfigStringaddString (const char *name, const char *doc)
ConfigEnumaddEnum (const char *name, const char *doc, const char *defVal)
ConfigListaddList (const char *name, const char *doc)
ConfigIntaddInt (const char *name, const char *doc, int minVal, int maxVal, int defVal)
ConfigBooladdBool (const char *name, const char *doc, bool defVal)
ConfigOptionaddObsolete (const char *name)

Static Public Member Functions

static Configinstance ()
static void deleteInstance ()

Protected Member Functions

 Config ()
 ~Config ()


Detailed Description

Singleton for configuration variables.

This object holds the global static variables read from a user-supplied configuration file. The static member instance() can be used to get a pointer to the one and only instance.

Set all variables to their default values by calling Config::instance()->init()

Definition at line 345 of file config.h.


Constructor & Destructor Documentation

Config::Config (  )  [inline, protected]

Definition at line 555 of file config.h.

References create().

Config::~Config (  )  [inline, protected]

Definition at line 565 of file config.h.


Member Function Documentation

static Config* Config::instance (  )  [inline, static]

Returns the one and only instance of this class

Definition at line 353 of file config.h.

Referenced by checkConfiguration(), parseString(), and readConfiguration().

static void Config::deleteInstance (  )  [inline, static]

Delete the instance

Definition at line 359 of file config.h.

Referenced by generateOutput().

QListIterator<ConfigOption> Config::iterator (  )  [inline]

Returns an iterator that can by used to iterate over the configuration options.

Definition at line 368 of file config.h.

QCString & Config::getString ( const char *  fileName,
int  num,
const char *  name 
) const

Returns the value of the string option with name fileName. The arguments num and name are for debugging purposes only. There is a convenience function Config_getString() for this.

Definition at line 778 of file config.cpp.

References config_err(), ConfigOption::kind(), and ConfigOption::O_String.

QStrList & Config::getList ( const char *  fileName,
int  num,
const char *  name 
) const

Returns the value of the list option with name fileName. The arguments num and name are for debugging purposes only. There is a convenience function Config_getList() for this.

Definition at line 794 of file config.cpp.

References config_err(), ConfigOption::kind(), and ConfigOption::O_List.

QCString & Config::getEnum ( const char *  fileName,
int  num,
const char *  name 
) const

Returns the value of the enum option with name fileName. The arguments num and name are for debugging purposes only. There is a convenience function Config_getEnum() for this.

Definition at line 810 of file config.cpp.

References config_err(), ConfigOption::kind(), and ConfigOption::O_Enum.

int & Config::getInt ( const char *  fileName,
int  num,
const char *  name 
) const

Returns the value of the integer option with name fileName. The arguments num and name are for debugging purposes only. There is a convenience function Config_getInt() for this.

Definition at line 826 of file config.cpp.

References config_err(), ConfigOption::kind(), and ConfigOption::O_Int.

bool & Config::getBool ( const char *  fileName,
int  num,
const char *  name 
) const

Returns the value of the boolean option with name fileName. The arguments num and name are for debugging purposes only. There is a convenience function Config_getBool() for this.

Definition at line 842 of file config.cpp.

References config_err(), ConfigOption::kind(), and ConfigOption::O_Bool.

ConfigOption* Config::get ( const char *  name  )  const [inline]

Returns the ConfigOption corresponding with name or 0 if the option is not supported.

Definition at line 411 of file config.h.

ConfigInfo* Config::addInfo ( const char *  name,
const char *  doc 
) [inline]

Starts a new configuration section with name and description doc.

Returns:
An object representing the option.

Definition at line 425 of file config.h.

Referenced by create().

ConfigString* Config::addString ( const char *  name,
const char *  doc 
) [inline]

Adds a new string option with name and documentation doc.

Returns:
An object representing the option.

Definition at line 435 of file config.h.

Referenced by create().

ConfigEnum* Config::addEnum ( const char *  name,
const char *  doc,
const char *  defVal 
) [inline]

Adds a new enumeration option with name and documentation doc and initial value defVal.

Returns:
An object representing the option.

Definition at line 448 of file config.h.

Referenced by create().

ConfigList* Config::addList ( const char *  name,
const char *  doc 
) [inline]

Adds a new string option with name and documentation doc.

Returns:
An object representing the option.

Definition at line 461 of file config.h.

Referenced by create().

ConfigInt* Config::addInt ( const char *  name,
const char *  doc,
int  minVal,
int  maxVal,
int  defVal 
) [inline]

Adds a new integer option with name and documentation doc. The integer has a range between minVal and maxVal and a default value of defVal.

Returns:
An object representing the option.

Definition at line 475 of file config.h.

Referenced by create().

ConfigBool* Config::addBool ( const char *  name,
const char *  doc,
bool  defVal 
) [inline]

Adds a new boolean option with name and documentation doc. The boolean has a default value of defVal.

Returns:
An object representing the option.

Definition at line 489 of file config.h.

Referenced by create().

ConfigOption* Config::addObsolete ( const char *  name  )  [inline]

Adds an option that has become obsolete.

Definition at line 499 of file config.h.

References ConfigOption::O_Obsolete.

Referenced by create().

void Config::writeTemplate ( QTextStream &  t,
bool  shortIndex,
bool  updateOnly 
)

Writes a template configuration to stream t. If shortIndex is TRUE the description of each configuration option will be omitted.

Definition at line 2633 of file config.cpp.

References versionString, and ConfigOption::writeTemplate().

void Config::convertStrToVal (  ) 

Converts the string values read from the configuration file to real values for non-string type options (like int, and bools)

Definition at line 2656 of file config.cpp.

References ConfigOption::convertStrToVal().

Referenced by checkConfiguration(), and readConfiguration().

void Config::substituteEnvironmentVars (  ) 

Replaces references to environment variable by the actual value of the environment variable.

Definition at line 2795 of file config.cpp.

References ConfigOption::substEnvVars().

Referenced by checkConfiguration(), and readConfiguration().

void Config::check (  ) 

Checks if the values of the variable are correct, adjusts them if needed, and report any errors.

Definition at line 2840 of file config.cpp.

References config_err(), Config_getBool, Config_getEnum, Config_getInt, Config_getList, Config_getString, portable_commandExtension(), portable_fileSystemIsCaseSensitive(), portable_getenv(), portable_pathListSeparator(), portable_setenv(), QCString, and stripFromPath().

Referenced by checkConfiguration(), and readConfiguration().

void Config::init (  ) 

Initialize config variables to their default value

Definition at line 3231 of file config.cpp.

References ConfigOption::init().

Referenced by readConfiguration().

bool Config::parseString ( const char *  fn,
const char *  str 
)

Parse a configuration data in string str.

Returns:
TRUE if successful, or FALSE if the string could not be parsed.

Definition at line 5053 of file config.cpp.

References BEGIN, configYYin, configYYlex(), configYYrestart(), instance(), and Start.

Referenced by parse().

bool Config::parse ( const char *  fn  ) 

Parse a configuration file with name fn.

Returns:
TRUE if successful, FALSE if the file could not be opened or read.

Definition at line 5070 of file config.cpp.

References parseString().

void Config::create (  ) 

Called from the constructor, will add doxygen's default options to the configuration object

Definition at line 3241 of file config.cpp.

References addBool(), ConfigOption::addDependency(), addEnum(), addInfo(), addInt(), addList(), addObsolete(), addString(), ConfigEnum::addValue(), ConfigList::Dir, ConfigString::Dir, ConfigList::File, ConfigString::File, ConfigList::FileAndDir, portable_fileSystemIsCaseSensitive(), ConfigString::setDefaultValue(), ConfigList::setWidgetType(), and ConfigString::setWidgetType().

Referenced by Config().


The documentation for this class was generated from the following files:



Generated on Mon Mar 31 10:58:57 2008 by  doxygen 1.5.1