ADTF  3.18.2
variantmap.h
Go to the documentation of this file.
1 
7 #ifndef _VARIANTMAP_CLASS_HEADER_
8 #define _VARIANTMAP_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
13 #ifdef WIN32
14  #pragma warning(disable:4251)
15  #pragma warning(disable:4786)
16 #endif // WIN32
17 
18 class cVariant;
19 
21 
22 
28 class DOEXPORT cVariantMap
29 {
31 
32  typedef std::map<cString, cVariant, cStringCompareFunc> tVariantMap;
33 
34 
35  protected:
36  tVariantMap m_Map;
37 
38  public:
39 
46 
54  cVariantMap(const cVariantMap& Map);
55 
61  virtual ~cVariantMap();
62 
70 
81  tResult Set(const cString& sKey, const cVariant& vVariant);
82 
93  tResult Delete(const cString& sKey);
94 
104  tResult Copy(const cVariantMap& Map);
105 
115 
128  cVariant Get(const cString& sKey, const cVariant& vDefault = cVariant::vEmpty) const;
129 
141  tResult Get(tSize nIdx, cString& sKey, cVariant& vValue) const;
142 
153  tBool IsEmpty() const;
154 
167 
179  cVariant& operator[](const cString& sKey);
180 
193 
194  protected:
201 
212  cVariant& GetRef(const cString& sKey);
213 
225 
226 };
227 
228 } // namespace A_UTILS_NS
229 
230 #endif // _VARIANTMAP_CLASS_HEADER_
void tVoid
The tVoid is always the definition for the void (non-type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
size_t tSize
type definition for a array size values, map size values etc.
Type of map of strings to objects of type cVariant.
Definition: variantmap.h:29
tResult Copy(const cVariantMap &Map)
This function assigns an existing variant map the cVariantMap object.
cVariant & GetRef(const cString &sKey)
This function retrieves a variant value reference from the list.
tVoid Initialize()
Initializes the cVariantMap object.
cVariant & operator[](const cString &sKey)
This function retrieves a variant value from the list.
tResult Delete(const cString &sKey)
This function removes one item from the map.
tVariantMap m_Map
The variant map.
Definition: variantmap.h:36
cVariantMap()
Constructor that initializes an empty cVariantMap object.
tResult Set(const cString &sKey, const cVariant &vVariant)
This function stores a string value to the map.
tResult Get(tSize nIdx, cString &sKey, cVariant &vValue) const
This function retrieves both the key and the string value from the list.
cVariantMap & operator=(const cVariantMap &Map)
The cVariantMap assignment (=) operator reinitializes existing variant maps with an existing object.
tVoid Clear()
This function cleans up the map and frees all allocated memory blocks.
tSize GetItemCount() const
This function returns the number of items the map contains.
tBool IsEmpty() const
Check if map is empty.
cVariant & operator[](tSize nIdx)
This function retrieves a variant value from the list.
cVariant Get(const cString &sKey, const cVariant &vDefault=cVariant::vEmpty) const
This function retrieves a string value from the list.
cVariant & GetRef(tSize nIdx)
This function retrieves a variant value reference from the list.
virtual ~cVariantMap()
Destructor.
cVariantMap(const cVariantMap &Map)
Constructor that duplicates an existing variant map.
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11