#include <appprefs.hpp>
Collaboration diagram for PreferenceValue:
Public Member Functions | |
bool | get (wxSize &value) const |
Gets a wxSize value. | |
bool | get (wxPoint &value) const |
Gets a wxPoint value. | |
bool | get (wxRect &value) const |
Gets a wxRect value. | |
bool | get (bool &value) const |
Gets a boolean value. | |
bool | get (double &value) const |
Gets a double value. | |
bool | get (wxString &value) const |
Gets a string value. | |
bool | get (long &value) const |
Gets a long integer value. | |
wxString | getConfigKey () const |
Gets the key of the preference in the configuration file. | |
PreferenceValue & | operator= (const PreferenceValue &source) |
Assignment operator. | |
PreferenceValue (const PreferenceValue &source) | |
Copy constructor. | |
PreferenceValue (const wxSize &value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a wxSize type. | |
PreferenceValue (const wxPoint &value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a wxPoint type. | |
PreferenceValue (const wxRect &value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a wxRect type. | |
PreferenceValue (const bool value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a boolean type. | |
PreferenceValue (const double value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a double type. | |
PreferenceValue (const wxString &value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a string type. | |
PreferenceValue (const long value, const wxString &cfgKey=wxEmptyString, const bool initFromCfgFile=true) | |
Constructor with a long integer type. | |
PreferenceValue () | |
Default constructor. | |
bool | set (const wxSize &newValue) |
Sets a wxSize value. | |
bool | set (const wxPoint &newValue) |
Sets a wxPoint value. | |
bool | set (const wxRect &newValue) |
Sets a wxRect value. | |
bool | set (const bool newValue) |
Sets a boolean value. | |
bool | set (const double newValue) |
Sets a string value. | |
bool | set (const wxString &newValue) |
Sets a string value. | |
bool | set (const long newValue) |
Sets a long integer value. | |
~PreferenceValue () | |
Destructor. | |
Static Public Member Functions | |
wxSize | read (const wxString &key, const wxSize &def, wxConfigBase *cfg=NULL) |
Reads a wxSize value from the configuration file. | |
bool | read (const wxString &key, wxSize *r, wxConfigBase *cfg=NULL) |
Reads a wxSize value from the configuration file. | |
wxPoint | read (const wxString &key, const wxPoint &def, wxConfigBase *cfg=NULL) |
Reads a wxPoint value from the configuration file. | |
bool | read (const wxString &key, wxPoint *r, wxConfigBase *cfg=NULL) |
Reads a wxPoint value from the configuration file. | |
wxRect | read (const wxString &key, const wxRect &def, wxConfigBase *cfg=NULL) |
Reads a wxRect value from the configuration file. | |
bool | read (const wxString &key, wxRect *r, wxConfigBase *cfg=NULL) |
Reads a wxRect value from the configuration file. | |
Protected Types | |
enum | PreferenceType { ptNotDefined = 0, ptLong, ptString, ptDouble, ptBoolean, ptRect, ptSize, ptPoint } |
Type of the preference value. More... | |
Protected Member Functions | |
void | cleanup () |
Cleans up the memory. | |
void | clone (const PreferenceValue &source) |
Clones the source instance in this instance. | |
Protected Attributes | |
wxString | _cfgKey |
Corresponding key in the configuration file. Must be empty if this item isn't stored in the configuration file. | |
value_t | _value |
Value of the preference. | |
PreferenceType | _valueType |
Type of the preference. |
A preference value has a type and can have a corresponding key in the global configuration file (see wxConfig::Get()
in the wxWidgets documentation).
The type of the preference is fixed at the construction of the instance and can't be changed. The type is always checked when the value is set or gotten.
If a key is specified:
initFromCfgFile
is true
, then the preference value is initialized by reading the global configuration file (on failure the given value is used). set
method is called, the preference value is written in the global configuration file.
The static read
methods provide facility for reading the complex types that are handled by this class (such as wxRect for example).
Definition at line 68 of file appprefs.hpp.
|
Type of the preference value.
Definition at line 72 of file appprefs.hpp. |
|
Default constructor.
Definition at line 89 of file appprefs.cpp. References _value, _valueType, and PreferenceValue::value_t::valLong. |
|
Constructor with a long integer type.
Definition at line 181 of file appprefs.cpp. References _cfgKey, _value, _valueType, and PreferenceValue::value_t::valLong. |
|
Constructor with a string type.
Definition at line 202 of file appprefs.cpp. References _cfgKey, _value, _valueType, and PreferenceValue::value_t::valString. |
|
Constructor with a double type.
Definition at line 223 of file appprefs.cpp. References _cfgKey, _value, _valueType, and PreferenceValue::value_t::valDouble. |
|
Constructor with a boolean type.
Definition at line 244 of file appprefs.cpp. References _cfgKey, _value, _valueType, and PreferenceValue::value_t::valBool. |
|
Constructor with a wxRect type.
Definition at line 265 of file appprefs.cpp. References _cfgKey, _value, _valueType, read(), and PreferenceValue::value_t::valRect. |
|
Constructor with a wxPoint type.
Definition at line 286 of file appprefs.cpp. References _cfgKey, _value, _valueType, read(), and PreferenceValue::value_t::valPoint. |
|
Constructor with a wxSize type.
Definition at line 307 of file appprefs.cpp. References _cfgKey, _value, _valueType, read(), and PreferenceValue::value_t::valSize. |
|
Copy constructor.
Definition at line 148 of file appprefs.cpp. References _value, _valueType, clone(), and PreferenceValue::value_t::valLong. |
|
Destructor.
Definition at line 322 of file appprefs.cpp. References cleanup(). |
|
Cleans up the memory.
Definition at line 332 of file appprefs.cpp. References _value, _valueType, PreferenceValue::value_t::valBool, PreferenceValue::value_t::valDouble, PreferenceValue::value_t::valLong, PreferenceValue::value_t::valPoint, PreferenceValue::value_t::valRect, PreferenceValue::value_t::valSize, and PreferenceValue::value_t::valString. Referenced by clone(), and ~PreferenceValue(). |
|
Clones the source instance in this instance.
Definition at line 102 of file appprefs.cpp. References _cfgKey, _value, _valueType, cleanup(), clone(), PreferenceValue::value_t::valBool, PreferenceValue::value_t::valDouble, PreferenceValue::value_t::valLong, PreferenceValue::value_t::valPoint, PreferenceValue::value_t::valRect, PreferenceValue::value_t::valSize, and PreferenceValue::value_t::valString. Referenced by clone(), operator=(), and PreferenceValue(). |
|
Gets a wxSize value.
Definition at line 680 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valSize. |
|
Gets a wxPoint value.
Definition at line 628 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valPoint. |
|
Gets a wxRect value.
Definition at line 575 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valRect. |
|
Gets a boolean value.
Definition at line 527 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valBool. |
|
Gets a double value.
Definition at line 479 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valDouble. |
|
Gets a string value.
Definition at line 431 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valString. |
|
Gets a long integer value.
Definition at line 383 of file appprefs.cpp. References _value, _valueType, get(), and PreferenceValue::value_t::valLong. Referenced by get(). |
|
Gets the key of the preference in the configuration file.
Definition at line 369 of file appprefs.cpp. References _cfgKey. |
|
Assignment operator.
Definition at line 163 of file appprefs.cpp. References clone(), and operator=(). Referenced by operator=(). |
|
Reads a wxSize value from the configuration file.
Definition at line 940 of file appprefs.cpp. References read(). |
|
Reads a wxSize value from the configuration file.
Definition at line 888 of file appprefs.cpp. References read(). |
|
Reads a wxPoint value from the configuration file.
Definition at line 865 of file appprefs.cpp. References read(). |
|
Reads a wxPoint value from the configuration file.
Definition at line 813 of file appprefs.cpp. References read(). |
|
Reads a wxRect value from the configuration file.
Definition at line 790 of file appprefs.cpp. References read(). |
|
Reads a wxRect value from the configuration file.
Definition at line 736 of file appprefs.cpp. References read(). Referenced by PreferenceValue(), and read(). |
|
Sets a wxSize value.
Definition at line 705 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valSize. |
|
Sets a wxPoint value.
Definition at line 653 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valPoint. |
|
Sets a wxRect value.
Definition at line 600 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valRect. |
|
Sets a boolean value.
Definition at line 552 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valBool. |
|
Sets a string value.
Definition at line 504 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valDouble. |
|
Sets a string value.
Definition at line 456 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valString. |
|
Sets a long integer value.
Definition at line 408 of file appprefs.cpp. References _cfgKey, _value, _valueType, set(), and PreferenceValue::value_t::valLong. Referenced by set(). |
|
Corresponding key in the configuration file. Must be empty if this item isn't stored in the configuration file.
Definition at line 98 of file appprefs.hpp. Referenced by clone(), getConfigKey(), PreferenceValue(), and set(). |
|
Value of the preference.
Definition at line 96 of file appprefs.hpp. Referenced by cleanup(), clone(), get(), PreferenceValue(), and set(). |
|
Type of the preference.
Definition at line 97 of file appprefs.hpp. Referenced by cleanup(), clone(), get(), PreferenceValue(), and set(). |