eVaf
eVaf::Common::iProp Class Referenceabstract

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 iPropinstance ()
 Returns the iProp interface instance. More...
 

Detailed Description

Global properties and variables for eVaf applications.

#include <Common/iProp>

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:

  • name="\<name\>" - specifies the name of the global property;
  • value="\<value\>" - specifies the value of the global property;
  • config="\<file/section/key\>" - value of the property is read from the configuration file (used only if the 'value' attribute is missing);
  • windowsonly="yes" - the property is initialized only on Windows;
  • linuxonly="yes" - the property is initialized only on Linux.

Definition at line 59 of file iprop.h.

Constructor & Destructor Documentation

eVaf::Common::iProp::iProp ( )
inline

Interface constructor.

Definition at line 66 of file iprop.h.

virtual eVaf::Common::iProp::~iProp ( )
inlinevirtual

Empty virtual dtor.

Definition at line 69 of file iprop.h.

Member Function Documentation

virtual QVariant eVaf::Common::iProp::getValue ( QString const &  name,
QVariant const &  defaultValue = QVariant() 
) const
pure virtual

Returns the value of the global property or variable.

Parameters
nameName of the property
defaultValueDefault value
Returns
The value of the global property or the default value if the property cannot be found

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 iProp* eVaf::Common::iProp::instance ( )
static

Returns the iProp interface instance.

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.

virtual void eVaf::Common::iProp::setValue ( QString const &  name,
QVariant const &  value,
bool  persistent = false 
)
pure virtual

Sets the global property or variable.

Parameters
nameName of the property
valueValue of the property
persistentIf 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.

void eVaf::Common::iProp::valueChanged ( QString const &  name,
QVariant const &  value 
)
signal

Global property or variable changed.

Parameters
nameName of the property
valueNew value of the property

The valueChanged() signal is emitted when a global property or variable is changed.


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