]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/prefconf.h
update the samples to use new (non-deprecated) wxGLCanvas API; added more comments...
[wxWidgets.git] / include / wx / palmos / prefconf.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/prefconf.h
3 // Purpose: wxPrefConfig interface
4 // Author: Wlodzimierz ABX Skiba
5 // Modified by:
6 // Created: 28.12.2004
7 // RCS-ID: $Id$
8 // Copyright: (c) Wlodzimierz Skiba
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _PREFCONF_H_
13 #define _PREFCONF_H_
14
15 // ----------------------------------------------------------------------------
16 // wxPrefConfig
17 // ----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_BASE wxPrefConfig : public wxConfigBase
20 {
21 public:
22 // ctor & dtor
23 wxPrefConfig(const wxString& appName = wxEmptyString,
24 const wxString& vendorName = wxEmptyString,
25 const wxString& localFilename = wxEmptyString,
26 const wxString& globalFilename = wxEmptyString,
27 long style = wxCONFIG_USE_GLOBAL_FILE);
28
29 // dtor will save unsaved data
30 virtual ~wxPrefConfig(){}
31
32 // implement inherited pure virtual functions
33 // ------------------------------------------
34
35 // path management
36 virtual void SetPath(const wxString& strPath);
37 virtual const wxString& GetPath() const { return m_strPath; }
38
39 // entry/subgroup info
40 virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
41 virtual bool GetNextGroup (wxString& str, long& lIndex) const;
42 virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
43 virtual bool GetNextEntry (wxString& str, long& lIndex) const;
44
45 // tests for existence
46 virtual bool HasGroup(const wxString& strName) const;
47 virtual bool HasEntry(const wxString& strName) const;
48 virtual EntryType GetEntryType(const wxString& name) const;
49
50 // get number of entries/subgroups in the current group, with or without
51 // it's subgroups
52 virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
53 virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
54
55 virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; }
56
57 // rename
58 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
59 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
60
61 // delete
62 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
63 virtual bool DeleteGroup(const wxString& key);
64 virtual bool DeleteAll();
65
66 protected:
67 // implement read/write methods
68 virtual bool DoReadString(const wxString& key, wxString *pStr) const;
69 virtual bool DoReadLong(const wxString& key, long *plResult) const;
70 virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer *buf) const;
71
72 virtual bool DoWriteString(const wxString& key, const wxString& szValue);
73 virtual bool DoWriteLong(const wxString& key, long lValue);
74 virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf);
75
76 private:
77 // current path (not '/' terminated)
78 wxString m_strPath;
79
80 // current path (group) content (cache for read/write)
81 wxString m_strGroup;
82
83 // current group modified ?
84 bool m_modGroup;
85
86 DECLARE_NO_COPY_CLASS(wxPrefConfig)
87 DECLARE_ABSTRACT_CLASS(wxPrefConfig)
88 };
89
90 #endif // _PREFCONF_H_
91