From: Enar Väikene Date: Thu, 6 Oct 2011 10:37:23 +0000 (+0300) Subject: Documentation fixes and updates. X-Git-Url: https://vaikene.ee/gitweb/pswgen01.html?a=commitdiff_plain;h=12fe56ffc347b9a7b2a5ec140ec874038cde8c3b;p=evaf Documentation fixes and updates. --- diff --git a/src/libs/Common/iconfig.h b/src/libs/Common/iconfig.h index 3157eb6..454ec83 100644 --- a/src/libs/Common/iconfig.h +++ b/src/libs/Common/iconfig.h @@ -36,11 +36,11 @@ namespace Common { * The iConfig interface provides access to configuration parameters. Methods in this interface can be * used to read and write configuration parameters. * - * The default implementation of the iConfig interface uses INI files in the eVaf::Common::iApp::instance()->etcDir() + * The default implementation of the iConfig interface uses INI files in the eVaf::Common::iApp::etcDir() * directory. Additional configuration backends can be provided by re-implementing the interface. * * Configuration parameters are identified by a name in the following format: - * [\][\]/\/\ + * @verbatim [][]/
/ @endverbatim * * Where: * @li \ is an optional identifier for the configuration backend. This part is ignored by the default @@ -48,11 +48,11 @@ namespace Common { * for the 'db:' backend identifier and store parameters in a database. Any other requests would be forwarded to * the default implementation. * @li \ is an optional configuration file name. The default iConfig interface implementation uses the file - * name part to locate the INI file in the eVaf::Common::iApp::instance()->etcDir() directory. If the file name part - * is '*' or empty, uses eVaf::Common::iApp::instance()->name() for the file name. + * name part to locate the INI file in the eVaf::Common::iApp::etcDir() directory. If the file name part + * is '*' or empty, uses eVaf::Common::iApp::name() for the file name. * @li \ is the name of the section. Section names can contain extra '/' characters to build a structured * tree of configuration sections. - * @li \ is the name of the key. + * @li \ is the name of the parameter. * * For example: * @li 'db:local/extensions/help/module' - backend 'db:', file or database name 'local', section name 'extensions/help' and @@ -77,7 +77,8 @@ public: * * This method returns the current iConfig interface instance as shown in the following example: * @code - * QString moduleName = eVaf::Common::iConfig::instance()->getValue("/extensions/help/module", "libHelp.so").toString(); + * QString moduleName = + * eVaf::Common::iConfig::instance()->getValue("/extensions/help/module", "libHelp.so").toString(); * @endcode */ static iConfig * instance(); diff --git a/src/libs/Common/inifile.h b/src/libs/Common/inifile.h index 705bd9b..5392984 100644 --- a/src/libs/Common/inifile.h +++ b/src/libs/Common/inifile.h @@ -43,7 +43,7 @@ namespace Internal { * INI files can contain comment lines that start with ';' or '#'. Comments are * preserved when new values are written to the INI file. * - * This is a sample INI file: + * This is a sample INI %file: * @code * [main] * # The full name of this parameter is 'main/name' @@ -105,7 +105,7 @@ public: * @return The value from the INI file or an invalid QVariant if failed * * The getValue() method reads a parameter value from the INI file. Parameters are identified by a section and key name pair - * in the format '<section>/<key>'. For example, if the section is called 'general' and the key is called 'log_level', + * in the format '\/\'. For example, if the section is called 'general' and the key is called 'log_level', * then the name of the parameter should be given as 'general/log_level'. Parameter names are case insensitive. * * If the parameter cannot be read because it is not found in the INI file or the INI file object is invalid, returns the @@ -116,6 +116,8 @@ public: * @li If the value in the INI file is 'abc' and the default value an integer value, then validation * fails and the method returns the default value; * @li If the default value is a boolean value, then the method accepts '1', 'true', 'on' and 'yes' as valid values. + * + * @sa eVaf::Common::toVariant() */ QVariant getValue(QString const & paramName, QVariant const & defaultValue = QVariant::Invalid); @@ -126,7 +128,7 @@ public: * @return True if succeeded and false if not * * The setValue() method writes a parameter value to the INI file. Parameters are identified by a section and key name pair - * in the format '<section>/<key>'. For example, if the section is called 'general' and the key is called 'log_level', + * in the format '\/\'. For example, if the section is called 'general' and the key is called 'log_level', * the the name of the parameter should be given as 'general/log_level'. Parameter names are case insensitive. * * The method returns true if the parameter value was written into the INI file and false if not. Use the errorString() method diff --git a/src/libs/Common/util.h b/src/libs/Common/util.h index 80fae62..4b5e4c9 100644 --- a/src/libs/Common/util.h +++ b/src/libs/Common/util.h @@ -63,6 +63,15 @@ inline bool isFalse(QString const & str) * This function converts strings to variant values. The type of the expected value is determined * from the default value. If the string fails to convert to the expected type, returns the * default value. + * + * If the default value is of one of the following types, then the following conversion rules are applied: + * @li QVariant::UInt - if the string begins with "0x", base 16 is used; if the string begins with "0", + * base 8 is used; otherwise base 10 is used; + * @li QVariant::Int - base 10 is used; + * @li QVariant::Double - the decimal point is expecte to be '.' regardless which locale is used; + * @li QVariant::Bool - tries to use isTrue() and isFalse() methods; otherwise performs a conversion to QVariant::uint; + * @li QVariant::Char - if the string begins with "\0x", expects it to be an ASCII code in hex; if the + * string begins with "\0", expects it to be an ASCII code in oct; otherwise uses the first character in the string; */ COMMON_EXPORT QVariant toVariant(QString const & value, QVariant const & defaultValue);