Doxygen
|
Singleton for configuration variables. More...
#include <src/configimpl.h>
Public Member Functions | |
ConfigImpl () | |
void | writeTemplate (TextStream &t, bool shortIndex, bool updateOnly) |
void | compareDoxyfile (TextStream &t, Config::CompareMode compareMode) |
void | writeXMLDoxyfile (TextStream &t) |
void | writeXSDDoxyfile (TextStream &t) |
void | setHeader (const char *header) |
void | convertStrToVal (Config::CompareMode compareMode) |
void | emptyValueToDefault () |
void | substituteEnvironmentVars () |
void | init () |
bool | parseString (const QCString &fn, const QCString &str, bool upd=FALSE) |
bool | parse (const QCString &fn, bool upd=FALSE) |
void | appendStartComment (const QCString &u) |
void | appendUserComment (const QCString &u) |
void | appendStoreRepl (const QCString &u) |
QCString | takeStartComment () |
QCString | takeUserComment () |
QCString | takeStoreRepl () |
Getting configuration values. | |
QCString & | getString (const char *fileName, int num, const char *name) const |
StringVector & | 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 |
ConfigOption * | get (const QCString &name) const |
Adding configuration options. | |
ConfigInfo * | addInfo (const char *name, const char *doc) |
ConfigString * | addString (const char *name, const char *doc) |
ConfigEnum * | addEnum (const char *name, const char *doc, const char *defVal) |
ConfigList * | addList (const char *name, const char *doc) |
ConfigInt * | addInt (const char *name, const char *doc, int minVal, int maxVal, int defVal) |
ConfigBool * | addBool (const char *name, const char *doc, bool defVal) |
ConfigOption * | addObsolete (const char *name, ConfigOption::OptionType orgType) |
ConfigOption * | addDisabled (const char *name) |
Static Public Member Functions | |
static ConfigImpl * | instance () |
static void | deleteInstance () |
static void | config_err (const char *fmt,...) |
static void | config_term (const char *fmt,...) |
static void | config_warn (const char *fmt,...) |
Static Private Attributes | |
static std::unique_ptr< ConfigImpl > | m_instance |
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 341 of file configimpl.h.
ConfigImpl::ConfigImpl | ( | ) |
Definition at line 1572 of file configimpl.l.
References addConfigOptions().
Referenced by instance().
|
inline |
Adds a new boolean option with name and documentation doc. The boolean has a default value of defVal.
Definition at line 478 of file configimpl.h.
|
inline |
Adds an option that has been disabled at compile time.
Definition at line 498 of file configimpl.h.
References m_dict, and m_disabled.
|
inline |
Adds a new enumeration option with name and documentation doc and initial value defVal.
Definition at line 437 of file configimpl.h.
|
inline |
Starts a new configuration section with name and description doc.
Definition at line 414 of file configimpl.h.
References m_options.
|
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.
Definition at line 464 of file configimpl.h.
|
inline |
Adds a new string option with name and documentation doc.
Definition at line 450 of file configimpl.h.
|
inline |
Adds an option that has become obsolete.
Definition at line 489 of file configimpl.h.
References m_dict, and m_obsolete.
|
inline |
Adds a new string option with name and documentation doc.
Definition at line 424 of file configimpl.h.
|
inline |
Append user start comment
Definition at line 565 of file configimpl.h.
References m_startComment.
|
inline |
Append replacement string
Definition at line 577 of file configimpl.h.
References m_storeRepl.
|
inline |
Append user comment
Definition at line 571 of file configimpl.h.
References m_userComment.
void ConfigImpl::compareDoxyfile | ( | TextStream & | t, |
Config::CompareMode | compareMode ) |
Writes a the differences between the current configuration and the template configuration to stream t.
Definition at line 1343 of file configimpl.l.
References ConfigOption::compareDoxyfile(), m_options, m_storeRepl, ConfigOption::m_userComment, and takeStoreRepl().
Referenced by Config::compareDoxyfile().
|
static |
Definition at line 60 of file configimpl.l.
References error_str, and qPrint().
Referenced by tryPath().
|
static |
Definition at line 68 of file configimpl.l.
References error_str, and qPrint().
Referenced by Config::checkAndCorrect(), configFileToString(), configStringRecode(), getBool(), getEnum(), getInt(), getList(), getString(), init(), and readIncludeFile().
|
static |
Definition at line 78 of file configimpl.l.
References qPrint(), and warning_str.
Referenced by ConfigBool::convertStrToVal(), ConfigEnum::convertStrToVal(), ConfigInt::convertStrToVal(), processList(), processString(), and setTranslator().
void ConfigImpl::convertStrToVal | ( | Config::CompareMode | compareMode | ) |
Converts the string values read from the configuration file to real values for non-string type options (like int, and bools)
Definition at line 1382 of file configimpl.l.
References ConfigOption::convertStrToVal(), and m_options.
|
inlinestatic |
Delete the instance
Definition at line 356 of file configimpl.h.
References m_instance.
Referenced by Config::deinit().
void ConfigImpl::emptyValueToDefault | ( | ) |
Sets default value in case value is empty
Definition at line 1389 of file configimpl.l.
References ConfigOption::emptyValueToDefault(), and m_options.
|
inline |
Returns the ConfigOption corresponding with name or 0 if the option is not supported.
Definition at line 399 of file configimpl.h.
References m_dict, and QCString::str().
Referenced by DocPara::handleDoxyConfig(), init(), and Config::updateObsolete().
bool & ConfigImpl::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 351 of file configimpl.l.
References config_term(), m_dict, and ConfigOption::O_Bool.
QCString & ConfigImpl::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 323 of file configimpl.l.
References config_term(), m_dict, and ConfigOption::O_Enum.
int & ConfigImpl::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 337 of file configimpl.l.
References config_term(), m_dict, and ConfigOption::O_Int.
StringVector & ConfigImpl::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 309 of file configimpl.l.
References config_term(), m_dict, and ConfigOption::O_List.
QCString & ConfigImpl::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 295 of file configimpl.l.
References config_term(), m_dict, and ConfigOption::O_String.
void ConfigImpl::init | ( | ) |
Initialize config variables to their default value
Definition at line 1549 of file configimpl.l.
References config_term(), ConfigOption::dependsOn(), get(), ConfigOption::init(), instance(), QCString::isEmpty(), m_options, ConfigOption::name(), and qPrint().
Referenced by Config::init().
|
inlinestatic |
Returns the one and only instance of this class
Definition at line 350 of file configimpl.h.
References ConfigImpl(), and m_instance.
Referenced by Config::compareDoxyfile(), Config::deinit(), DocPara::handleDoxyConfig(), Config::init(), init(), Config::parse(), parseString(), Config::postProcess(), Config::updateObsolete(), Config::writeTemplate(), Config::writeXMLDoxyfile(), and Config::writeXSDDoxyfile().
Parse a configuration file with name fn.
Definition at line 1628 of file configimpl.l.
References configFileToString(), g_encoding, Debug::Lex_configimpl, parseString(), and qPrint().
Referenced by Config::parse().
Parse a configuration data in string str.
Definition at line 1608 of file configimpl.l.
References QCString::data(), FALSE, g_config, g_configUpdate, g_includeStack, g_inputPosition, g_inputString, g_yyFileName, g_yyLineNr, instance(), Debug::isFlagSet(), Debug::Lex_configimpl, and TRUE.
Referenced by parse().
|
inline |
void ConfigImpl::substituteEnvironmentVars | ( | ) |
Replaces references to environment variable by the actual value of the environment variable.
Definition at line 1541 of file configimpl.l.
References m_options, and ConfigOption::substEnvVars().
|
inline |
Take the user start comment and reset it internally
Definition at line 584 of file configimpl.h.
References m_startComment, and substitute().
Referenced by writeTemplate().
|
inline |
Take the replacement string
Definition at line 602 of file configimpl.h.
References m_storeRepl, and substitute().
Referenced by compareDoxyfile().
|
inline |
Take the user comment and reset it internally
Definition at line 593 of file configimpl.h.
References m_userComment, and substitute().
Referenced by writeTemplate().
void ConfigImpl::writeTemplate | ( | TextStream & | 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 1319 of file configimpl.l.
References convertToComment(), m_header, m_options, m_startComment, m_userComment, takeStartComment(), takeUserComment(), and ConfigOption::writeTemplate().
Referenced by Config::writeTemplate().
void ConfigImpl::writeXMLDoxyfile | ( | TextStream & | t | ) |
Writes a the used settings of the current configuration as XML format to stream t.
Definition at line 1359 of file configimpl.l.
References m_options, theTranslator, and ConfigOption::writeXMLDoxyfile().
Referenced by Config::writeXMLDoxyfile().
void ConfigImpl::writeXSDDoxyfile | ( | TextStream & | t | ) |
Writes all possible setting ids to an XSD file for validation through the stream t.
Definition at line 1370 of file configimpl.l.
References m_disabled, m_options, and ConfigOption::writeXSDDoxyfile().
Referenced by Config::writeXSDDoxyfile().
|
private |
Definition at line 617 of file configimpl.h.
Referenced by addBool(), addDisabled(), addEnum(), addInt(), addList(), addObsolete(), addString(), get(), getBool(), getEnum(), getInt(), getList(), and getString().
|
private |
Definition at line 616 of file configimpl.h.
Referenced by addDisabled(), and writeXSDDoxyfile().
|
private |
Definition at line 622 of file configimpl.h.
Referenced by setHeader(), and writeTemplate().
|
staticprivate |
Definition at line 618 of file configimpl.h.
Referenced by deleteInstance(), and instance().
|
private |
Definition at line 615 of file configimpl.h.
Referenced by addObsolete().
|
private |
Definition at line 614 of file configimpl.h.
Referenced by addBool(), addEnum(), addInfo(), addInt(), addList(), addString(), compareDoxyfile(), convertStrToVal(), emptyValueToDefault(), init(), substituteEnvironmentVars(), writeTemplate(), writeXMLDoxyfile(), and writeXSDDoxyfile().
|
private |
Definition at line 619 of file configimpl.h.
Referenced by appendStartComment(), takeStartComment(), and writeTemplate().
|
private |
Definition at line 621 of file configimpl.h.
Referenced by appendStoreRepl(), compareDoxyfile(), and takeStoreRepl().
|
private |
Definition at line 620 of file configimpl.h.
Referenced by appendUserComment(), takeUserComment(), and writeTemplate().