]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | /////////////////////////////////////////////////////////////////////////////// |
23a59c2c WS |
2 | // Name: wx/palmos/prefconf.h |
3 | // Purpose: wxPrefConfig interface | |
4 | // Author: Wlodzimierz ABX Skiba | |
ffecfa5a | 5 | // Modified by: |
23a59c2c WS |
6 | // Created: 28.12.2004 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Wlodzimierz Skiba | |
9 | // License: wxWindows licence | |
ffecfa5a JS |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
23a59c2c WS |
12 | #ifndef _PREFCONF_H_ |
13 | #define _PREFCONF_H_ | |
ffecfa5a | 14 | |
101b2420 VZ |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_CONFIG | |
18 | ||
ffecfa5a | 19 | // ---------------------------------------------------------------------------- |
23a59c2c | 20 | // wxPrefConfig |
ffecfa5a JS |
21 | // ---------------------------------------------------------------------------- |
22 | ||
23a59c2c | 23 | class WXDLLIMPEXP_BASE wxPrefConfig : public wxConfigBase |
ffecfa5a JS |
24 | { |
25 | public: | |
26 | // ctor & dtor | |
23a59c2c WS |
27 | wxPrefConfig(const wxString& appName = wxEmptyString, |
28 | const wxString& vendorName = wxEmptyString, | |
29 | const wxString& localFilename = wxEmptyString, | |
30 | const wxString& globalFilename = wxEmptyString, | |
31 | long style = wxCONFIG_USE_GLOBAL_FILE); | |
ffecfa5a | 32 | |
23a59c2c WS |
33 | // dtor will save unsaved data |
34 | virtual ~wxPrefConfig(){} | |
ffecfa5a JS |
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 | |
ffecfa5a JS |
44 | virtual bool GetFirstGroup(wxString& str, long& lIndex) const; |
45 | virtual bool GetNextGroup (wxString& str, long& lIndex) const; | |
46 | virtual bool GetFirstEntry(wxString& str, long& lIndex) const; | |
47 | virtual bool GetNextEntry (wxString& str, long& lIndex) const; | |
48 | ||
23a59c2c | 49 | // tests for existence |
ffecfa5a JS |
50 | virtual bool HasGroup(const wxString& strName) const; |
51 | virtual bool HasEntry(const wxString& strName) const; | |
52 | virtual EntryType GetEntryType(const wxString& name) const; | |
53 | ||
23a59c2c WS |
54 | // get number of entries/subgroups in the current group, with or without |
55 | // it's subgroups | |
56 | virtual size_t GetNumberOfEntries(bool bRecursive = false) const; | |
57 | virtual size_t GetNumberOfGroups(bool bRecursive = false) const; | |
ffecfa5a | 58 | |
23a59c2c | 59 | virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; } |
ffecfa5a JS |
60 | |
61 | // rename | |
62 | virtual bool RenameEntry(const wxString& oldName, const wxString& newName); | |
63 | virtual bool RenameGroup(const wxString& oldName, const wxString& newName); | |
64 | ||
65 | // delete | |
23a59c2c | 66 | virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); |
ffecfa5a JS |
67 | virtual bool DeleteGroup(const wxString& key); |
68 | virtual bool DeleteAll(); | |
69 | ||
70 | protected: | |
ffecfa5a JS |
71 | // implement read/write methods |
72 | virtual bool DoReadString(const wxString& key, wxString *pStr) const; | |
73 | virtual bool DoReadLong(const wxString& key, long *plResult) const; | |
5814e8ba | 74 | virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer *buf) const; |
ffecfa5a JS |
75 | |
76 | virtual bool DoWriteString(const wxString& key, const wxString& szValue); | |
77 | virtual bool DoWriteLong(const wxString& key, long lValue); | |
5814e8ba | 78 | virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf); |
ffecfa5a JS |
79 | |
80 | private: | |
ffecfa5a JS |
81 | // current path (not '/' terminated) |
82 | wxString m_strPath; | |
23a59c2c WS |
83 | |
84 | // current path (group) content (cache for read/write) | |
85 | wxString m_strGroup; | |
86 | ||
87 | // current group modified ? | |
88 | bool m_modGroup; | |
c4ec0ce8 | 89 | |
c0c133e1 | 90 | wxDECLARE_NO_COPY_CLASS(wxPrefConfig); |
c4ec0ce8 | 91 | DECLARE_ABSTRACT_CLASS(wxPrefConfig) |
ffecfa5a JS |
92 | }; |
93 | ||
101b2420 | 94 | #endif // wxUSE_CONFIG |
23a59c2c | 95 | |
101b2420 | 96 | #endif // _PREFCONF_H_ |