Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cIniMap.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cIniMap_H
6 #define _INC_cIniMap_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "cIniBase.h"
12 #include "cAtom.h"
13 #include "cArraySort.h"
14 
15 namespace Gray
16 {
18  {
24 
25  public:
28  public:
30  {
31  }
33  : m_aKey(aKey), m_sVal(sVal)
34  {
35  }
36  ATOMCODE_t get_HashCode() const noexcept
37  {
38  return m_aKey.get_HashCode();
39  }
40  bool operator == (const cIniKeyValue& e) const noexcept
41  {
42  return e.get_HashCode() == get_HashCode();
43  }
44 
45  // Type conversion
46  HRESULT GetValInt(int* piValue) const;
47  HRESULT GetValDouble(double* pdValue) const;
48  };
49 
51  : public IIniBaseSetter
52  , public IIniBaseGetter
53  , public IIniBaseEnumerator
54  , public cArraySortStructHash<cIniKeyValue>
55  //, public IIniObjectWriteN
56  {
62 
63  public:
65  {
66  }
67  virtual ~cIniMap()
68  {
69  }
70 
71  ITERATE_t Find(const IniChar_t* pszPropTag) const;
72  const IniChar_t* GetVal(const IniChar_t* pszPropTag) const;
73  HRESULT SetVal(const IniChar_t* pszPropTag, cStringI sValue);
74 
75  virtual HRESULT PropSet(const IniChar_t* pszPropTag, const IniChar_t* pszValue) override;
76  virtual HRESULT PropGet(const IniChar_t* pszPropTag, OUT cStringI& rsValue) const override;
77  virtual HRESULT PropEnum(IPROPIDX_t ePropIdx, OUT cStringI& rsValue, cStringI* psKey = nullptr) const override;
78 
79  void SetCopy(const cIniMap& rAttribs);
80 
81  // Type conversion get/set
82  HRESULT GetValInt(const IniChar_t* pszPropTag, int* piValue) const;
83  HRESULT GetValDouble(const IniChar_t* pszPropTag, double* pdValue) const;
84  HRESULT SetValInt(const IniChar_t* pszPropTag, int iVal);
85  };
86 };
87 
88 #endif
#define GRAYCORE_LINK
Definition: GrayCore.h:47
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cArraySort.h:363
Definition: cAtom.h:63
ATOMCODE_t get_HashCode() const noexcept
Definition: cAtom.h:112
Definition: cIniMap.h:18
cIniKeyValue(cAtomRef aKey, cStringI sVal)
Definition: cIniMap.h:32
ATOMCODE_t get_HashCode() const noexcept
Definition: cIniMap.h:36
cIniKeyValue()
Definition: cIniMap.h:29
cAtomRef m_aKey
property key name.
Definition: cIniMap.h:26
cStringI m_sVal
property value as a string.
Definition: cIniMap.h:27
Definition: cIniMap.h:56
virtual ~cIniMap()
Definition: cIniMap.h:67
cIniMap()
Definition: cIniMap.h:64
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
HASHCODE32_t ATOMCODE_t
Encode a atom as a 32 bit hashcode instead of using its name/pointer. StrT::GetHashCode32()
Definition: cAtom.h:18
int ITERATE_t
like size_t but signed
Definition: Index.h:28
char IniChar_t
char format even on UNICODE system! Screw M$, INI files should ALWAYS have UTF8 contents
Definition: cIniBase.h:17
int IPROPIDX_t
enumerate known properties for some interface/object/class. similar to SCRIPTPROPID_t
Definition: cIniBase.h:16
bool operator==(const cTimeDouble &dt1, const cTimeDouble &dt2)
Definition: cTimeDouble.h:250
Definition: cIniBase.h:35
Definition: cIniBase.h:28
Definition: cIniBase.h:21