eVaf
|
eVaf configuration interface. More...
#include <Common/iconfig.h>
Public Member Functions | |
virtual QVariant | getValue (QString const ¶mName, QVariant const &defaultValue) const =0 |
Reads a configuration parameter value. More... | |
iConfig () | |
Interface constructor. More... | |
virtual bool | setValue (QString const ¶mName, QVariant const &value, bool commit=true)=0 |
Writes a configuration parameter value. More... | |
virtual | ~iConfig () |
Empty virtual destructor. More... | |
Static Public Member Functions | |
static iConfig * | instance () |
Returns the current iConfig interface instance. More... | |
eVaf configuration interface.
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::etcDir() directory. Additional configuration backends can be provided by re-implementing the interface.
Configuration parameters are identified by a name in the following format:
[<backend:>][<file>]/<section>/<key>
Where:
For example:
|
inline |
|
inlinevirtual |
|
pure virtual |
Reads a configuration parameter value.
paramName | Name of the parameter |
defaultValue | Default value |
The getValue() method returns a configuration parameter value identified by the parameter name. If the parameter cannot be read or is not found, returns the default value.
The default value is used to determine the type of the value. For example, if the default value is an integer, then the returned value is also an integer. The default iConfig interface implementation validates parameter values and makes sure that the parameter value is of the proper type. If the value cannot be converted to the proper type, returns the default value. Other implementations of the iConfig interface are encouraged to do the same.
Implemented in eVaf::Common::Internal::Config.
|
static |
|
pure virtual |
Writes a configuration parameter value.
paramName | Name of the parameter |
value | The parameter value |
commit | If true, then commits new parameter values |
The setValue() method writes new configuration parameter values identified by the parameter name.
The commit argument can be used to improve the performance of writing several parameter values at once. Use commit = false for all except the last parameter's write operation.
Implemented in eVaf::Common::Internal::Config.