]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/prefconf.cpp
aui documentation updates
[wxWidgets.git] / src / palmos / prefconf.cpp
CommitLineData
23a59c2c
WS
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
23a59c2c
WS
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
33http://www.palmos.com/dev/support/docs/protein_books/System_Management/PreferenceConcepts.html
34
35This wxPrefConfig class is a wxConfig wrapper around PalmOS Preferences
36functionality. Preferences allow to write any structure into its database so
37wxPrefConfig writes there all entries of single group into one Preference.
38To optimize read/write operations value of preference is cached. Cache is filled
39after each change of the path (including using path to group names in all
40operations) and it is flushed on destructor, any path change on or purpose
41with Flush().
42
43Meaning 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
e2731512 51Each Preference is an array of chars. First unsigned char describes
23a59c2c
WS
52number N of chars used for Preference size. Next N chars (string) contains
53length of rest of Preference. Preference consists in serie of entries which
54should 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
68So 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
72and all it is in single Preference to not overload Preferences database.
73As long as each next Read/Write is performed in the same group then none
74access to Preferences is performed. Flushing needs only single writing to
75databease because all 3 parts of Preference can be prepared in memory.
76
77NOTE: wxPrefConfig can read/write only its own entries. It is impossible to
78know structures of Preferences of other non wxW applications.
79
80*/
81
82// ----------------------------------------------------------------------------
83// ctor/dtor
84// ----------------------------------------------------------------------------
85
86wxPrefConfig::wxPrefConfig(const wxString& appName, const wxString& vendorName,
87 const wxString& strLocal, const wxString& strGlobal,
88 long style)
89 : wxConfigBase(appName, vendorName, strLocal, strGlobal, style)
90{
91}
92
93// ----------------------------------------------------------------------------
94// path management
95// ----------------------------------------------------------------------------
96
97void wxPrefConfig::SetPath(const wxString& strPath)
98{
99}
100
101// ----------------------------------------------------------------------------
102// enumeration (works only with current group)
103// ----------------------------------------------------------------------------
104
105bool wxPrefConfig::GetFirstGroup(wxString& str, long& lIndex) const
106{
107}
108
109bool wxPrefConfig::GetNextGroup(wxString& str, long& lIndex) const
110{
111 /* TODO */
112 return false;
113}
114
115bool wxPrefConfig::GetFirstEntry(wxString& str, long& lIndex) const
116{
117 /* TODO */
118 return false;
119}
120
121bool wxPrefConfig::GetNextEntry(wxString& str, long& lIndex) const
122{
123 /* TODO */
124 return false;
125}
126
127size_t wxPrefConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const
128{
129 /* TODO */
130 return 0;
131}
132
133size_t wxPrefConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const
134{
135 /* TODO */
136 return 0;
137}
138
139// ----------------------------------------------------------------------------
140// tests for existence
141// ----------------------------------------------------------------------------
142
143bool wxPrefConfig::HasGroup(const wxString& key) const
144{
145 /* TODO */
146 return false;
147}
148
149bool wxPrefConfig::HasEntry(const wxString& key) const
150{
151 /* TODO */
152 return false;
153}
154
155wxConfigBase::EntryType wxPrefConfig::GetEntryType(const wxString& key) const
156{
157 /* TODO */
158 return wxConfigBase::Type_Unknown;
159}
160
161// ----------------------------------------------------------------------------
162// reading/writing
163// ----------------------------------------------------------------------------
164
165bool wxPrefConfig::DoReadString(const wxString& key, wxString *pStr) const
166{
167 /* TODO */
168 return false;
169}
170
171// this exactly reproduces the string version above except for ExpandEnvVars(),
172// we really should avoid this code duplication somehow...
173
174bool wxPrefConfig::DoReadLong(const wxString& key, long *plResult) const
175{
176 /* TODO */
177 return false;
178}
179
180bool wxPrefConfig::DoWriteString(const wxString& key, const wxString& szValue)
181{
182 /* TODO */
183 return false;
184}
185
186bool wxPrefConfig::DoWriteLong(const wxString& key, long lValue)
187{
188 /* TODO */
189 return false;
190}
191
192// ----------------------------------------------------------------------------
193// renaming
194// ----------------------------------------------------------------------------
195
196bool wxPrefConfig::RenameEntry(const wxString& oldName, const wxString& newName)
197{
198 /* TODO */
199 return false;
200}
201
202bool wxPrefConfig::RenameGroup(const wxString& oldName, const wxString& newName)
203{
204 /* TODO */
205 return false;
206}
207
208// ----------------------------------------------------------------------------
209// deleting
210// ----------------------------------------------------------------------------
211
212bool wxPrefConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso)
213{
214 /* TODO */
215 return false;
216}
217
218bool wxPrefConfig::DeleteGroup(const wxString& key)
219{
220 /* TODO */
221 return false;
222}
223
224bool wxPrefConfig::DeleteAll()
225{
226 /* TODO */
227 return false;
228}
229
230#endif // wxUSE_CONFIG && wxUSE_CONFIG_NATIVE