]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/regconf.h
Unicode fix.
[wxWidgets.git] / include / wx / msw / regconf.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/regconf.h
3 // Purpose: Registry based implementation of wxConfigBase
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 licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _REGCONF_H
13 #define _REGCONF_H
14
15 #ifdef __GNUG__
16 #pragma interface "regconf.h"
17 #endif
18
19 #ifndef _REGISTRY_H
20 #include <wx/msw/registry.h>
21 #endif
22
23 // ----------------------------------------------------------------------------
24 // wxRegConfig
25 // ----------------------------------------------------------------------------
26
27 class WXDLLEXPORT wxRegConfig : public wxConfigBase
28 {
29 public:
30 // ctor & dtor
31 // will store data in HKLM\appName and HKCU\appName
32 wxRegConfig(const wxString& appName = "",
33 const wxString& vendorName = "",
34 const wxString& localFilename = "",
35 const wxString& globalFilename = "",
36 long style = 0);
37
38 // dtor will save unsaved data
39 virtual ~wxRegConfig();
40
41 // implement inherited pure virtual functions
42 // ------------------------------------------
43
44 // path management
45 virtual void SetPath(const wxString& strPath);
46 virtual const wxString& GetPath() const { return m_strPath; }
47
48 // entry/subgroup info
49 // enumerate all of them
50 virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
51 virtual bool GetNextGroup (wxString& str, long& lIndex) const;
52 virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
53 virtual bool GetNextEntry (wxString& str, long& lIndex) const;
54
55 // tests for existence
56 virtual bool HasGroup(const wxString& strName) const;
57 virtual bool HasEntry(const wxString& strName) const;
58 virtual EntryType GetEntryType(const wxString& name) const;
59
60 // get number of entries/subgroups in the current group, with or without
61 // it's subgroups
62 virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
63 virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
64
65 // read/write
66 bool Read(const wxString& key, wxString *pStr) const;
67 bool Read(const wxString& key, wxString *pStr, const wxString& szDefault) const;
68 bool Read(const wxString& key, long *plResult) const;
69
70 // The following are necessary to satisfy the compiler
71 wxString Read(const wxString& key, const wxString& defVal) const
72 { return wxConfigBase::Read(key, defVal); }
73 bool Read(const wxString& key, long *pl, long defVal) const
74 { return wxConfigBase::Read(key, pl, defVal); }
75 bool Read(const wxString& key, int *pi, int defVal) const
76 { return wxConfigBase::Read(key, pi, defVal); }
77 bool Read(const wxString& key, int *pi) const
78 { return wxConfigBase::Read(key, pi); }
79 long Read(const wxString& key, long defVal) const
80 { return wxConfigBase::Read(key, defVal); }
81 bool Read(const wxString& key, double* val) const
82 { return wxConfigBase::Read(key, val); }
83 bool Read(const wxString& key, double* val, double defVal) const
84 { return wxConfigBase::Read(key, val, defVal); }
85
86 bool Write(const wxString& key, const wxString& szValue);
87 bool Write(const wxString& key, long lValue);
88
89 virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; }
90
91 // rename
92 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
93 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
94
95 // delete
96 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso);
97 virtual bool DeleteGroup(const wxString& key);
98 virtual bool DeleteAll();
99
100 private:
101 // no copy ctor/assignment operator
102 wxRegConfig(const wxRegConfig&);
103 wxRegConfig& operator=(const wxRegConfig&);
104
105 // these keys are opened during all lifetime of wxRegConfig object
106 wxRegKey m_keyLocalRoot, m_keyLocal,
107 m_keyGlobalRoot, m_keyGlobal;
108
109 // current path (not '/' terminated)
110 wxString m_strPath;
111 };
112
113 #endif //_REGCONF_H