Aimsun Next Scripting
22
|
Public Member Functions | |
GKPreferencesValues () | |
~GKPreferencesValues () | |
GKModel * | getModel () const |
void | setDefinition (const GKPreferences *def) |
QString | getValue (const QString &name) const |
void | setValue (const QString &name, const QString &value) |
If GKPreferences stores the definition of which attributes are available, this class holds the values for these attributes.
Note that the value of an attribute can be defined in three places: the model, the system and the attribute itself as a default value. The application will ask for the value in the model using the method GKModel::getPreferences() an then GKPreferencesValues::getValue. It no value is defined there the GKPreferencesValues::getValue will look in the system and if no value is in the system will get the default value stored in the attribute ( GKPreferencesAttribute::setDefault ).
Preferences values are set when edited with the GKPreferencesEditor.
There are two ways to know when a preferences object has been changed:
The first method is the preferred for QObject derivates (as they can use the signal/slot system). The second is reserved for GKObject derivates that do not have access to this system.
GKPreferencesValues::GKPreferencesValues | ( | ) |
GKPreferencesValues::~GKPreferencesValues | ( | ) |
GKModel * GKPreferencesValues::getModel | ( | ) | const |
Get the model for this preferences or None is they are system preferences.
QString GKPreferencesValues::getValue | ( | const QString & | name | ) | const |
Return the value of attribute called "name". If the attribute is not found this method return the value in the system or the default value set in when the attribute was defined (GKPreferencesAttribute::setDefault) is these are the attributes values for the system and the attribute id not found there too.
void GKPreferencesValues::setDefinition | ( | const GKPreferences * | def | ) |
Set the definition of the preferences values contained in this object. By default it takes the definition from the system (GKSystem::getPreferencesDefinition()). In this case this method do not have to be used. Use it only when accessing values that are not part of the system or model preferences.
void GKPreferencesValues::setValue | ( | const QString & | name, |
const QString & | value | ||
) |
Set the value of an attribute called "name". Note that before setting the value of an attribute it has to be defined in the GKPreferences.