#include <ArPref.h>
Public Types | |
enum | ValType { Integer, Double, Boolean, String } |
Public Methods | |
ArPref (int section, int pref, const char *name, const char *val, const char **validVals, ValType valType, const char *comment) | |
Constructor. | |
ArPref (const ArPref &pref) | |
Copy constructor. | |
virtual | ~ArPref () |
Destructor. | |
virtual bool | getBool () |
Get the value as a boolean. More... | |
virtual int | getInt () |
Get the value as an integer. More... | |
virtual double | getDouble () |
Get the value as a double. More... | |
virtual std::string | getString () |
Get the value as a std::string. More... | |
virtual bool | setBool (bool val, bool append=false) |
Set the value to be the supplied boolean. More... | |
virtual bool | setInt (int val, bool append=false) |
Set the value to be the supplied integer. More... | |
virtual bool | setDouble (double val, bool append=false) |
Set the value to be the supplied doule. More... | |
virtual bool | setString (const char *val, bool append=false) |
Set the value to be the supplied std::string. More... | |
virtual int | getSetCount () |
Get the number of values that would be in the set regardless of type. More... | |
virtual int | getBoolSet (bool *boolArray, int size) |
Get the value as multiple booleans. More... | |
virtual int | getIntSet (int *intArray, int size) |
Get the value as multiple integers. More... | |
virtual int | getDoubleSet (double *doubleArray, int size) |
Get the value as multiple doubles. More... | |
virtual int | getStringSet (std::string *stringArray, int size) |
Get the value as multiple std::strings. More... | |
virtual bool | setBoolSet (bool append, int count,...) |
Set the value to be the supplied booleans. More... | |
virtual bool | setIntSet (bool append, int count,...) |
Set the value to be the supplied integers. More... | |
virtual bool | setDoubleSet (bool append, int count,...) |
Set the value to be the supplied doubles. More... |
This represents an individual preference which is loaded from compiled in defaults of from a preferences file. A preference can be one of four different types: Integer, Double, Boolean, String. The preference itself is stored as a string. There are accessors which convert from string to the desired format and vice versa: getBool(), getInt(), getDouble(), getString(), setBool(), setInt(), setDouble(), setString(). A preference can also have a set of values of all the same type. In the file would look like:
<key> <int> <int> <int> ...
The 'set' accessors can deal with an abitrary amount of values: getBoolSet(), getIntSet(), getDoubleSet(), getStringSet(), setBoolSet(), setIntSet(), setDoubleSet().
A preference can have an array of valid values. When the file is loaded, ArPreferences checks all the values from the file against the supplied valid values. The check is done with a string compare. It is most usefull for string values. So it will apply to numbers as long as they are formated in the correct way.
|
|
|
Get the value as a boolean. Get the value, formating it correctly. If the preference is not of the boolean type or not found, it will return false. |
|
Get the value as multiple booleans. Get the value, formating it correctly. If the preference is not of the boolean type or not found, it will return false.
|
|
Get the value as a double. Get the value, formating it correctly. If the preference is not of the double type or not found, it will return 0.0. |
|
Get the value as multiple doubles. Get the value, formating it correctly. If the preference is not of the double type or not found, it will return an empty list.
|
|
Get the value as an integer. Get the value, formating it correctly. If the preference is not of the integer type or not found, it will return 0. |
|
Get the value as multiple integers. Get the value, formating it correctly. If the preference is not of the integer type or not found, it will return an empty list.
|
|
Get the number of values that would be in the set regardless of type. Get the number of values that is contained in this preference. This is independent of the type of values. Use this to figure out how big of an array that you need to get a set of values. |
|
Get the value as a std::string. Get the value, formating it correctly. If the preference is not of the string type or not found, it will return "". |
|
Get the value as multiple std::strings. Get the value, formating it correctly. If the preference is not of the string type or not found, it will return an empty list.
|
|
Set the value to be the supplied boolean. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|
|
Set the value to be the supplied booleans. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|
|
Set the value to be the supplied doule. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|
|
Set the value to be the supplied doubles. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|
|
Set the value to be the supplied integer. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|
|
Set the value to be the supplied integers. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|
|
Set the value to be the supplied std::string. If 'append' is true, a copy of this instance with the supplied value will be created and added to the ArPreferences.
|