UA Server SDK C++ Bundle  1.4.1.271
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
UaSettingsSection Class Reference

The UaSettingsSection class provides persistent platform-independent application settings. More...

#include <uasettingssection.h>

Public Member Functions

 UaSettingsSection (const UaUniString &sGroup)
 Construction with value. More...
 
 ~UaSettingsSection ()
 destruction
 
bool removeKey (const UaUniString &sKey)
 This method removes a given key sKey from the map. More...
 
void setValue (const UaUniString &sKey, const UaUniString &sValue)
 Writes a new value sValue with the given key sKey into the map. More...
 
UaUniString getValue (const UaUniString &sKey, const UaUniString &sDefaultValue)
 This method iterates over all key-value pairs in the map and searches for the wanted value of the given key sKey. More...
 
bool contains (const UaUniString &sKey)
 Checks if the key sKey is existing in the section. More...
 
UaSettingsSectionfindSettingsSection (const UaUniString &sGroup)
 This method will return the actual section of the map. More...
 
void addSettingsSubSection (UaSettingsSection *pSubSection)
 Adds a new subsection to the map. More...
 
void setParentSection (UaSettingsSection *pParent)
 Sets the parent section to remember it if there is a subsection. More...
 
UaSettingsSectiongetParentSection ()
 Getter method for the parent section. More...
 
void getAllSubSections (UaUniStringList *sList, int *index, const UaUniString &sPrefix)
 Get the subsections (if available) for all sections of the INI file. More...
 
void getAllSubKeys (UaUniStringList *sList, int *index, const UaUniString &sPrefix)
 Get the subkeys (if available) for all sections of the INI file. More...
 
void getAllKeyValueStrings (UaUniStringList *sList, int *index, const UaUniString &sPrefix)
 Get the subsections (if available) for all sections of the INI file. More...
 
void getKeyValuePairs (UaUniStringList *sList, int *index, const UaUniString &sPrefix)
 Get the "key" and "value" for the INI file. More...
 
UaUniString getGroup ()
 Getter method for the actual group/section. More...
 

Detailed Description

The UaSettingsSection class provides persistent platform-independent application settings.

UaSettingsSection is a classical helper class to create the information needed for the class UaSettings. This class looks after the correct handling of the (sub) sections, keys and values needed to create an INI file. All information which will be written to the file is kept in the memory during runtime and will be written into a file when the object will be destroyed.

Constructor & Destructor Documentation

UaSettingsSection::UaSettingsSection ( const UaUniString sGroup)

Construction with value.

Parameters
sGroupthe name of a section to write into the map.

Member Function Documentation

void UaSettingsSection::addSettingsSubSection ( UaSettingsSection pSubSection)

Adds a new subsection to the map.

This subsection is another child of the actual section set in the map of the UaSettings class.

Parameters
pSubSectionthe actual subsection of the primary section.
bool UaSettingsSection::contains ( const UaUniString sKey)

Checks if the key sKey is existing in the section.

Parameters
sKeythe key to search for.
Returns
True if the key exists, false otherwise.
UaSettingsSection * UaSettingsSection::findSettingsSection ( const UaUniString sGroup)

This method will return the actual section of the map.

If there is no section found NULL will be returned.

Parameters
sGroupthe section to find in the map.
Returns
NULL if the wanted section sGroup was not found, otherwise the found section sGroup.
void UaSettingsSection::getAllKeyValueStrings ( UaUniStringList sList,
int *  index,
const UaUniString sPrefix 
)

Get the subsections (if available) for all sections of the INI file.

After getting the actual subsection - get its key-value pairs (if available).

Parameters
sList[out] the list where to write all subsections in.
index[out] the index for writing in the correct area.
sPrefix[in] the prefix "/" to separate the subsections from the key-value pair.
void UaSettingsSection::getAllSubKeys ( UaUniStringList sList,
int *  index,
const UaUniString sPrefix 
)

Get the subkeys (if available) for all sections of the INI file.

Parameters
sList[out] the list where to write all subsections in.
index[out] the index for writing in the correct area.
sPrefix[in] the prefix "/" to separate the subsections from the key-value pair.
void UaSettingsSection::getAllSubSections ( UaUniStringList sList,
int *  index,
const UaUniString sPrefix 
)

Get the subsections (if available) for all sections of the INI file.

Parameters
sList[out] the list where to write all subsections in.
index[out] the index for writing in the correct area.
sPrefix[in] the prefix "/" to separate the subsections from the key-value pair.
UaUniString UaSettingsSection::getGroup ( )

Getter method for the actual group/section.

Needed to get the actual section name.

Returns
the actual section name.
void UaSettingsSection::getKeyValuePairs ( UaUniStringList sList,
int *  index,
const UaUniString sPrefix 
)

Get the "key" and "value" for the INI file.

These keys and values also represent the key and value structure in a map.

Parameters
sList[out] the list where to write all key values of in.
index[out] the index for writing in the correct area.
sPrefix[in] the prefix "/" to separate the subsections from the key-value pair.
UaSettingsSection * UaSettingsSection::getParentSection ( )

Getter method for the parent section.

Needed to get the parent of a subsection.

Returns
a pointer to the parent section.
UaUniString UaSettingsSection::getValue ( const UaUniString sKey,
const UaUniString sDefaultValue 
)

This method iterates over all key-value pairs in the map and searches for the wanted value of the given key sKey.

Parameters
sKeythe key to search its value for.
sDefaultValuethe default value to return if the wanted value was not found.
Returns
Either the found value or the default value if the wanted value was not found.
bool UaSettingsSection::removeKey ( const UaUniString sKey)

This method removes a given key sKey from the map.

Parameters
sKeythe key to remove.
Returns
true if the key was successfully removed, false if not.
void UaSettingsSection::setParentSection ( UaSettingsSection pParent)

Sets the parent section to remember it if there is a subsection.

Parameters
pParentthe pointer to the parent section.
void UaSettingsSection::setValue ( const UaUniString sKey,
const UaUniString sValue 
)

Writes a new value sValue with the given key sKey into the map.

It is not allowed to write the same key more than one time in the same section into the map.

Parameters
sKeythe key to write into the map.
sValuethe value of the given key to write into the map.

The documentation for this class was generated from the following files: