Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cIniObject.h
Go to the documentation of this file.
1 //
5 //
6 #ifndef _INC_cIniObject_H
7 #define _INC_cIniObject_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cIniBase.h"
13 #include "cUnitTestDecl.h"
14 
15 namespace Gray
16 {
17  class cStreamOutput;
18 
20  {
24 
25  virtual IPROPIDX_t get_PropQty() const = 0;
26  virtual const IniChar_t* get_PropName(IPROPIDX_t ePropIdx) const = 0;
27  virtual IPROPIDX_t FindProp(const IniChar_t* pszPropTag) const = 0;
28  };
30  {
34  virtual HRESULT PropSetN(IPROPIDX_t ePropIdx, const IniChar_t* pszValue) = 0;
35  };
36 
38  : public IIniObjectDef
39  , public IIniObjectWriteN
40  , public IIniBaseSetter
41  , public IIniBaseGetter
42  , public IIniBaseEnumerator
43  {
48 
49  typedef UINT64 PROPMASK_t;
50 
51  public:
52  mutable PROPMASK_t m_nDirtyMask;
53 
54  public:
56  : m_nDirtyMask(0)
57  {
58  }
59  virtual ~cIniObject()
60  {
61  }
62 
63  inline static PROPMASK_t GetDirtyMask(IPROPIDX_t ePropIdx)
64  {
66  return(((PROPMASK_t)1) << ePropIdx);
67  }
68  void SetAllDirty()
69  {
71  ASSERT(get_PropQty() <= (IPROPIDX_t) sizeof(PROPMASK_t) * 8);
72  m_nDirtyMask = GetDirtyMask(get_PropQty()) - 1;
73  }
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 
78  HRESULT FileWriteN(cStreamOutput& sOut, IPROPIDX_t ePropIdx) const;
79  HRESULT FileWrite(cStreamOutput& sOut, const IniChar_t* pszProp);
80  HRESULT FileWriteAll(cStreamOutput& sOut);
81 
83  };
84 };
85 #endif // _INC_cIniObject_H
#define IGNORE_WARN_INTERFACE(c)
Definition: GrayCore.h:79
#define GRAYCORE_LINK
Definition: GrayCore.h:47
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cIniObject.h:43
cIniObject()
Definition: cIniObject.h:55
void SetAllDirty()
Definition: cIniObject.h:68
static PROPMASK_t GetDirtyMask(IPROPIDX_t ePropIdx)
Definition: cIniObject.h:63
virtual ~cIniObject()
Definition: cIniObject.h:59
PROPMASK_t m_nDirtyMask
bitmask of IPROPIDX_t to be written/persisted.
Definition: cIniObject.h:52
Definition: cStream.h:126
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
class __DECL_IMPORT cStreamOutput
Definition: cString.h:27
DECLARE_INTERFACE(IRandomNoise)
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
Definition: cIniBase.h:35
Definition: cIniBase.h:28
Definition: cIniBase.h:21
Definition: cIniObject.h:20
virtual IPROPIDX_t get_PropQty() const =0
virtual IPROPIDX_t FindProp(const IniChar_t *pszPropTag) const =0
virtual const IniChar_t * get_PropName(IPROPIDX_t ePropIdx) const =0
Definition: cIniObject.h:30
virtual HRESULT PropSetN(IPROPIDX_t ePropIdx, const IniChar_t *pszValue)=0