]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/regconf.h
compilation fix for Borland C++
[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>
65571936 9// Licence: wxWindows licence
45c28815
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _REGCONF_H
13#define _REGCONF_H
14
8f494e5d 15#ifndef _REGISTRY_H
85d4fc42 16 #include "wx/msw/registry.h"
8f494e5d 17#endif
fdd74b41 18
85d4fc42 19#include "wx/object.h"
fdd74b41 20#include "wx/confbase.h"
f24fc836 21#include "wx/buffer.h"
8f494e5d 22
45c28815
VZ
23// ----------------------------------------------------------------------------
24// wxRegConfig
25// ----------------------------------------------------------------------------
26
40a88328 27class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase
45c28815
VZ
28{
29public:
30 // ctor & dtor
18244936 31 // will store data in HKLM\appName and HKCU\appName
fda7962d
JS
32 wxRegConfig(const wxString& appName = wxEmptyString,
33 const wxString& vendorName = wxEmptyString,
34 const wxString& localFilename = wxEmptyString,
35 const wxString& globalFilename = wxEmptyString,
fa2d17ac 36 long style = wxCONFIG_USE_GLOBAL_FILE);
18244936 37
45c28815 38 // dtor will save unsaved data
6fb99eb3 39 virtual ~wxRegConfig(){}
45c28815
VZ
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
8f494e5d
VZ
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;
45c28815 54
8f494e5d 55 // tests for existence
6d833566
VZ
56 virtual bool HasGroup(const wxString& strName) const;
57 virtual bool HasEntry(const wxString& strName) const;
61ba49f2 58 virtual EntryType GetEntryType(const wxString& name) const;
6d833566 59
a37e8836
JS
60 // get number of entries/subgroups in the current group, with or without
61 // it's subgroups
4d08943e
WS
62 virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
63 virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
a37e8836 64
4d08943e 65 virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; }
45c28815 66
5d1902d6
VZ
67 // rename
68 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
69 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
70
45c28815 71 // delete
4d08943e 72 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
18244936 73 virtual bool DeleteGroup(const wxString& key);
45c28815
VZ
74 virtual bool DeleteAll();
75
807a903e
VZ
76protected:
77 // opens the local key creating it if necessary and returns it
78 wxRegKey& LocalKey() const // must be const to be callable from const funcs
79 {
80 wxRegConfig* self = wxConstCast(this, wxRegConfig);
81
82 if ( !m_keyLocal.IsOpened() )
83 {
84 // create on demand
85 self->m_keyLocal.Create();
86 }
87
88 return self->m_keyLocal;
89 }
90
2ba41305
VZ
91 // implement read/write methods
92 virtual bool DoReadString(const wxString& key, wxString *pStr) const;
93 virtual bool DoReadLong(const wxString& key, long *plResult) const;
5814e8ba 94 virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const;
2ba41305
VZ
95
96 virtual bool DoWriteString(const wxString& key, const wxString& szValue);
97 virtual bool DoWriteLong(const wxString& key, long lValue);
5814e8ba 98 virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf);
2ba41305 99
45c28815
VZ
100private:
101 // these keys are opened during all lifetime of wxRegConfig object
102 wxRegKey m_keyLocalRoot, m_keyLocal,
103 m_keyGlobalRoot, m_keyGlobal;
104
105 // current path (not '/' terminated)
106 wxString m_strPath;
c4ec0ce8
VZ
107
108 DECLARE_NO_COPY_CLASS(wxRegConfig)
109 DECLARE_ABSTRACT_CLASS(wxRegConfig)
45c28815
VZ
110};
111
cf447356 112#endif //_REGCONF_H