|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CDBMANTESTPLUGINBASE_H |
|
21 #define CDBMANTESTPLUGINBASE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <EPos_CPosLmDatabaseManagerPluginBase.h> |
|
25 |
|
26 // CLASS DECLARATION |
|
27 |
|
28 class CDbManTestPluginBase : public CPosLmDatabaseManagerPluginBase |
|
29 { |
|
30 public: |
|
31 |
|
32 /** |
|
33 * Destructor. |
|
34 */ |
|
35 ~CDbManTestPluginBase(); |
|
36 |
|
37 |
|
38 static CDbManTestPluginBase* NewL(TAny* aConstructionParams); |
|
39 |
|
40 |
|
41 public: // Functions from base classes. |
|
42 |
|
43 /** |
|
44 * Lists the URIs to all landmark databases handled by this |
|
45 * plug-in. |
|
46 * |
|
47 * The client takes ownership of the returned array. |
|
48 * |
|
49 * If no databases are found, an empty array is returned. |
|
50 * |
|
51 * This function requires @p ReadUserData capability. |
|
52 * |
|
53 * @since Series 60 3.0 |
|
54 * @return The list of database URIs. |
|
55 */ |
|
56 CDesCArray* ListDatabasesLC(); |
|
57 |
|
58 /** |
|
59 * Lists information about each landmark database handled by this |
|
60 * plug-in. |
|
61 * |
|
62 * The client specifies an array which is populated by this function. |
|
63 * The client takes ownership of all information objects in the array. |
|
64 * |
|
65 * If no databases are found, the input array is not modified. |
|
66 * |
|
67 * This function requires @p ReadUserData capability. |
|
68 * |
|
69 * @since Series 60 3.0 |
|
70 * @param aDatabaseInfoArray On return, contains information about |
|
71 * the landmark databases. |
|
72 */ |
|
73 void ListDatabasesL( |
|
74 /* OUT */ RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray |
|
75 ); |
|
76 |
|
77 /** |
|
78 * Registers a landmark database. |
|
79 * |
|
80 * The landmark database is then returned when listing landmark |
|
81 * databases. |
|
82 * |
|
83 * Some protocols like "file" does not allow registering of databases |
|
84 * and will leave with error code @p KErrNotSupported. To add a |
|
85 * "file"-protocol database, the client must call @ref CreateDatabaseL. |
|
86 * |
|
87 * The client supplies an information object containing the URI of the |
|
88 * database to register. The information object can also contain |
|
89 * database settings, e.g. a display name for the database. |
|
90 * |
|
91 * This function requires @p ReadUserData and @p WriteUserData |
|
92 * capabilities. |
|
93 * |
|
94 * @since Series 60 3.0 |
|
95 * @param aDatabaseInfo Information about the landmark database to |
|
96 * register. |
|
97 * @par Leave codes: |
|
98 * @p KErrNotSupported The protocol specified in the URI is not |
|
99 * supported by this plug-in or the protocol does not allow |
|
100 * registering landmark databases.\n |
|
101 * @p KErrArgument The URI is incorrect.\n |
|
102 * @p KErrAlreadyExists The database already exists in the registry. |
|
103 */ |
|
104 void RegisterDatabaseL( |
|
105 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
106 ); |
|
107 |
|
108 /** |
|
109 * Unregisters a landmark database. |
|
110 * |
|
111 * After this, the landmark database will not be returned when listing |
|
112 * landmark databases. |
|
113 * |
|
114 * Some protocols like "file" does not allow unregistering of databases |
|
115 * and will leave with error code @p KErrNotSupported. To remove a |
|
116 * "file"-protocol database, the client must call @ref DeleteDatabaseL. |
|
117 * |
|
118 * This function requires @p ReadUserData and @p WriteUserData |
|
119 * capabilities. |
|
120 * |
|
121 * @since Series 60 3.0 |
|
122 * @param aDatabaseUri The URI of the database to register. |
|
123 * @par Leave codes: |
|
124 * @p KErrNotSupported The protocol specified in the URI is not |
|
125 * supported by this plug-in or the protocol does not allow |
|
126 * unregistering landmark databases.\n |
|
127 * @p KErrArgument The URI is incorrect. |
|
128 */ |
|
129 void UnregisterDatabaseL( |
|
130 /* IN */ const TDesC& aDatabaseUri |
|
131 ); |
|
132 |
|
133 /** |
|
134 * Unregisters all landmark database which are accessed through this |
|
135 * plug-in |
|
136 * |
|
137 * After this, the landmark databases will not be returned when listing |
|
138 * landmark databases. |
|
139 * |
|
140 * Some protocols like "file" does not allow unregistering of databases |
|
141 * and will leave with error code @p KErrNotSupported. To remove a |
|
142 * "file"-protocol database, the client must call @ref DeleteDatabaseL. |
|
143 * |
|
144 * This function requires @p ReadUserData and @p WriteUserData |
|
145 * capabilities. |
|
146 * |
|
147 * @since Series 60 3.0 |
|
148 * @par Leave codes: |
|
149 * @p KErrNotSupported This plug-in does not allow unregistering |
|
150 * landmark databases. |
|
151 */ |
|
152 void UnregisterAllDatabasesL(); |
|
153 |
|
154 /** |
|
155 * Modifies the settings for a landmark database. |
|
156 * |
|
157 * This function requires @p ReadUserData and @p WriteUserData |
|
158 * capabilities. |
|
159 * |
|
160 * @since Series 60 3.0 |
|
161 * @param aDatabaseUri The URI of the database to modify settings for. |
|
162 * @param aDatabaseSettings The new settings for the database. |
|
163 * @par Leave codes: |
|
164 * @p KErrNotSupported The protocol specified in the URI is not |
|
165 * supported by this plug-in.\n |
|
166 * @p KErrNotFound The specified database is not found. |
|
167 */ |
|
168 void ModifyDatabaseSettingsL( |
|
169 /* IN */ const TDesC& aDatabaseUri, |
|
170 /* IN */ const TPosLmDatabaseSettings& aDatabaseSettings |
|
171 ); |
|
172 |
|
173 /** |
|
174 * Retrieve information about a landmark database. |
|
175 * |
|
176 * This function requires @p ReadUserData capability. |
|
177 * |
|
178 * @since Series 60 3.0 |
|
179 * @param aDatabaseInfo An information object containing the URI of the |
|
180 * landmark database. On return, the object contains information about |
|
181 * the landmark database, including any database settings. |
|
182 * @par Leave codes: |
|
183 * @p KErrNotSupported The protocol specified in the URI is not |
|
184 * supported by this plug-in.\n |
|
185 * @p KErrNotFound The specified database is not found. |
|
186 */ |
|
187 void GetDatabaseInfoL( |
|
188 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
189 ); |
|
190 |
|
191 /** |
|
192 * Checks if the specified landmark database exists. |
|
193 * |
|
194 * The database to check is specified by passing a URI to this function. |
|
195 * URI construction is described in the class description for |
|
196 * @ref CPosLmDatabaseManager. |
|
197 * |
|
198 * This function requires @p ReadUserData capability. If the database is |
|
199 * remote, @p NetworkServices capability is also needed. |
|
200 * |
|
201 * @since Series 60 3.0 |
|
202 * @param aDatabaseUri The URI of the database which should be checked |
|
203 * for existence. |
|
204 * @return @p ETrue if the database exists, otherwise @p EFalse. |
|
205 * @par Leave codes: |
|
206 * @p KErrArgument The URI is incorrect or the protocol specified in the |
|
207 * URI is not supported by this plug-in.\n |
|
208 */ |
|
209 TBool DatabaseExistsL( |
|
210 /* IN */ const TDesC& aDatabaseUri |
|
211 ); |
|
212 |
|
213 /** |
|
214 * Creates a landmark database. |
|
215 * |
|
216 * This function requires @p ReadUserData and @p WriteUserData |
|
217 * capabilities. If the database is remote, @p NetworkServices |
|
218 * capability is also needed. |
|
219 * |
|
220 * @since Series 60 3.0 |
|
221 * @param aDatabaseUri The URI of the new database. |
|
222 * @par Leave codes: |
|
223 * @p KErrNotSupported The operation is not supported by the plug-in.\n |
|
224 * @p KErrArgument The URI is incorrect or the protocol specified in the |
|
225 * URI is not supported by this plug-in.\n |
|
226 * @p KErrAlreadyExists There is already a database at this URI. |
|
227 */ |
|
228 void CreateDatabaseL( |
|
229 /* IN/OUT */ HPosLmDatabaseInfo& aDatabaseInfo |
|
230 ); |
|
231 |
|
232 /** |
|
233 * Deletes a landmark database. |
|
234 * |
|
235 * The database to delete is specified by passing a URI to this |
|
236 * function. URI construction is described in the class description for |
|
237 * @ref CPosLmDatabaseManager. The URI must specify the protocol which |
|
238 * is handled by this database manager plug-in. |
|
239 * |
|
240 * If the specified database does not exist, the call is ignored. |
|
241 * |
|
242 * This function requires @p ReadUserData and @p WriteUserData |
|
243 * capabilities. If the database is remote, @p NetworkServices |
|
244 * capability is also needed. |
|
245 * |
|
246 * @since Series 60 3.0 |
|
247 * @param aDatabaseUri The URI of the database to delete. |
|
248 * @par Leave codes: |
|
249 * @p KErrNotSupported The operation is not supported by the plug-in.\n |
|
250 * @p KErrArgument The URI is incorrect or the protocol specified in the |
|
251 * URI is not supported by this plug-in.\n |
|
252 * @p KErrInUse The database is in use by some client.\n |
|
253 * @p KErrAccessDenied The database is read-only. |
|
254 */ |
|
255 void DeleteDatabaseL( |
|
256 /* IN */ const TDesC& aDatabaseUri |
|
257 ); |
|
258 |
|
259 /** |
|
260 * Copies a landmark database to a new location. |
|
261 * |
|
262 * Database locations are specified as URIs. URI construction is |
|
263 * described in the class description for @ref CPosLmDatabaseManager. |
|
264 * The target and source URIs must specify the protocol which is handled |
|
265 * by this database manager plug-in. |
|
266 * |
|
267 * This function requires @p ReadUserData and @p WriteUserData |
|
268 * capabilities. If the database is remote, @p NetworkServices |
|
269 * capability is also needed. |
|
270 * |
|
271 * @since Series 60 3.0 |
|
272 * @param aSourceUri The URI of the database to copy. |
|
273 * @param aTargetUri The URI of the new database location. |
|
274 * @par Leave codes: |
|
275 * @p KErrNotSupported The operation is not supported by the plug-in.\n |
|
276 * @p KErrArgument A URI is incorrect or the protocol specified in a |
|
277 * URI is not supported by this plug-in.\n |
|
278 * @p KErrInUse There is a write-lock on the database, e.g. some client |
|
279 * is currently modifying the database.\n |
|
280 * @p KErrNotFound There is no database at the source URI.\n |
|
281 */ |
|
282 void CopyDatabaseL( |
|
283 /* IN */ const TDesC& aSourceUri, |
|
284 /* IN */ const TDesC& aTargetUri |
|
285 ); |
|
286 |
|
287 |
|
288 /** |
|
289 * Retrieves the type of media where a landmark database resides. |
|
290 * |
|
291 * This function does not validate the URI. If the URI is invalid, this |
|
292 * function will just return @p EMediaUnknown. |
|
293 * |
|
294 * @since Series 60 3.0 |
|
295 * @param aDatabaseUri The URI of the database to check media for. |
|
296 * @return Type of storage media. |
|
297 */ |
|
298 TMediaType DatabaseMedia( |
|
299 /* IN */ const TDesC& aDatabaseUri |
|
300 ); |
|
301 |
|
302 /** |
|
303 * Retrieves the drive letter for the drive where a landmark database |
|
304 * resides. |
|
305 * |
|
306 * If the landmark database is remote or otherwise the drive letter is |
|
307 * not applicable, 0 is returned. |
|
308 * |
|
309 * This function does not validate the URI. If the URI is invalid, this |
|
310 * function will just return 0. |
|
311 * |
|
312 * @param aDatabaseUri The URI of the database to check drive letter |
|
313 * for. |
|
314 * @return The drive letter, or 0 if drive letter is not applicable. |
|
315 */ |
|
316 TChar DatabaseDrive( |
|
317 /* IN */ const TDesC& aDatabaseUri |
|
318 ); |
|
319 |
|
320 /** |
|
321 * From CPosLmDatabaseManagerPluginBase |
|
322 * |
|
323 * @since Series 60 3.0 |
|
324 * @return Pointer to the protocol descriptor, e.g. "file" |
|
325 */ |
|
326 TPtrC Protocol(); |
|
327 |
|
328 protected: |
|
329 |
|
330 CDbManTestPluginBase(); |
|
331 |
|
332 private: |
|
333 |
|
334 TInt FindUri(const TDesC& aUri); |
|
335 |
|
336 // By default, prohibit copy constructor |
|
337 CDbManTestPluginBase( |
|
338 const CDbManTestPluginBase& ); |
|
339 // Prohibit assigment operator |
|
340 CDbManTestPluginBase& operator=( |
|
341 const CDbManTestPluginBase& ); |
|
342 |
|
343 private: // Data |
|
344 |
|
345 RPointerArray<HPosLmDatabaseInfo> iDatabases; |
|
346 |
|
347 }; |
|
348 |
|
349 #endif // CDBMANTESTPLUGINBASE_H |
|
350 |
|
351 // End of File |