]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/regconf.h
Mattia's temp fix for cross-compiling
[wxWidgets.git] / include / wx / msw / regconf.h
CommitLineData
45c28815 1///////////////////////////////////////////////////////////////////////////////
9869734d 2// Name: msw/regconf.h
8f494e5d 3// Purpose: Registry based implementation of wxConfigBase
45c28815 4// Author: Vadim Zeitlin
9869734d 5// Modified by:
45c28815
VZ
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
1c646685 22#include <wx/object.h>
8f494e5d 23
45c28815
VZ
24// ----------------------------------------------------------------------------
25// wxRegConfig
26// ----------------------------------------------------------------------------
27
6c905cb7 28class WXDLLEXPORT wxRegConfig : public wxConfigBase
45c28815
VZ
29{
30public:
31 // ctor & dtor
18244936 32 // will store data in HKLM\appName and HKCU\appName
807a903e
VZ
33 wxRegConfig(const wxString& appName = _T(""),
34 const wxString& vendorName = _T(""),
35 const wxString& localFilename = _T(""),
36 const wxString& globalFilename = _T(""),
a7ee1343 37 long style = 0);
18244936 38
45c28815
VZ
39 // dtor will save unsaved data
40 virtual ~wxRegConfig();
41
42 // implement inherited pure virtual functions
43 // ------------------------------------------
44
45 // path management
46 virtual void SetPath(const wxString& strPath);
47 virtual const wxString& GetPath() const { return m_strPath; }
48
8f494e5d
VZ
49 // entry/subgroup info
50 // enumerate all of them
51 virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
52 virtual bool GetNextGroup (wxString& str, long& lIndex) const;
53 virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
54 virtual bool GetNextEntry (wxString& str, long& lIndex) const;
45c28815 55
8f494e5d 56 // tests for existence
6d833566
VZ
57 virtual bool HasGroup(const wxString& strName) const;
58 virtual bool HasEntry(const wxString& strName) const;
61ba49f2 59 virtual EntryType GetEntryType(const wxString& name) const;
6d833566 60
a37e8836
JS
61 // get number of entries/subgroups in the current group, with or without
62 // it's subgroups
3cda6353
VZ
63 virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
64 virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
a37e8836 65
45c28815 66 // read/write
18244936
JS
67 bool Read(const wxString& key, wxString *pStr) const;
68 bool Read(const wxString& key, wxString *pStr, const wxString& szDefault) const;
807a903e
VZ
69 wxString Read(const wxString& key, const wxString& defVal) const
70 { return wxConfigBase::Read(key, defVal); }
71
18244936 72 bool Read(const wxString& key, long *plResult) const;
807a903e
VZ
73 bool Read(const wxString& key, long *pl, long defVal) const
74 { return wxConfigBase::Read(key, pl, defVal); }
e43cab59 75 long Read(const wxString& key, long defVal) const
807a903e
VZ
76 { return wxConfigBase::Read(key, defVal); }
77
18244936 78 // The following are necessary to satisfy the compiler
dfad0599 79 bool Read(const wxString& key, int *pi, int defVal) const
807a903e
VZ
80 { return wxConfigBase::Read(key, pi, defVal); }
81 bool Read(const wxString& key, int *pi) const
82 { return wxConfigBase::Read(key, pi); }
83
84 bool Read(const wxString& key, double* val, double defVal) const
85 { return wxConfigBase::Read(key, val, defVal); }
86 bool Read(const wxString& key, double* val) const
87 { return wxConfigBase::Read(key, val); }
88
89 bool Read(const wxString& key, bool *pb, bool defVal) const
90 { return wxConfigBase::Read(key, pb, defVal); }
91 bool Read(const wxString& key, bool *pb) const
92 { return wxConfigBase::Read(key, pb); }
93
18244936
JS
94 bool Write(const wxString& key, const wxString& szValue);
95 bool Write(const wxString& key, long lValue);
807a903e
VZ
96 bool Write(const wxString& key, double dValue)
97 { return wxConfigBase::Write(key, dValue); }
98 bool Write(const wxString& key, bool bValue)
99 { return wxConfigBase::Write(key, bValue); }
18244936 100
cf447356 101 virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; }
45c28815 102
5d1902d6
VZ
103 // rename
104 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
105 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
106
45c28815 107 // delete
18244936
JS
108 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso);
109 virtual bool DeleteGroup(const wxString& key);
45c28815
VZ
110 virtual bool DeleteAll();
111
807a903e
VZ
112protected:
113 // opens the local key creating it if necessary and returns it
114 wxRegKey& LocalKey() const // must be const to be callable from const funcs
115 {
116 wxRegConfig* self = wxConstCast(this, wxRegConfig);
117
118 if ( !m_keyLocal.IsOpened() )
119 {
120 // create on demand
121 self->m_keyLocal.Create();
122 }
123
124 return self->m_keyLocal;
125 }
126
45c28815 127private:
fd3f686c
VZ
128 // no copy ctor/assignment operator
129 wxRegConfig(const wxRegConfig&);
130 wxRegConfig& operator=(const wxRegConfig&);
131
45c28815
VZ
132 // these keys are opened during all lifetime of wxRegConfig object
133 wxRegKey m_keyLocalRoot, m_keyLocal,
134 m_keyGlobalRoot, m_keyGlobal;
135
136 // current path (not '/' terminated)
137 wxString m_strPath;
138};
139
cf447356 140#endif //_REGCONF_H