ADTF  3.18.4
registry.h
Go to the documentation of this file.
1 
7 #ifndef _REGISTRY_CLASS_HEADER_
8 #define _REGISTRY_CLASS_HEADER_
9 
10 #ifdef WIN32
11 
12 namespace A_UTILS_NS
13 {
14 
16 typedef tHandle tRegistryKey;
17 
19 typedef enum
20 {
21  REG_Query = 0x0001,
22  REG_Read = 0x0002,
23  REG_Write = 0x0004,
24  REG_ReadWrite = 0x0006, // same as REG_Read | REG_Write
25  REG_AllAccess = 0x000F
26 } tRegistryAccessMode;
27 
33 class DOEXPORT cRegistry
34 {
35  A_UTILS_D(cRegistry);
36 
37  public:
38  static const tRegistryKey hKEY_CLASSES_ROOT;
39  static const tRegistryKey hKEY_CURRENT_USER;
40  static const tRegistryKey hKEY_LOCAL_MACHINE;
41  static const tRegistryKey hKEY_USERS;
42  static const tRegistryKey hKEY_CURRENT_CONFIG;
43 
44  static const cString strKEY_SOFTWARE;
45  static const cString strKEY_SOFTWARE_AEV;
46 
47  static const tInt32 nTYPE_STRING;
48  static const tInt32 nTYPE_NUMBER;
49  static const tInt32 nTYPE_BINARY;
50 
51  protected:
52  tRegistryKey m_hKey;
53 
54  public:
58  cRegistry();
62  virtual ~cRegistry();
63 
72  tBool Open(tRegistryKey hKey, const cFilename& strSubKey, tUInt32 ui32Mode=-1, tBool bCreateIfNotExist=tFalse);
76  tVoid Close();
81  tBool IsOpen() const;
82 
87  tRegistryKey GetKey() const;
88 
95  tBool Set (const cString& strName, const cString& strValue) const;
102  tBool SetBool (const cString& strName, tBool bValue) const;
109  tBool SetInt (const cString& strName, int iValue) const;
116  tBool SetInt32 (const cString& strName, tInt32 i32Value) const;
123  tBool SetFloat64 (const cString& strName, tFloat64 f64Value) const;
124 
131  cString Get (const cString& strName, const cString& strDefault = cString::Empty) const;
132 
141  tBool GetBool (const cString& strName, tBool bDefault = false) const;
142 
151  int GetInt (const cString& strName, int nDefault = 0) const;
152 
159  tInt32 GetInt32 (const cString& strName, tInt32 i32Default = 0) const;
160 
167  tFloat64 GetFloat64 (const cString& strName, tFloat64 f64Default = 0.0) const;
168 
169  public:
178  static cString Get(tRegistryKey hKey, const cFilename& strSubKey, const cString& strName, const cString& strDefault=cString::Empty);
187  static tBool Set(tRegistryKey hKey, const cFilename& strSubKey, const cString& strName, const cString& strValue);
188 
189  protected:
200  tBool ReadRegKeyImpl(const cString &strValueName, tVoid **ppvRet, tInt32 nType, tInt32 *nErrorCode=nullptr) const;
211  tBool WriteRegKeyImpl(const cString &strValueName, const void* pData, tUInt32 nDataLength, tInt32 nType) const;
212 };
213 
214 } // namespace A_UTILS_NS
215 
216 #endif // WIN32
217 
218 #endif // _REGISTRY_CLASS_HEADER_
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type).
void tVoid
The tVoid is always the definition for the void (non-type).
tVoid * tHandle
type definition for a handle value (platform and compiler dependent type).
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
static const _myType Empty
Internally used empty string.
Definition: string.h:54
#define tFalse
Value for tBool.
Definition: constants.h:60
#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
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778