]>
Commit | Line | Data |
---|---|---|
45c28815 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: msw/regconf.h | |
8f494e5d | 3 | // Purpose: Registry based implementation of wxConfigBase |
45c28815 VZ |
4 | // Author: Vadim Zeitlin |
5 | // Modified by: | |
6 | // Created: 27.04.98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
9 | // Licence: wxWindows license | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _REGCONF_H | |
13 | #define _REGCONF_H | |
14 | ||
0d3820b3 JS |
15 | #ifdef __GNUG__ |
16 | #pragma interface "regconf.h" | |
17 | #endif | |
18 | ||
8f494e5d VZ |
19 | #ifndef _REGISTRY_H |
20 | #include <wx/msw/registry.h> | |
21 | #endif | |
22 | ||
45c28815 VZ |
23 | // ---------------------------------------------------------------------------- |
24 | // wxRegConfig | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
8f494e5d | 27 | class wxRegConfig : public wxConfigBase |
45c28815 VZ |
28 | { |
29 | public: | |
30 | // ctor & dtor | |
31 | // will store data in HKLM\strRegHive and HKCU\strRegHive | |
32 | wxRegConfig(const wxString& strRegHive); | |
33 | // dtor will save unsaved data | |
34 | virtual ~wxRegConfig(); | |
35 | ||
36 | // implement inherited pure virtual functions | |
37 | // ------------------------------------------ | |
38 | ||
39 | // path management | |
40 | virtual void SetPath(const wxString& strPath); | |
41 | virtual const wxString& GetPath() const { return m_strPath; } | |
42 | ||
8f494e5d VZ |
43 | // entry/subgroup info |
44 | // enumerate all of them | |
45 | virtual bool GetFirstGroup(wxString& str, long& lIndex) const; | |
46 | virtual bool GetNextGroup (wxString& str, long& lIndex) const; | |
47 | virtual bool GetFirstEntry(wxString& str, long& lIndex) const; | |
48 | virtual bool GetNextEntry (wxString& str, long& lIndex) const; | |
45c28815 | 49 | |
8f494e5d | 50 | // tests for existence |
6d833566 VZ |
51 | virtual bool HasGroup(const wxString& strName) const; |
52 | virtual bool HasEntry(const wxString& strName) const; | |
53 | ||
a37e8836 JS |
54 | // get number of entries/subgroups in the current group, with or without |
55 | // it's subgroups | |
8f494e5d VZ |
56 | virtual uint GetNumberOfEntries(bool bRecursive = FALSE) const; |
57 | virtual uint GetNumberOfGroups(bool bRecursive = FALSE) const; | |
a37e8836 | 58 | |
45c28815 | 59 | // read/write |
8f494e5d VZ |
60 | virtual bool Read(wxString *pStr, const char *szKey, |
61 | const char *szDefault = 0) const; | |
62 | virtual bool Read(long *result, const char *szKey, long lDefault = 0) const; | |
45c28815 VZ |
63 | virtual bool Write(const char *szKey, const char *szValue); |
64 | virtual bool Write(const char *szKey, long Value); | |
cf447356 | 65 | virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; } |
45c28815 VZ |
66 | |
67 | // delete | |
68 | virtual bool DeleteEntry(const char *szKey, bool bGroupIfEmptyAlso); | |
69 | virtual bool DeleteGroup(const char *szKey); | |
70 | virtual bool DeleteAll(); | |
71 | ||
72 | private: | |
73 | // these keys are opened during all lifetime of wxRegConfig object | |
74 | wxRegKey m_keyLocalRoot, m_keyLocal, | |
75 | m_keyGlobalRoot, m_keyGlobal; | |
76 | ||
77 | // current path (not '/' terminated) | |
78 | wxString m_strPath; | |
79 | }; | |
80 | ||
cf447356 | 81 | #endif //_REGCONF_H |