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