ADTF  3.18.2
cVariantMap

Type of map of strings to objects of type cVariant. More...

Public Member Functions

 cVariantMap ()
 Constructor that initializes an empty cVariantMap object.
 
 cVariantMap (const cVariantMap &Map)
 Constructor that duplicates an existing variant map. More...
 
virtual ~cVariantMap ()
 Destructor.
 
tVoid Clear ()
 This function cleans up the map and frees all allocated memory blocks. More...
 
tResult Set (const cString &sKey, const cVariant &vVariant)
 This function stores a string value to the map. More...
 
tResult Delete (const cString &sKey)
 This function removes one item from the map. More...
 
tResult Copy (const cVariantMap &Map)
 This function assigns an existing variant map the cVariantMap object. More...
 
tSize GetItemCount () const
 This function returns the number of items the map contains. More...
 
cVariant Get (const cString &sKey, const cVariant &vDefault=cVariant::vEmpty) const
 This function retrieves a string value from the list. More...
 
tResult Get (tSize nIdx, cString &sKey, cVariant &vValue) const
 This function retrieves both the key and the string value from the list. More...
 
tBool IsEmpty () const
 Check if map is empty. More...
 
cVariantMapoperator= (const cVariantMap &Map)
 The cVariantMap assignment (=) operator reinitializes existing variant maps with an existing object. More...
 
cVariantoperator[] (const cString &sKey)
 This function retrieves a variant value from the list. More...
 
cVariantoperator[] (tSize nIdx)
 This function retrieves a variant value from the list. More...
 

Protected Member Functions

tVoid Initialize ()
 Initializes the cVariantMap object. More...
 
cVariantGetRef (const cString &sKey)
 This function retrieves a variant value reference from the list. More...
 
cVariantGetRef (tSize nIdx)
 This function retrieves a variant value reference from the list. More...
 

Protected Attributes

tVariantMap m_Map
 The variant map.
 

Private Types

typedef std::map< cString, cVariant, cStringCompareFunctVariantMap
 

Detailed Description

Type of map of strings to objects of type cVariant.

Variant map class.

Definition at line 28 of file variantmap.h.

Constructor & Destructor Documentation

◆ cVariantMap()

cVariantMap ( const cVariantMap Map)

Constructor that duplicates an existing variant map.

Parameters
Map[in] Map object to be copied.

Member Function Documentation

◆ Clear()

tVoid Clear ( )

This function cleans up the map and frees all allocated memory blocks.

Returns
tVoid

◆ Copy()

tResult Copy ( const cVariantMap Map)

This function assigns an existing variant map the cVariantMap object.

  • Parameters
    Map[in] Map object to be copied.
    Return values
    ERR_NOERROR,ifeverything was ok

◆ Delete()

tResult Delete ( const cString sKey)

This function removes one item from the map.

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

◆ Get() [1/2]

cVariant Get ( const cString sKey,
const cVariant vDefault = cVariant::vEmpty 
) const

This function retrieves a string value from the list.

Parameters
sKey[in] Key value of string to be fetched.
vDefault[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]

tResult Get ( tSize  nIdx,
cString sKey,
cVariant vValue 
) const

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

Parameters
nIdx[in] Zero-based index of map item.
sKey[out] Buffer for key value to be fetched.
vValue[out] Buffer for variant value to be fetched.
Returns
Returns true, if the item was found, otherwise false.

◆ GetItemCount()

tSize 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]

cVariant& GetRef ( const cString sKey)
protected

This function retrieves a variant value reference from the list.

Parameters
sKey[in] Key value of string to be fetched.
Returns
The function returns a reference to the map item.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ GetRef() [2/2]

cVariant& GetRef ( tSize  nIdx)
protected

This function retrieves a variant value reference from the list.

Parameters
nIdx[in] Index of value to be fetched.
Returns
The function returns a reference to the map item.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Initialize()

tVoid Initialize ( )
protected

Initializes the cVariantMap object.

Returns
tVoid

◆ IsEmpty()

tBool IsEmpty ( ) const

Check if map is empty.

Returns
Returns true, if the map is empty.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ operator=()

cVariantMap& operator= ( const cVariantMap Map)

The cVariantMap assignment (=) operator reinitializes existing variant maps with an existing object.

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

◆ operator[]() [1/2]

cVariant& operator[] ( const cString sKey)

This function retrieves a variant value from the list.

Parameters
sKey[in] Key value of string to be fetched.
Returns
The function creates a cVariant 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]

cVariant& operator[] ( tSize  nIdx)

This function retrieves a variant value from the list.

Parameters
nIdx[in] Index of value to be fetched.
Returns
The function creates a cVariant 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

◆ Set()

tResult Set ( const cString sKey,
const cVariant vVariant 
)

This function stores a string value to the map.

Parameters
sKey[in] Key value of the element to be written to.
vVariant[in] Value that is to be written to the map.
Returns
The function returns true, if the operation succeeded, and false otherwise.