ADTF
cStringMap

String map class. More...

Public Member Functions

 cStringMap ()
 Constructor that initializes an empty cStringMap object.
 
 cStringMap (const cStringMap &Map)
 Constructor that duplicates an existing string map. More...
 
virtual ~cStringMap ()
 Destructor.
 
tVoid Clear ()
 This function cleans up the map and frees all allocated memory blocks.
 
tBool Set (const cString &strKey, const cString &strString)
 This function stores a string value to the map. More...
 
tBool Delete (const cString &strKey)
 This function removes one item from the map. More...
 
tBool Copy (const cStringMap &Map)
 This function assigns an existing string map the cStringMap object. More...
 
tInt32 GetItemCount () const
 This function returns the number of items the map contains. More...
 
cString Get (const cString &strKey, const cString &strDefault=cString()) const
 This function retrieves a string value from the list. More...
 
tBool Get (tInt32 nIdx, cString &strKey, cString &strValue) const
 This function retrieves both the key and the string value from the list. More...
 
cString Join (const cString &strSeparator, const cString &strSeparator2=cString(), const cString &strQuoteChar=cString()) const
 This function concatenates all list elements to one single cString object. More...
 
cStringoperator[] (const cString &strKey)
 This function retrieves a string value from the list. More...
 
cStringoperator[] (tInt32 nIdx)
 Use this function to access single elements of the map. More...
 
tBool IsEmpty () const
 This function checks if the string map object is empty. More...
 
cStringMapoperator= (const cStringMap &Map)
 The cStringMap assignment (=) operator reinitializes existing string maps with an existing object. More...
 

Protected Member Functions

tVoid Initialize ()
 Initializes the cStringMap object. More...
 
cStringGetRef (const cString &strKey)
 Use this function to find elements in the map. More...
 
cStringGetRef (tInt32 nIdx)
 Use this function to find elements in the map. More...
 

Protected Attributes

tStringMap m_Map
 Internally used string map.
 

Private Types

typedef std::map< cString, cString, cStringCompareFunctStringMap
 definition of string maps containing cStrings for key and value
 

Detailed Description

String map class.

Definition at line 19 of file stringmap.h.

Constructor & Destructor Documentation

◆ cStringMap()

cStringMap ( const cStringMap Map)

Constructor that duplicates an existing string map.

Parameters
Map[in] Map object to be copied.

Member Function Documentation

◆ Copy()

tBool Copy ( const cStringMap Map)

This function assigns an existing string map the cStringMap object.

Parameters
Map[in] Map object to be copied.
Returns
True, if everything was ok, otherwise tFalse.

◆ Delete()

tBool Delete ( const cString strKey)

This function removes one item from the map.

Parameters
strKey[in] Key of map entry to be deleted.
Returns
Returns tTrue, if the item specified by strKey was found and removed, otherwise tFalse.

◆ Get() [1/2]

cString Get ( const cString strKey,
const cString strDefault = cString() 
) const

This function retrieves a string value from the list.

Parameters
strKey[in] Key value of string to be fetched.
strDefault[in] Default value that is returned if the element was not found (default is an empty string).
Returns
The function creates a cString object that is initialized with the contents of the referenced map item.

◆ Get() [2/2]

tBool Get ( tInt32  nIdx,
cString strKey,
cString strValue 
) const

This function retrieves both the key and the string value from the list.

Parameters
nIdx[in] Zero-based index of map item.
strKey[out] Buffer for key value to be fetched.
strValue[out] Buffer for string value to be fetched.
Returns
Returns tTrue, if the item was found, otherwise tFalse.

◆ GetItemCount()

tInt32 GetItemCount ( ) const

This function returns the number of items the map contains.

Returns
Returns the number of map items.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ GetRef() [1/2]

cString& GetRef ( const cString strKey)
protected

Use this function to find elements in the map.

Parameters
strKey[in] Key value of string to be fetched.
Returns
Reference to string map element.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ GetRef() [2/2]

cString& GetRef ( tInt32  nIdx)
protected

Use this function to find elements in the map.

Parameters
nIdx[in] Zero-based index of map item.
Returns
Reference to string map element.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Initialize()

tVoid Initialize ( )
protected

Initializes the cStringMap object.

Returns
void

◆ IsEmpty()

tBool IsEmpty ( ) const

This function checks if the string map object is empty.

Returns
tBool value that is true, if the string map object has no elements.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Join()

cString Join ( const cString strSeparator,
const cString strSeparator2 = cString(),
const cString strQuoteChar = cString() 
) const

This function concatenates all list elements to one single cString object.

The strings are separated by a separator string.

Parameters
strSeparator[in] Separator string between two key/value pairs
strSeparator2[in] Separator string between key/value
strQuoteChar[in] String that wraps both key and value
Returns
The function creates a cString object that is initialized with the concatenated map content.

◆ operator=()

cStringMap& operator= ( const cStringMap Map)

The cStringMap assignment (=) operator reinitializes existing string maps with an existing object.

Parameters
Map[in] Map object to be copied.
Returns
Reference to cStringMap object.

◆ operator[]() [1/2]

cString& operator[] ( const cString strKey)

This function retrieves a string value from the list.

Parameters
strKey[in] Key value of string to be fetched.
Returns
The function creates a cString object that is initialized with the contents of the referenced map item.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ operator[]() [2/2]

cString& operator[] ( tInt32  nIdx)

Use this function to access single elements of the map.

Parameters
nIdx[in] Zero-based index of map item.
Returns
Reference to string map element.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Set()

tBool Set ( const cString strKey,
const cString strString 
)

This function stores a string value to the map.

Parameters
strKey[in] Key value of the element to be written to.
strString[in] Value that is to be written to the map.
Returns
The function returns tTrue, if the operation succeeded, and tFalse otherwise.