]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/prefconf.cpp
Compilation fix for wxMSW build without PCH.
[wxWidgets.git] / src / palmos / prefconf.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/prefconf.cpp
3 // Purpose: wxPrefConfig implementation
4 // Author: Wlodzimierz ABX Skiba
5 // Modified by:
6 // Created: 28.12.2004
7 // RCS-ID: $Id$
8 // Copyright: (c) Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx/string.h"
21 #endif //WX_PRECOMP
22
23 #if wxUSE_CONFIG && wxUSE_CONFIG_NATIVE
24
25 #include "wx/config.h"
26
27 // ============================================================================
28 // implementation
29 // ============================================================================
30
31 /*
32
33 http://www.palmos.com/dev/support/docs/protein_books/System_Management/PreferenceConcepts.html
34
35 This wxPrefConfig class is a wxConfig wrapper around PalmOS Preferences
36 functionality. Preferences allow to write any structure into its database so
37 wxPrefConfig writes there all entries of single group into one Preference.
38 To optimize read/write operations value of preference is cached. Cache is filled
39 after each change of the path (including using path to group names in all
40 operations) and it is flushed on destructor, any path change on or purpose
41 with Flush().
42
43 Meaning of styles:
44
45 wxCONFIG_USE_LOCAL_FILE => store config in "saved" preferences database
46 (not to be backed up during a HotSync operation)
47 wxCONFIG_USE_GLOBAL_FILE => store config in "unsaved" preferences database
48 (backed up during a HotSync operation)
49
50
51 Each Preference is an array of chars. First unsigned char describes
52 number N of chars used for Preference size. Next N chars (string) contains
53 length of rest of Preference. Preference consists in serie of entries which
54 should be read in loop until in reaches end of Preference.
55
56 Each entry is an set of chars with following structure:
57 1. name (null terminated)
58 2. type (single char): b,s,g,l,d (see value)
59 3. value
60 - for type="b" (bool) it os "0" or "1"
61 - for type="s" (string) it is null terminated set of chars
62 - for type="g" (subgroup) as for "s" but string is converted to
63 uint16_t for id parameter of ::PrefGetAppPreferences()
64 - for type="l" (long) as for "s" but string is converted to long
65 - for type="d" (double) as for "s" but string is converted to double
66 - otherwise it is ""
67
68 So all together first Read in group needs 3 reading from Preference:
69 1. take the length N of length
70 2. take the length M of the group content
71 3. take the group content
72 and all it is in single Preference to not overload Preferences database.
73 As long as each next Read/Write is performed in the same group then none
74 access to Preferences is performed. Flushing needs only single writing to
75 databease because all 3 parts of Preference can be prepared in memory.
76
77 NOTE: wxPrefConfig can read/write only its own entries. It is impossible to
78 know structures of Preferences of other non wxW applications.
79
80 */
81
82 // ----------------------------------------------------------------------------
83 // ctor/dtor
84 // ----------------------------------------------------------------------------
85 IMPLEMENT_ABSTRACT_CLASS(wxPrefConfig, wxConfigBase)
86
87 wxPrefConfig::wxPrefConfig(const wxString& appName, const wxString& vendorName,
88 const wxString& strLocal, const wxString& strGlobal,
89 long style)
90 : wxConfigBase(appName, vendorName, strLocal, strGlobal, style)
91 {
92 }
93
94 // ----------------------------------------------------------------------------
95 // path management
96 // ----------------------------------------------------------------------------
97
98 void wxPrefConfig::SetPath(const wxString& strPath)
99 {
100 }
101
102 // ----------------------------------------------------------------------------
103 // enumeration (works only with current group)
104 // ----------------------------------------------------------------------------
105
106 bool wxPrefConfig::GetFirstGroup(wxString& str, long& lIndex) const
107 {
108 }
109
110 bool wxPrefConfig::GetNextGroup(wxString& str, long& lIndex) const
111 {
112 /* TODO */
113 return false;
114 }
115
116 bool wxPrefConfig::GetFirstEntry(wxString& str, long& lIndex) const
117 {
118 /* TODO */
119 return false;
120 }
121
122 bool wxPrefConfig::GetNextEntry(wxString& str, long& lIndex) const
123 {
124 /* TODO */
125 return false;
126 }
127
128 size_t wxPrefConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const
129 {
130 /* TODO */
131 return 0;
132 }
133
134 size_t wxPrefConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const
135 {
136 /* TODO */
137 return 0;
138 }
139
140 // ----------------------------------------------------------------------------
141 // tests for existence
142 // ----------------------------------------------------------------------------
143
144 bool wxPrefConfig::HasGroup(const wxString& key) const
145 {
146 /* TODO */
147 return false;
148 }
149
150 bool wxPrefConfig::HasEntry(const wxString& key) const
151 {
152 /* TODO */
153 return false;
154 }
155
156 wxConfigBase::EntryType wxPrefConfig::GetEntryType(const wxString& key) const
157 {
158 /* TODO */
159 return wxConfigBase::Type_Unknown;
160 }
161
162 // ----------------------------------------------------------------------------
163 // reading/writing
164 // ----------------------------------------------------------------------------
165
166 bool wxPrefConfig::DoReadString(const wxString& key, wxString *pStr) const
167 {
168 /* TODO */
169 return false;
170 }
171
172 // this exactly reproduces the string version above except for ExpandEnvVars(),
173 // we really should avoid this code duplication somehow...
174
175 bool wxPrefConfig::DoReadLong(const wxString& key, long *plResult) const
176 {
177 /* TODO */
178 return false;
179 }
180
181 #if wxUSE_BASE64
182 bool wxPrefConfig::DoReadBinary(const wxString& key, wxMemoryBuffer *buf) const
183 {
184 /* TODO */
185 return false;
186 }
187 #endif // wxUSE_BASE64
188
189 bool wxPrefConfig::DoWriteString(const wxString& key, const wxString& szValue)
190 {
191 /* TODO */
192 return false;
193 }
194
195 bool wxPrefConfig::DoWriteLong(const wxString& key, long lValue)
196 {
197 /* TODO */
198 return false;
199 }
200
201 #if wxUSE_BASE64
202 bool wxPrefConfig::DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf)
203 {
204 /* TODO */
205 return false;
206 }
207 #endif // wxUSE_BASE64
208
209 // ----------------------------------------------------------------------------
210 // renaming
211 // ----------------------------------------------------------------------------
212
213 bool wxPrefConfig::RenameEntry(const wxString& oldName, const wxString& newName)
214 {
215 /* TODO */
216 return false;
217 }
218
219 bool wxPrefConfig::RenameGroup(const wxString& oldName, const wxString& newName)
220 {
221 /* TODO */
222 return false;
223 }
224
225 // ----------------------------------------------------------------------------
226 // deleting
227 // ----------------------------------------------------------------------------
228
229 bool wxPrefConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
230 {
231 /* TODO */
232 return false;
233 }
234
235 bool wxPrefConfig::DeleteGroup(const wxString& key)
236 {
237 /* TODO */
238 return false;
239 }
240
241 bool wxPrefConfig::DeleteAll()
242 {
243 /* TODO */
244 return false;
245 }
246
247 #endif // wxUSE_CONFIG && wxUSE_CONFIG_NATIVE