]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/regconf.h
wxLogWindoe changed again: now takes a parent frame in ctor
[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 wxRegConfig : public wxConfigBase
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
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;
49
50 // tests for existence
51 virtual bool HasGroup(const wxString& strName) const;
52 virtual bool HasEntry(const wxString& strName) const;
53
54 // get number of entries/subgroups in the current group, with or without
55 // it's subgroups
56 virtual uint GetNumberOfEntries(bool bRecursive = FALSE) const;
57 virtual uint GetNumberOfGroups(bool bRecursive = FALSE) const;
58
59 // read/write
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;
63 virtual bool Write(const char *szKey, const char *szValue);
64 virtual bool Write(const char *szKey, long Value);
65 virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; }
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
81 #endif //_REGCONF_H