Pyro higlevel API
Classes | Public Member Functions | List of all members
os::Settings Class Reference

Utility class for storage of user settings and preferences. More...

Inheritance diagram for os::Settings:
os::Message

Classes

class  Private
 

Public Member Functions

 Settings ()
 Default constructor. More...
 
 Settings (SeekableIO *pcFile)
 Constructor. More...
 
 ~Settings ()
 
status_t Load (void)
 Load settings. More...
 
status_t Save (void) const
 Save settings. More...
 
Settingsoperator= (const Settings &cSource)
 Copy a Settings object. More...
 
Settingsoperator= (const Message &cSource)
 Set Message data. More...
 
Path GetPath () const
 Get directory path. More...
 
File GetFile () const
 Get filename. More...
 
void SetPath (Path *pcPath)
 Set directory path. More...
 
void SetFile (SeekableIO *pcFile)
 Set file. More...
 
void SetFile (String cFilename)
 Set filename. More...
 
String GetString (const char *pzName, const char *pzDefault="", int nIndex=0) const
 Get a string. More...
 
int8 GetInt8 (const char *pzName, int8 nDefault, int nIndex=0) const
 Get an integer. More...
 
int16 GetInt16 (const char *pzName, int16 nDefault, int nIndex=0) const
 Get an integer. More...
 
int32 GetInt32 (const char *pzName, int32 nDefault, int nIndex=0) const
 Get an integer. More...
 
int64 GetInt64 (const char *pzName, int64 nDefault, int nIndex=0) const
 Get an integer. More...
 
bool GetBool (const char *pzName, bool bDefault, int nIndex=0) const
 Get a boolean. More...
 
float GetFloat (const char *pzName, float vDefault, int nIndex=0) const
 Get a float. More...
 
double GetDouble (const char *pzName, double vDefault, int nIndex=0) const
 Get a double. More...
 
Rect GetRect (const char *pzName, const Rect &cDefault, int nIndex=0) const
 Get a Rect. More...
 
IRect GetIRect (const char *pzName, const IRect &cDefault, int nIndex=0) const
 Get an IRect. More...
 
Point GetPoint (const char *pzName, const Point &cDefault, int nIndex=0) const
 Get a Point. More...
 
IPoint GetIPoint (const char *pzName, const IPoint &cDefault, int nIndex=0) const
 Get an IPoint. More...
 
Color32_s GetColor32 (const char *pzName, const Color32_s &cDefault, int nIndex=0) const
 Get a Color32_s. More...
 
Variant GetVariant (const char *pzName, const Variant &cDefault, int nIndex=0) const
 Get a Variant. More...
 
status_t SetData (const char *pzName, int nType, const void *pData, uint32 nSize, int nIndex=0, bool bFixedSize=true, int nMaxCountHint=1)
 Change a data member. More...
 
status_t SetString (const char *pzName, const String &cValue, int nIndex=0)
 Add or change a string member. More...
 
status_t SetInt8 (const char *pzName, int8 cValue, int nIndex=0)
 Add or change an int8 member. More...
 
status_t SetInt16 (const char *pzName, int16 cValue, int nIndex=0)
 Add or change an int16 member. More...
 
status_t SetInt32 (const char *pzName, int32 cValue, int nIndex=0)
 Add or change an int32 member. More...
 
status_t SetInt64 (const char *pzName, int64 cValue, int nIndex=0)
 Add or change an int64 member. More...
 
status_t SetBool (const char *pzName, bool cValue, int nIndex=0)
 Add or change a bool member. More...
 
status_t SetFloat (const char *pzName, float cValue, int nIndex=0)
 Add or change a float member. More...
 
status_t SetDouble (const char *pzName, double cValue, int nIndex=0)
 Add or change a double member. More...
 
status_t SetRect (const char *pzName, const Rect &cValue, int nIndex=0)
 Add or change an Rect member. More...
 
status_t SetIRect (const char *pzName, const IRect &cValue, int nIndex=0)
 Add or change an IRect object member. More...
 
status_t SetPoint (const char *pzName, const Point &cValue, int nIndex=0)
 Add or change a Point object member. More...
 
status_t SetIPoint (const char *pzName, const IPoint &cValue, int nIndex=0)
 Add or change an IPoint object member. More...
 
status_t SetColor32 (const char *pzName, const Color32_s &cValue, int nIndex=0)
 Add or change a Color32_s object member. More...
 
status_t SetMessage (const char *pzName, const Message &cValue, int nIndex=0)
 Add or change a message object member. More...
 
status_t SetVariant (const char *pzName, const Variant &cValue, int nIndex=0)
 Add or change a Variant member. More...
 
- Public Member Functions inherited from os::Message
 Message (int nCode=0)
 Constructor. More...
 
 Message (const Message &cMsg)
 Copy constructor. More...
 
 Message (const void *pFlattenedData)
 Construct a message from a "flattened" buffer. More...
 
 ~Message ()
 Destructor. More...
 
int GetCode (void) const
 
void SetCode (int nCode)
 
size_t GetFlattenedSize (void) const
 Get the required buffer size needed to "flatten" this message. More...
 
status_t Flatten (uint8 *pBuffer, size_t nSize) const
 Write the message to a flat data-blob. More...
 
status_t Unflatten (const uint8 *pBuffer)
 Reconstruct a message from a data-blob created by Flatten(). More...
 
status_t AddData (const char *pzName, int nType, const void *pData, uint32 nSize, bool bFixedSize=true, int nMaxCountHint=1)
 Add a data member to the message. More...
 
status_t AddObject (const char *pzName, const Flattenable &cVal)
 Add an object as a member of this message. More...
 
status_t AddMessage (const char *pzName, const Message *pcVal)
 Add another message object as a member of this message. More...
 
status_t AddPointer (const char *pzName, const void *pVal)
 Add a pointer to the message. More...
 
status_t AddInt8 (const char *pzName, int8 nVal)
 Add a 8-bit integer to the message. More...
 
status_t AddInt16 (const char *pzName, int16 nVal)
 Add a 16-bit integer to the message. More...
 
status_t AddInt32 (const char *pzName, int32 nVal)
 Add a 32-bit integer to the message. More...
 
status_t AddInt64 (const char *pzName, int64 nVal)
 Add a 64-bit integer to the message. More...
 
status_t AddBool (const char *pzName, bool bVal)
 Add a boolean value to the message. More...
 
status_t AddFloat (const char *pzName, float vVal)
 Add a float to the message. More...
 
status_t AddDouble (const char *pzName, double vVal)
 Add a double to the message. More...
 
status_t AddRect (const char *pzName, const Rect &cVal)
 
status_t AddIRect (const char *pzName, const IRect &cVal)
 
status_t AddPoint (const char *pzName, const Point &cVal)
 
status_t AddIPoint (const char *pzName, const IPoint &cVal)
 
status_t AddColor32 (const char *pzName, const Color32_s &cVal)
 
status_t AddString (const char *pzName, const char *pzString)
 Add a string to the message. More...
 
status_t AddString (const char *pzName, const std::string &cString)
 Add a string to the message. More...
 
status_t AddString (const char *pzName, const String &cString)
 
status_t AddVariant (const char *pzName, const Variant &cVal)
 
status_t FindData (const char *pzName, int nType, const void **ppData, size_t *pnSize, int nIndex=0) const
 
status_t FindObject (const char *pzName, Flattenable &cVal, int nIndex=0) const
 
status_t FindMessage (const char *pzName, Message *ppcVal, int nIndex=0) const
 
status_t FindPointer (const char *pzName, void **ppVal, int nIndex=0) const
 
status_t FindInt8 (const char *pzName, int8 *pnVal, int nIndex=0) const
 
status_t FindInt16 (const char *pzName, int16 *pnVal, int nIndex=0) const
 
status_t FindInt32 (const char *pzName, int32 *pnVal, int nIndex=0) const
 
status_t FindInt64 (const char *pzName, int64 *pnVal, int nIndex=0) const
 
status_t FindBool (const char *pzName, bool *pbVal, int nIndex=0) const
 
status_t FindFloat (const char *pzName, float *pvVal, int nIndex=0) const
 
status_t FindDouble (const char *pzName, double *pvVal, int nIndex=0) const
 
status_t FindRect (const char *pzName, Rect *pcVal, int nIndex=0) const
 
status_t FindIRect (const char *pzName, IRect *pcVal, int nIndex=0) const
 
status_t FindPoint (const char *pzName, Point *pcVal, int nIndex=0) const
 
status_t FindIPoint (const char *pzName, IPoint *pcVal, int nIndex=0) const
 
status_t FindColor32 (const char *pzName, Color32_s *pcVal, int nIndex=0) const
 
status_t FindString (const char *pzName, const char **pzString, int nIndex=0) const
 
status_t FindString (const char *pzName, std::string *pcString, int nIndex=0) const
 
status_t FindString (const char *pzName, String *pcString, int nIndex=0) const
 
status_t FindVariant (const char *pzName, Variant *pcVal, int nIndex=0) const
 
template<class T >
status_t FindInt (const char *pzName, T *pnVal, int nIndex=0) const
 
status_t RemoveData (const char *pzName, int nIndex=0)
 Delete an element from the message. More...
 
status_t RemoveName (const char *pzName)
 Remove all entries stored under a given name. More...
 
status_t GetNameInfo (const char *pzName, int *pnType=NULL, int *pnCount=NULL) const
 
int CountNames (void) const
 
String GetName (int nIndex) const
 
void MakeEmpty (void)
 Clear the message. More...
 
bool IsEmpty (void) const
 
bool WasDelivered (void) const
 
bool IsSourceWaiting (void) const
 
bool IsSourceRemote (void) const
 
Messenger ReturnAddress (void) const
 
bool IsReply (void) const
 
status_t SendReply (int nCode, Handler *pcReplyHandler=NULL)
 
status_t SendReply (Message *pcTheReply, Handler *pcReplyHandler=NULL, uint nTimeOut=~0)
 
status_t SendReply (int nCode, Message *pcReplyToReply)
 
status_t SendReply (Message *pcTheReply, Message *pcReplyToReply, int nSendTimOut=~0, int nReplyTimeOut=~0)
 
Messageoperator= (const Message &cOther)
 Copy the content of another message. More...
 

Detailed Description

Description:
The Settings class handles persistent storage of collections of data associated with names. You can of course also use the class to store other kinds of data. Settings is based on the very versatile name/value association mechanisms of os::Message, but it also extends the API with easy-to-use versions of the methods in os::Message, which are more suitable for managing settings.
See Also
os::Message
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

Constructor & Destructor Documentation

Settings::Settings ( )
Description:
Creates a Settings object for the current application and the current user. The default path will be "~/Settings/[Application name]/Settings".
Note
This method relies on the Application object, and the app signature passed to it. If you haven't created an Application object, you will have to specify the path manually.
See Also
Load(), Save(), os::Application
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Settings::Private::SetPath().

Settings::Settings ( SeekableIO pcFile)
Description:
Creates a Settings object bound to a specific stream object.
Parameters
pcFileSeekableIO object, e.g. os::File.
See Also
Load(), Save(), os::File, os::SeekableIO
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Settings::Private::SetIO().

Settings::~Settings ( )

Member Function Documentation

bool Settings::GetBool ( const char *  pzName,
bool  bDefault,
int  nIndex = 0 
) const
Description:
Retrieve a boolean value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindBool().

Color32_s Settings::GetColor32 ( const char *  pzName,
const Color32_s cDefault,
int  nIndex = 0 
) const
Description:
Retrieve a 32 bit colour (Color32_s) value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindColor32().

double Settings::GetDouble ( const char *  pzName,
double  vDefault,
int  nIndex = 0 
) const
Description:
Retrieve a double precision floating point value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindDouble().

File Settings::GetFile ( ) const
Description:
Returns the name of the settings file, excluding path.
See Also
GetPath()
Author
Kristian Van Der Vliet (vande.nosp@m.rs@l.nosp@m.iqwyd.nosp@m..com)
See Also
SetFile(), GetPath(), SetPath()

References os::Settings::Private::m_cFile.

float Settings::GetFloat ( const char *  pzName,
float  vDefault,
int  nIndex = 0 
) const
Description:
Retrieve a floating point value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindFloat().

int16 Settings::GetInt16 ( const char *  pzName,
int16  nDefault,
int  nIndex = 0 
) const
Description:
Retrieve a 16 bit integer value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindInt16().

int32 Settings::GetInt32 ( const char *  pzName,
int32  nDefault,
int  nIndex = 0 
) const
Description:
Retrieve a 32 bit integer value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindInt32().

int64 Settings::GetInt64 ( const char *  pzName,
int64  nDefault,
int  nIndex = 0 
) const
Description:
Retrieve a 64 bit integer value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindInt64().

int8 Settings::GetInt8 ( const char *  pzName,
int8  nDefault,
int  nIndex = 0 
) const
Description:
Retrieve an 8 bit integer value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindInt8().

IPoint Settings::GetIPoint ( const char *  pzName,
const IPoint cDefault,
int  nIndex = 0 
) const
Description:
Retrieve an IPoint value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindIPoint().

IRect Settings::GetIRect ( const char *  pzName,
const IRect cDefault,
int  nIndex = 0 
) const
Description:
Retrieve an IRect value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindIRect().

Path Settings::GetPath ( ) const
Description:
Returns the directory path to the settings file, excluding the file itself.
See Also
GetFile(), SetFile(), SetPath()
Author
Kristian Van Der Vliet (vande.nosp@m.rs@l.nosp@m.iqwyd.nosp@m..com)

References os::Settings::Private::m_cPath.

Point Settings::GetPoint ( const char *  pzName,
const Point cDefault,
int  nIndex = 0 
) const
Description:
Retrieve a Point value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindPoint().

Rect Settings::GetRect ( const char *  pzName,
const Rect cDefault,
int  nIndex = 0 
) const
Description:
Retrieve a Rect value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindRect().

String Settings::GetString ( const char *  pzName,
const char *  pzDefault = "",
int  nIndex = 0 
) const
Description:
Retrieve a string value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindString().

Variant Settings::GetVariant ( const char *  pzName,
const Variant cDefault,
int  nIndex = 0 
) const
Description:
Retrieve a Variant value from a Settings object.
Parameters
pzNameName of the item to get.
pzDefaultDefault value to return, if the item is not present in the Settings object.
nIndexIf several items with the same name exists you can use this parameter to specify which one you want.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::FindVariant().

status_t Settings::Load ( void  )
Settings & Settings::operator= ( const Settings cSource)
Description:
Copies both Message data and Path/File/Stream information.
Parameters
cSourceObject to copy from.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Settings::Private::m_bUserStream, os::Settings::Private::m_cFile, os::Settings::Private::m_cPath, os::Settings::Private::m_pcIO, and os::Message::operator=().

Settings & Settings::operator= ( const Message cSource)
Description:
Copies only Message data from cSource to this object.
Parameters
cSourceObject to copy from.
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::operator=().

status_t Settings::Save ( void  ) const
status_t Settings::SetBool ( const char *  pzName,
bool  bValue,
int  nIndex = 0 
)
Description:
Add or change a boolean value member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
bValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetBool(), SetData(), os::Message::FindBool(), os::Message::AddBool(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_BOOL.

status_t Settings::SetColor32 ( const char *  pzName,
const Color32_s cValue,
int  nIndex = 0 
)
Description:
Add or change a Color32_s object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetColor32(), SetData(), os::Message::FindColor32(), os::Message::AddColor32(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_COLOR32.

status_t Settings::SetData ( const char *  pzName,
int  nType,
const void *  pData,
uint32  nSize,
int  nIndex = 0,
bool  bFixedSize = true,
int  nMaxCountHint = 1 
)
Description:
Add or change data in the os::Message data container, upon which the settings class is based. See os::Message::AddData() for more information on the internal storage mechanism.
SetData() is a "catch all" function that can be used to add or change an untyped blob of data to the message. Normally you will use one of the other Set*() members that change a specificly typed data member but I will describe the general principle of changing members here.
When you add a member to a message (or settings object) you must give it a unique name that will later be used to lookup that member. It is possible to add multiple elements with the same name but they must then be of the same type and subsequent elements will be appended to an array associated with this name. Individual elements from the array can later be destined with the name/index pair passed to the various Get*() members.
Note
The data buffer is copied into the message and you retain ownership over it.
Parameters
pzNameThe name used to identify the member. If there already exist a member with this name in the message the new member will be appended to an array of elements under this name. It is an error to append objects with different types under the same name.
nTypeData type. This should be one of the predefined type codes. Normally you should only use this member to add T_RAW type data. All the more specific data-types should be added with one of the specialized Add*() members.
pDataPointer to the data to be add. The data will be copied into the message.
nSizeSize of the pData buffer.
nIndexArray index. Always use 0 unless you've added multiple objects under the same name. A value outside of the range of the array will cause the object to be appended to the end of the array.
bFixedSizeIf you plan to make an array of members under the same name you must let the message know if each element can have a different size. If the message know that all the elements have the same size it can optimize the data a bit by only storing the size once. It will also greatly speed up array-element lookups if each element have the same size. If all elements in an array will have the same size or if you plan to add only one member under this name bFixedSize should be true. Otherwhice it should be false.
nMaxCountHintAn estimate of how many members are going to be added to this array. If you plan to add many elements under the same name and you know up-front how many you are going to add it is a good idea to let the message know when adding the first element. The nMaxCountHint will be used to decide how much memory to be allocated for the array and if the estimate is correct it will avoid any expensive reallocations during element insertions.
Returns
On success 0 is returned. On error -1 is returned and an error code is written to the global variable errno.
See Also
os::Message::FindData(), os::Message::SetData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::AddData().

Referenced by SetBool(), SetColor32(), SetDouble(), SetFloat(), SetInt16(), SetInt32(), SetInt64(), SetInt8(), SetIPoint(), SetIRect(), SetPoint(), SetRect(), and SetString().

status_t Settings::SetDouble ( const char *  pzName,
double  vValue,
int  nIndex = 0 
)
Description:
Add or change a double precision floating point object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
vValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetFloat(), SetData(), os::Message::FindFloat(), os::Message::AddFloat(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_DOUBLE.

void Settings::SetFile ( SeekableIO pcFile)
Description:
Change the file which should be used to save and load Settings.
Parameters
pcFileThe new file.
Author
Kristian Van Der Vliet (vande.nosp@m.rs@l.nosp@m.iqwyd.nosp@m..com)
See Also
GetFile(), GetPath(), SetPath()

References os::Settings::Private::SetIO().

void Settings::SetFile ( String  cFilename)
Description:
Change the filename which should be used to save and load Settings.
Parameters
cFilenameThe new filename. The filename will be appended to the current path.
Author
Kristian Van Der Vliet (vande.nosp@m.rs@l.nosp@m.iqwyd.nosp@m..com)
See Also
GetFile(), GetPath(), SetPath()

References os::Settings::Private::m_cPath, and os::Settings::Private::SetPath().

status_t Settings::SetFloat ( const char *  pzName,
float  vValue,
int  nIndex = 0 
)
Description:
Add or change a float point value member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
vValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetFloat(), SetData(), os::Message::FindFloat(), os::Message::AddFloat(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_FLOAT.

status_t Settings::SetInt16 ( const char *  pzName,
int16  nValue,
int  nIndex = 0 
)
Description:
Add or change a 16 bit integer value.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
nValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetInt16(), SetData(), os::Message::FindInt16(), os::Message::AddInt16(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_INT16.

status_t Settings::SetInt32 ( const char *  pzName,
int32  nValue,
int  nIndex = 0 
)
Description:
Add or change a 32 bit integer value.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
nValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetInt32(), SetData(), os::Message::FindInt32(), os::Message::AddInt32(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_INT32.

status_t Settings::SetInt64 ( const char *  pzName,
int64  nValue,
int  nIndex = 0 
)
Description:
Add or change a 64 bit integer value.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
nValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetInt64(), SetData(), os::Message::FindInt64(), os::Message::AddInt64(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_INT64.

status_t Settings::SetInt8 ( const char *  pzName,
int8  nValue,
int  nIndex = 0 
)
Description:
Add or change a 8 bit integer value.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
nValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetInt8(), SetData(), os::Message::FindInt8(), os::Message::AddInt8(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_INT8.

status_t Settings::SetIPoint ( const char *  pzName,
const IPoint cValue,
int  nIndex = 0 
)
Description:
Add or change a IPoint object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetIPoint(), SetData(), os::Message::FindIPoint(), os::Message::AddIPoint(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_IPOINT.

status_t Settings::SetIRect ( const char *  pzName,
const IRect cValue,
int  nIndex = 0 
)
Description:
Add or change an IRect object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetIRect(), SetData(), os::Message::FindIRect(), os::Message::AddIRect(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_IRECT.

status_t Settings::SetMessage ( const char *  pzName,
const Message cValue,
int  nIndex = 0 
)
Description:
Add or change a message object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory to expand the message.
See Also
GetMessage(), SetData(), os::Message::FindMessage(), os::Message::AddMessage(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::AddMessage(), os::Message::Flatten(), os::Message::GetFlattenedSize(), and os::T_MESSAGE.

void Settings::SetPath ( Path pcPath)
Description:
Set directory path.
Parameters
pcPathThe new path.
Author
Kristian Van Der Vliet (vande.nosp@m.rs@l.nosp@m.iqwyd.nosp@m..com)
See Also
GetFile(), SetFile(), GetPath()

References os::Path::GetPath(), os::Settings::Private::m_cFile, and os::Settings::Private::SetPath().

status_t Settings::SetPoint ( const char *  pzName,
const Point cValue,
int  nIndex = 0 
)
Description:
Add or change a Point object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetPoint(), SetData(), os::Message::FindPoint(), os::Message::AddPoint(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_POINT.

status_t Settings::SetRect ( const char *  pzName,
const Rect cValue,
int  nIndex = 0 
)
Description:
Add or change an Rect object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetRect(), SetData(), os::Message::FindRect(), os::Message::AddRect(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References SetData(), and os::T_RECT.

status_t Settings::SetString ( const char *  pzName,
const String cValue,
int  nIndex = 0 
)
Description:
Add or change a string object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetString(), SetData(), os::Message::FindString(), os::Message::AddString(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::String::c_str(), SetData(), os::String::size(), and os::T_STRING.

status_t Settings::SetVariant ( const char *  pzName,
const Variant cValue,
int  nIndex = 0 
)
Description:
Add or change a Variant object member.
See SetData() and os::Message::AddData() for more details on how to add and change member values.
Parameters
pzNameA name uniquely identifying the object within the settings object. It is possible to add multiple objects of the same type under the same name but avoid adding different types of object under the same name. If you really need to do that, use Variants.
cValueThe data to add.
nIndexIndex to add the data to, if several objects have been added under the same name. An index outside the range of the array will add the object to the end. Leave this at 0 if you don't add multiple objects with the same name.
Returns
On success 0 is returned. On failure -1 is returned and a error code is written to the global variable errno.
Error codes:
ENOMEM Not enough memory.
See Also
GetVariant(), SetData(), os::Message::FindVariant(), os::Message::AddVariant(), os::Message::AddData(), os::Message::FindData()
Author
Henrik Isaksson (henri.nosp@m.k@bo.nosp@m.ing.n.nosp@m.u)

References os::Message::AddVariant(), os::Variant::Flatten(), os::Variant::GetFlattenedSize(), and os::T_VARIANT.