eVaf
|
Global properties and variables for eVaf applications. More...
#include <Common/iprop.h>
Signals | |
void | valueChanged (QString const &name, QVariant const &value) |
Global property or variable changed. More... | |
Public Member Functions | |
virtual QVariant | getValue (QString const &name, QVariant const &defaultValue=QVariant()) const =0 |
Returns the value of the global property or variable. More... | |
iProp () | |
Interface constructor. More... | |
virtual void | setValue (QString const &name, QVariant const &value, bool persistent=false)=0 |
Sets the global property or variable. More... | |
virtual | ~iProp () |
Empty virtual dtor. More... | |
Static Public Member Functions | |
static iProp * | instance () |
Returns the iProp interface instance. More... | |
Global properties and variables for eVaf applications.
Global properties and variables are shared by all the eVaf modules. Their function is similar to configuration parameters with the main difference that properties are not meant to be modified by users. For example, the 'applicationName' property contains the name of the current application.
Properties are implemented as name/value pairs where the name uniquely identifies the property. The default implementation of the iProp interface does not enforce any rules for property names and any string is a valid name.
Properties can be temporary or persistent. Temporary properties exist only as long as the application is running and will be lost when the application is restarted. Persistent properties are stored and reloaded when the application is restarted.
Application's XML file section <properties> can be used to define default properties for the application. These are initialized when the application is started up.
Individual properties are defined in <property> nodes with the following attributes:
|
inlinevirtual |
|
pure virtual |
Returns the value of the global property or variable.
name | Name of the property |
defaultValue | Default value |
The getValue() function returns a global property or variable identified by the name. If the property is not found, returns the default value.
Implemented in eVaf::Common::Internal::Prop.
|
static |
Returns the iProp interface instance.
This function returns the global iProp interface instance. If the eVaf module is linked against the common eVaf library, then this is the preferred method of obtaining the iProp interface. Another option would be using the eVaf::Common::iRegistry interface.
|
pure virtual |
Sets the global property or variable.
name | Name of the property |
value | Value of the property |
persistent | If True, then the property is stored permanently |
The setValue() function sets the value of a global property or variable identified by the name. The property is added if it does not exist. Set the persistent argument to True to make the change permanent.
The valueChanged() signal is emitted indicating that a property changed.
Implemented in eVaf::Common::Internal::Prop.
|
signal |
Global property or variable changed.
name | Name of the property |
value | New value of the property |
The valueChanged() signal is emitted when a global property or variable is changed.