UaSettingsSection Class Reference
[UA Base Library Classes]

#include <uasettingssection.h>

Collaboration diagram for UaSettingsSection:

List of all members.

Public Member Functions

 UaSettingsSection (const UaUniString &sGroup)
 ~UaSettingsSection ()
bool removeKey (const UaUniString &sKey)
void setValue (const UaUniString &sKey, const UaUniString &sValue)
UaUniString getValue (const UaUniString &sKey, const UaUniString &sDefaultValue)
bool contains (const UaUniString &sKey)
UaSettingsSectionfindSettingsSection (const UaUniString &sGroup)
void addSettingsSubSection (const UaUniString &sGroup, UaSettingsSection *pSubSection)
void setParentSection (UaSettingsSection *pParent)
UaSettingsSectiongetParentSection ()
void getAllSubSections (UaUniStringList *sList, int *index, UaUniString sPrefix)
void getAllSubKeys (UaUniStringList *sList, int *index, UaUniString sPrefix)
void getAllKeyValueStrings (UaUniStringList *sList, int *index, UaUniString sPrefix)
void getKeyValuePairs (UaUniStringList *sList, int *index, UaUniString sPrefix)
UaUniString getGroup ()

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 holded 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.
UaSettingsSection::~UaSettingsSection (  )

destruction


Member Function Documentation

void UaSettingsSection::addSettingsSubSection ( const UaUniString sGroup,
UaSettingsSection pSubSection 
)

Add s a new sub section to the map. This sub section is another child of the actual section set in the map of the UaSettings class.

Parameters:
sGroupthe actual group / section where the subsection should be added.
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,
UaUniString  sPrefix 
)

Get the sub sections (if available) for all sections of the ini file. After getting the actual sub section - get its key - value pairs (if available).

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

Get the sub keys (if available) for all sections of the ini file.

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

Get the sub sections (if available) for all sections of the ini file.

Parameters:
sList[out] the list where to write all sub sections in.
index[out] the index for writting 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,
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 writting 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 sub section.

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

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:
  • /home/buildbot/work/uasdkcpp/src/uabase/uabasecpp/uasettingssection.h
  • /home/buildbot/work/uasdkcpp/src/uabase/uabasecpp/uasettingssection.cpp