Main Page   Class Hierarchy   Compound List   Compound Members  

ArPref Class Reference

Preference instance. Used by ArPreferences. More...

#include <ArPref.h>

List of all members.

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...


Detailed Description

Preference instance. Used by ArPreferences.

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.


Member Enumeration Documentation

enum ArPref::ValType
 

Enumeration values:
Integer  integer number value.
Double  double number value.
Boolean  boolean value, expressed as 'true' or 'false' in the file.
String  a string value.


Member Function Documentation

bool ArPref::getBool void    [virtual]
 

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.

int ArPref::getBoolSet bool *    boolArray,
int    size
[virtual]
 

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.

Parameters:
boolArray  the array to fill out with the values
size  the size of the passed in array
Returns:
the number of values put into the array

double ArPref::getDouble void    [virtual]
 

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.

int ArPref::getDoubleSet double *    doubleArray,
int    size
[virtual]
 

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.

Parameters:
doubleArray  the array to fill out with the values
size  the size of the passed in array
Returns:
the number of values put into the array

int ArPref::getInt void    [virtual]
 

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.

int ArPref::getIntSet int *    intArray,
int    size
[virtual]
 

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.

Parameters:
intArray  the array to fill out with the values
size  the size of the passed in array
Returns:
the number of values put into the array

int ArPref::getSetCount   [virtual]
 

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.

std::string ArPref::getString void    [virtual]
 

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 "".

int ArPref::getStringSet std::string *    stringArray,
int    size
[virtual]
 

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.

Parameters:
stringArray  the array to fill out with the values
size  the size of the passed in array
Returns:
the number of values put into the array

bool ArPref::setBool bool    val,
bool    append = false
[virtual]
 

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.

Parameters:
val  the value to set the preference to
append  create a new instance of this preference

bool ArPref::setBoolSet bool    append,
int    count,
...   
[virtual]
 

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.

Parameters:
append  create a new instance of this preference
count  the number of values in the parameter list

bool ArPref::setDouble double    val,
bool    append = false
[virtual]
 

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.

Parameters:
val  the value to set the preference to
append  create a new instance of this preference

bool ArPref::setDoubleSet bool    append,
int    count,
...   
[virtual]
 

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.

Parameters:
append  create a new instance of this preference
count  the number of values in the parameter list

bool ArPref::setInt int    val,
bool    append = false
[virtual]
 

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.

Parameters:
val  the value to set the preference to
append  create a new instance of this preference

bool ArPref::setIntSet bool    append,
int    count,
...   
[virtual]
 

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.

Parameters:
append  create a new instance of this preference
count  the number of values in the parameter list

bool ArPref::setString const char *    val,
bool    append = false
[virtual]
 

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.

Parameters:
val  the value to set the preference to
append  create a new instance of this preference


The documentation for this class was generated from the following files:
Generated on Tue Nov 12 17:44:00 2002 for Aria by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001