]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/regconf.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Registry based implementation of wxConfigBase
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
16 #pragma interface "regconf.h"
20 #include <wx/msw/registry.h>
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 class WXDLLEXPORT wxRegConfig
: public wxConfigBase
31 // will store data in HKLM\appName and HKCU\appName
32 wxRegConfig(const wxString
& appName
= "", const wxString
& vendorName
= "",
33 const wxString
& localFilename
= "", const wxString
& globalFilename
= "",
36 // dtor will save unsaved data
37 virtual ~wxRegConfig();
39 // implement inherited pure virtual functions
40 // ------------------------------------------
43 virtual void SetPath(const wxString
& strPath
);
44 virtual const wxString
& GetPath() const { return m_strPath
; }
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;
53 // tests for existence
54 virtual bool HasGroup(const wxString
& strName
) const;
55 virtual bool HasEntry(const wxString
& strName
) const;
57 // get number of entries/subgroups in the current group, with or without
59 virtual size_t GetNumberOfEntries(bool bRecursive
= FALSE
) const;
60 virtual size_t GetNumberOfGroups(bool bRecursive
= FALSE
) const;
63 bool Read(const wxString
& key
, wxString
*pStr
) const;
64 bool Read(const wxString
& key
, wxString
*pStr
, const wxString
& szDefault
) const;
65 bool Read(const wxString
& key
, long *plResult
) const;
67 // The following are necessary to satisfy the compiler
68 wxString
Read(const wxString
& key
, const wxString
& defVal
) const
69 { return wxConfigBase::Read(key
, defVal
); }
70 bool Read(const wxString
& key
, long *pl
, long defVal
) const
71 { return wxConfigBase::Read(key
, pl
, defVal
); }
72 bool Read(const wxString
& key
, int *pi
, int defVal
) const
73 { return wxConfigBase::Read(key
, pi
, defVal
); }
74 bool Read(const wxString
& key
, int *pi
) const
75 { return wxConfigBase::Read(key
, pi
); }
76 long Read(const wxString
& key
, long defVal
) const
77 { return wxConfigBase::Read(key
, defVal
); }
78 bool Read(const wxString
& key
, double* val
) const
79 { return wxConfigBase::Read(key
, val
); }
80 bool Read(const wxString
& key
, double* val
, double defVal
) const
81 { return wxConfigBase::Read(key
, val
, defVal
); }
83 bool Write(const wxString
& key
, const wxString
& szValue
);
84 bool Write(const wxString
& key
, long lValue
);
86 virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE
; }
89 virtual bool RenameEntry(const wxString
& oldName
, const wxString
& newName
);
90 virtual bool RenameGroup(const wxString
& oldName
, const wxString
& newName
);
93 virtual bool DeleteEntry(const wxString
& key
, bool bGroupIfEmptyAlso
);
94 virtual bool DeleteGroup(const wxString
& key
);
95 virtual bool DeleteAll();
98 // no copy ctor/assignment operator
99 wxRegConfig(const wxRegConfig
&);
100 wxRegConfig
& operator=(const wxRegConfig
&);
102 // these keys are opened during all lifetime of wxRegConfig object
103 wxRegKey m_keyLocalRoot
, m_keyLocal
,
104 m_keyGlobalRoot
, m_keyGlobal
;
106 // current path (not '/' terminated)