]>
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> | |
bbcdf8bc | 9 | // Licence: wxWindows licence |
45c28815 VZ |
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 | ||
6c905cb7 | 27 | class WXDLLEXPORT wxRegConfig : public wxConfigBase |
45c28815 VZ |
28 | { |
29 | public: | |
30 | // ctor & dtor | |
18244936 | 31 | // will store data in HKLM\appName and HKCU\appName |
a7ee1343 VZ |
32 | wxRegConfig(const wxString& appName = "", const wxString& vendorName = "", |
33 | const wxString& localFilename = "", const wxString& globalFilename = "", | |
34 | long style = 0); | |
18244936 | 35 | |
45c28815 VZ |
36 | // dtor will save unsaved data |
37 | virtual ~wxRegConfig(); | |
38 | ||
39 | // implement inherited pure virtual functions | |
40 | // ------------------------------------------ | |
41 | ||
42 | // path management | |
43 | virtual void SetPath(const wxString& strPath); | |
44 | virtual const wxString& GetPath() const { return m_strPath; } | |
45 | ||
8f494e5d VZ |
46 | // entry/subgroup info |
47 | // enumerate all of them | |
48 | virtual bool GetFirstGroup(wxString& str, long& lIndex) const; | |
49 | virtual bool GetNextGroup (wxString& str, long& lIndex) const; | |
50 | virtual bool GetFirstEntry(wxString& str, long& lIndex) const; | |
51 | virtual bool GetNextEntry (wxString& str, long& lIndex) const; | |
45c28815 | 52 | |
8f494e5d | 53 | // tests for existence |
6d833566 VZ |
54 | virtual bool HasGroup(const wxString& strName) const; |
55 | virtual bool HasEntry(const wxString& strName) const; | |
61ba49f2 | 56 | virtual EntryType GetEntryType(const wxString& name) const; |
6d833566 | 57 | |
a37e8836 JS |
58 | // get number of entries/subgroups in the current group, with or without |
59 | // it's subgroups | |
3cda6353 VZ |
60 | virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const; |
61 | virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const; | |
a37e8836 | 62 | |
45c28815 | 63 | // read/write |
18244936 JS |
64 | bool Read(const wxString& key, wxString *pStr) const; |
65 | bool Read(const wxString& key, wxString *pStr, const wxString& szDefault) const; | |
66 | bool Read(const wxString& key, long *plResult) const; | |
67 | ||
68 | // The following are necessary to satisfy the compiler | |
69 | wxString Read(const wxString& key, const wxString& defVal) const | |
a7ee1343 | 70 | { return wxConfigBase::Read(key, defVal); } |
18244936 | 71 | bool Read(const wxString& key, long *pl, long defVal) const |
a7ee1343 | 72 | { return wxConfigBase::Read(key, pl, defVal); } |
dfad0599 JS |
73 | bool Read(const wxString& key, int *pi, int defVal) const |
74 | { return wxConfigBase::Read(key, pi, defVal); } | |
75 | bool Read(const wxString& key, int *pi) const | |
76 | { return wxConfigBase::Read(key, pi); } | |
18244936 | 77 | long Read(const wxString& key, long defVal) const |
a7ee1343 | 78 | { return wxConfigBase::Read(key, defVal); } |
18244936 | 79 | bool Read(const wxString& key, double* val) const |
a7ee1343 | 80 | { return wxConfigBase::Read(key, val); } |
18244936 | 81 | bool Read(const wxString& key, double* val, double defVal) const |
a7ee1343 | 82 | { return wxConfigBase::Read(key, val, defVal); } |
18244936 JS |
83 | |
84 | bool Write(const wxString& key, const wxString& szValue); | |
85 | bool Write(const wxString& key, long lValue); | |
86 | ||
cf447356 | 87 | virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; } |
45c28815 | 88 | |
5d1902d6 VZ |
89 | // rename |
90 | virtual bool RenameEntry(const wxString& oldName, const wxString& newName); | |
91 | virtual bool RenameGroup(const wxString& oldName, const wxString& newName); | |
92 | ||
45c28815 | 93 | // delete |
18244936 JS |
94 | virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso); |
95 | virtual bool DeleteGroup(const wxString& key); | |
45c28815 VZ |
96 | virtual bool DeleteAll(); |
97 | ||
98 | private: | |
fd3f686c VZ |
99 | // no copy ctor/assignment operator |
100 | wxRegConfig(const wxRegConfig&); | |
101 | wxRegConfig& operator=(const wxRegConfig&); | |
102 | ||
45c28815 VZ |
103 | // these keys are opened during all lifetime of wxRegConfig object |
104 | wxRegKey m_keyLocalRoot, m_keyLocal, | |
105 | m_keyGlobalRoot, m_keyGlobal; | |
106 | ||
107 | // current path (not '/' terminated) | |
108 | wxString m_strPath; | |
109 | }; | |
110 | ||
cf447356 | 111 | #endif //_REGCONF_H |