|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "clirep.h" |
|
17 |
|
18 /** Creates a CRepository object for accessing a repository. |
|
19 If there is no such repository, the function leaves with KErrNotFound. |
|
20 A pointer to the object is left on the cleanup stack. |
|
21 @param aRepositoryUid The UID of the repository to be accessed |
|
22 @return A pointer to a newly created CRepository object |
|
23 */ |
|
24 EXPORT_C CRepository* CRepository::NewLC(TUid aRepositoryUid) |
|
25 { |
|
26 return CClientRepository::NewLC(aRepositoryUid); |
|
27 } |
|
28 |
|
29 |
|
30 /** Creates a CRepository object for accessing a repository. |
|
31 If there is no such repository, the function leaves with KErrNotFound. |
|
32 @param aRepositoryUid The UID of the repository to be accessed |
|
33 @return A pointer to a newly created CRepository object |
|
34 */ |
|
35 EXPORT_C CRepository* CRepository::NewL(TUid aRepositoryUid) |
|
36 { |
|
37 CRepository* rep = CRepository::NewLC(aRepositoryUid); |
|
38 CleanupStack::Pop(); |
|
39 return rep; |
|
40 } |
|
41 |
|
42 |
|
43 /** Destructor. |
|
44 */ |
|
45 EXPORT_C CRepository::~CRepository() |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 /** Creates a new setting with an integer value. |
|
51 @param aKey New setting key. |
|
52 @param aValue Setting value. |
|
53 @return |
|
54 KErrNone if successful, |
|
55 KErrAbort if in a transaction that has previously failed |
|
56 KErrPermissionDenied if caller fails capability check, |
|
57 KErrAlreadyExists if a setting with that key already exists |
|
58 plus other system-wide error codes. |
|
59 @post |
|
60 Transactions fail on all error conditions. |
|
61 Outside transactions: on success the new setting is persistent, |
|
62 on failure the repository is unmodified. |
|
63 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
64 */ |
|
65 EXPORT_C TInt CRepository::Create(TUint32 aKey, TInt aValue) |
|
66 { |
|
67 return (static_cast<CClientRepository*>(this))->Create(aKey, aValue); |
|
68 } |
|
69 |
|
70 |
|
71 /** Creates a new setting with a floating-point value. |
|
72 @param aKey New setting key. |
|
73 @param aValue Setting value. |
|
74 @return |
|
75 KErrNone if successful, |
|
76 KErrAbort if in a transaction that has previously failed |
|
77 KErrPermissionDenied if caller fails capability check, |
|
78 KErrAlreadyExists if a setting with that key already exists |
|
79 plus other system-wide error codes. |
|
80 @post |
|
81 Transactions fail on all error conditions. |
|
82 Outside transactions: on success the new setting is persistent, |
|
83 on failure the repository is unmodified. |
|
84 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
85 */ |
|
86 EXPORT_C TInt CRepository::Create(TUint32 aKey, const TReal& aValue) |
|
87 { |
|
88 return (static_cast<CClientRepository*>(this))->Create(aKey, aValue); |
|
89 } |
|
90 |
|
91 |
|
92 /** Creates a new setting with a descriptor value. |
|
93 @param aKey New setting key. |
|
94 @param aValue Setting value. |
|
95 @return |
|
96 KErrNone if successful, |
|
97 KErrAbort if in a transaction that has previously failed |
|
98 KErrPermissionDenied if caller fails capability check, |
|
99 KErrAlreadyExists if a setting with that key already exists |
|
100 KErrArgument if the descriptor is longer than KMaxBinaryLength, |
|
101 plus other system-wide error codes. |
|
102 @post |
|
103 Transactions fail on all error conditions. |
|
104 Outside transactions: on success the new setting is persistent, |
|
105 on failure the repository is unmodified. |
|
106 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
107 */ |
|
108 EXPORT_C TInt CRepository::Create(TUint32 aKey, const TDesC8& aValue) |
|
109 { |
|
110 return (static_cast<CClientRepository*>(this))->Create(aKey, aValue); |
|
111 } |
|
112 |
|
113 /** Creates a new setting with a descriptor value. |
|
114 @param aKey New setting key. |
|
115 @param aValue Setting value. |
|
116 @return |
|
117 KErrNone if successful, |
|
118 KErrAbort if in a transaction that has previously failed |
|
119 KErrPermissionDenied if caller fails capability check, |
|
120 KErrAlreadyExists if a setting with that key already exists |
|
121 KErrArgument if the descriptor is longer than KMaxUnicodeStringLength, |
|
122 plus other system-wide error codes. |
|
123 @post |
|
124 Transactions fail on all error conditions. |
|
125 Outside transactions: on success the new setting is persistent, |
|
126 on failure the repository is unmodified. |
|
127 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
128 */ |
|
129 EXPORT_C TInt CRepository::Create(TUint32 aKey, const TDesC16& aValue) |
|
130 { |
|
131 return (static_cast<CClientRepository*>(this))->Create(aKey, aValue); |
|
132 } |
|
133 |
|
134 /** Deletes a setting. |
|
135 @param aKey Key of setting to be deleted. |
|
136 @return |
|
137 KErrNone if successful, |
|
138 KErrAbort if in a transaction that has previously failed |
|
139 KErrPermissionDenied if caller fails capability check, |
|
140 KErrNotFound if the setting does not exist, |
|
141 plus other system-wide error codes. |
|
142 @post |
|
143 Transactions fail on all error conditions except KErrNotFound. |
|
144 Outside transactions: on success the deletion of the setting is persistent, |
|
145 on failure the repository is unmodified. |
|
146 @capability Dependent Caller must satisfy the write access policy for that key in the repository |
|
147 */ |
|
148 EXPORT_C TInt CRepository::Delete(TUint32 aKey) |
|
149 { |
|
150 return (static_cast<CClientRepository*>(this))->Delete(aKey); |
|
151 } |
|
152 |
|
153 /** Deletes all the settings that exist and match the specification: |
|
154 (key & mask) == (partialKey & mask) |
|
155 Partial key is guaranteed to be masked before use. |
|
156 Examples of use: |
|
157 - To delete a single key. |
|
158 Delete(key, 0xFFFFFFFF, errorKey); |
|
159 - To delete all keys from 0 to 0xFF: |
|
160 Delete(0, 0xFFFFFF00, errorKey); |
|
161 (digits from 0 to 0xFF would be ignored if given in the partial key) |
|
162 - To delete all keys matching 0x5B??3A?6: |
|
163 Delete(0x5B003A06, 0xFF00FF0F, errorKey); |
|
164 |
|
165 @param aPartialKey |
|
166 Contains a bit pattern that all the keys must at least partially |
|
167 match. |
|
168 @param aMask |
|
169 Has bits set for all the bits in aPartialKey that must match the keys being deleted. |
|
170 @param aErrorKey If the delete operation fails this contains the key involved in the |
|
171 failure, or aPartialKey or KUnspecifiedKey if it could not be attributed to any key |
|
172 @return |
|
173 KErrNone if successful, |
|
174 KErrAbort if in a transaction that has previously failed |
|
175 KErrNotFound if no items were found in the partial key range. |
|
176 KErrPermissionDenied if caller fails capability check. |
|
177 plus other system-wide error codes. |
|
178 @post |
|
179 Transactions fail on all error conditions except KErrNotFound |
|
180 Outside transactions: on success the changes are persistent, on failure the |
|
181 repository is unmodified. |
|
182 @capability Dependent Caller must satisfy the write policies of all settings found in the |
|
183 partial key range. |
|
184 */ |
|
185 EXPORT_C TInt CRepository::Delete (TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey) |
|
186 { |
|
187 return (static_cast<CClientRepository*>(this))->Delete(aPartialKey, aMask, aErrorKey); |
|
188 } |
|
189 |
|
190 |
|
191 /** Reads an integer setting. |
|
192 @param aKey Key of setting to be read. |
|
193 @param aValue Returns the value of the setting if it is an integer. |
|
194 @return |
|
195 KErrNone if successful, |
|
196 KErrAbort if in a transaction that has previously failed |
|
197 KErrPermissionDenied if caller fails capability check, |
|
198 KErrNotFound if the setting does not exist, |
|
199 KErrArgument if the setting exists but is not an integer, |
|
200 plus other system-wide error codes. |
|
201 @post Transactions fail only on those "other system-wide error codes". |
|
202 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
203 */ |
|
204 EXPORT_C TInt CRepository::Get(TUint32 aKey, TInt& aValue) |
|
205 { |
|
206 return (static_cast<CClientRepository*>(this))->Get(aKey, aValue); |
|
207 } |
|
208 |
|
209 |
|
210 /** Sets an existing integer setting to a new value or creates a new setting |
|
211 with an integer value if the setting doesn't exist. |
|
212 @param aKey Key of setting to be written to. |
|
213 @param aValue Value to be written. |
|
214 @return |
|
215 KErrNone if successful, |
|
216 KErrAbort if in a transaction that has previously failed |
|
217 KErrPermissionDenied if caller fails capability check, |
|
218 KErrArgument if the setting exists but is not an integer |
|
219 plus other system-wide error codes. |
|
220 @post |
|
221 Transactions fail on all error conditions. |
|
222 Outside transactions: on success the new value is persistent, |
|
223 on failure the repository is unmodified. |
|
224 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
225 */ |
|
226 EXPORT_C TInt CRepository::Set(TUint32 aKey, TInt aValue) |
|
227 { |
|
228 return (static_cast<CClientRepository*>(this))->Set(aKey, aValue); |
|
229 } |
|
230 |
|
231 |
|
232 /** Reads a floating point setting. |
|
233 @param aKey Key of setting to be read. |
|
234 @param aValue Returns the value of the setting if it is a floating point value. |
|
235 @return |
|
236 KErrNone if successful, |
|
237 KErrAbort if in a transaction that has previously failed |
|
238 KErrPermissionDenied if caller fails capability check, |
|
239 KErrNotFound if the setting does not exist, |
|
240 KErrArgument if the setting exists but is not a floating point value, |
|
241 plus other system-wide error codes. |
|
242 @post Transactions fail only on those "other system-wide error codes". |
|
243 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
244 */ |
|
245 EXPORT_C TInt CRepository::Get(TUint32 aKey, TReal& aValue) |
|
246 { |
|
247 return (static_cast<CClientRepository*>(this))->Get(aKey, aValue); |
|
248 } |
|
249 |
|
250 |
|
251 /** Sets an existing floating point setting to a new value or creates a new setting |
|
252 with a floating point value if the setting doesn't exist. |
|
253 @param aKey Key of setting to be written to. |
|
254 @param aValue Value to be written. |
|
255 @return |
|
256 KErrNone if successful, |
|
257 KErrAbort if in a transaction that has previously failed |
|
258 KErrPermissionDenied if caller fails capability check, |
|
259 KErrArgument if the setting exists but is not a floating point value |
|
260 plus other system-wide error codes. |
|
261 @post |
|
262 Transactions fail on all error conditions. |
|
263 Outside transactions: on success the new value is persistent, |
|
264 on failure the repository is unmodified. |
|
265 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
266 */ |
|
267 EXPORT_C TInt CRepository::Set(TUint32 aKey, const TReal& aValue) |
|
268 { |
|
269 return (static_cast<CClientRepository*>(this))->Set(aKey, aValue); |
|
270 } |
|
271 |
|
272 |
|
273 /** Reads a descriptor setting. |
|
274 @param aKey Key of setting to be read. |
|
275 @param aValue Returns the value of the setting if it is a descriptor. |
|
276 @return |
|
277 KErrNone if successful, |
|
278 KErrAbort if in a transaction that has previously failed |
|
279 KErrPermissionDenied if caller fails capability check, |
|
280 KErrNotFound if the setting does not exist, |
|
281 KErrArgument if the setting exists but is not a descriptor, |
|
282 KErrOverflow if the descriptor is too small to receive the value in the repository, |
|
283 plus other system-wide error codes. |
|
284 @post Transactions fail only on those "other system-wide error codes". |
|
285 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
286 */ |
|
287 EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue) |
|
288 { |
|
289 return (static_cast<CClientRepository*>(this))->Get(aKey, aValue); |
|
290 } |
|
291 |
|
292 /** Reads a descriptor setting. |
|
293 @param aKey Key of setting to be read. |
|
294 @param aValue Returns the value of the setting if it is a descriptor. |
|
295 @param aActualLength Returns the actual length of the setting if it is a descriptor. |
|
296 @return |
|
297 KErrNone if successful, |
|
298 KErrAbort if in a transaction that has previously failed |
|
299 KErrPermissionDenied if caller fails capability check, |
|
300 KErrNotFound if the setting does not exist, |
|
301 KErrArgument if the setting exists but is not a descriptor, |
|
302 KErrOverflow if the descriptor is too small to receive the value in the repository, |
|
303 plus other system-wide error codes. |
|
304 @post Transactions fail only on those "other system-wide error codes". |
|
305 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
306 */ |
|
307 EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue, TInt& aActualLength) |
|
308 { |
|
309 return (static_cast<CClientRepository*>(this))->Get(aKey, aValue, aActualLength); |
|
310 } |
|
311 |
|
312 /** Sets an existing descriptor setting to a new value or creates a new setting |
|
313 with a descriptor value if the setting doesn't exist. |
|
314 @param aKey Key of setting to be written to. |
|
315 @param aValue Value to be written. |
|
316 @return |
|
317 KErrNone if successful, |
|
318 KErrAbort if in a transaction that has previously failed |
|
319 KErrPermissionDenied if caller fails capability check, |
|
320 KErrArgument if aValue is longer than KMaxBinaryLength or |
|
321 the setting exists but is not a descriptor, |
|
322 plus other system-wide error codes. |
|
323 @post |
|
324 Transactions fail on all error conditions. |
|
325 Outside transactions: on success the new value is persistent, |
|
326 on failure the repository is unmodified. |
|
327 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
328 */ |
|
329 EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC8& aValue) |
|
330 { |
|
331 return (static_cast<CClientRepository*>(this))->Set(aKey, aValue); |
|
332 } |
|
333 |
|
334 |
|
335 /** Reads a descriptor setting. |
|
336 @param aKey Key of setting to be read. |
|
337 @param aValue Returns the value of the setting if it is a descriptor. |
|
338 @return |
|
339 KErrNone if successful, |
|
340 KErrAbort if in a transaction that has previously failed |
|
341 KErrPermissionDenied if caller fails capability check, |
|
342 KErrNotFound if the setting does not exist, |
|
343 KErrArgument if the setting exists but is not a descriptor, |
|
344 KErrOverflow if the descriptor is too small to receive the value in the repository, |
|
345 plus other system-wide error codes. |
|
346 @post Transactions fail only on those "other system-wide error codes". |
|
347 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
348 */ |
|
349 EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue) |
|
350 { |
|
351 return (static_cast<CClientRepository*>(this))->Get(aKey, aValue); |
|
352 } |
|
353 |
|
354 /** Reads a descriptor setting. |
|
355 @param aKey Key of setting to be read. |
|
356 @param aValue Returns the value of the setting if it is a descriptor. |
|
357 @param aActualLength Returns the actual length of the setting if it is a descriptor. |
|
358 @return |
|
359 KErrNone if successful, |
|
360 KErrAbort if in a transaction that has previously failed |
|
361 KErrPermissionDenied if caller fails capability check, |
|
362 KErrNotFound if the setting does not exist, |
|
363 KErrArgument if the setting exists but is not a descriptor, |
|
364 KErrOverflow if the descriptor is too small to receive the value in the repository, |
|
365 plus other system-wide error codes. |
|
366 @post Transactions fail only on those "other system-wide error codes". |
|
367 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
368 */ |
|
369 EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue, TInt& aActualLength) |
|
370 { |
|
371 return (static_cast<CClientRepository*>(this))->Get(aKey, aValue, aActualLength); |
|
372 } |
|
373 |
|
374 /** Sets an existing descriptor setting to a new value or creates a new setting |
|
375 with a descriptor value if it doesn't exist. |
|
376 @param aKey Key of setting to be written to. |
|
377 @param aValue Value to be written. |
|
378 @return |
|
379 KErrNone if successful, |
|
380 KErrAbort if in a transaction that has previously failed |
|
381 KErrPermissionDenied if caller fails capability check, |
|
382 KErrArgument if aValue is longer than KMaxUnicodeStringLength or |
|
383 the setting exists but is not a descriptor, |
|
384 plus other system-wide error codes. |
|
385 @post |
|
386 Transactions fail on all error conditions. |
|
387 Outside transactions: on success the new value is persistent, |
|
388 on failure the repository is unmodified. |
|
389 @capability Dependent Caller must satisfy the write access policy of that key in the repository. |
|
390 */ |
|
391 EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC16& aValue) |
|
392 { |
|
393 return (static_cast<CClientRepository*>(this))->Set(aKey, aValue); |
|
394 } |
|
395 |
|
396 /** Reads the metadata bound to a key |
|
397 @param aKey The key |
|
398 @param aMeta Returns the metadata value for the key |
|
399 @return |
|
400 KErrNone if successful, |
|
401 KErrAbort if in a transaction that has previously failed |
|
402 KErrPermissionDenied if caller fails capability check, |
|
403 KErrNotFound if the setting does not exist, |
|
404 plus other system-wide error codes. |
|
405 @post Transactions fail only on those "other system-wide error codes". |
|
406 @capability Dependent Caller must satisfy the read access policy of that key in the repository. |
|
407 */ |
|
408 EXPORT_C TInt CRepository::GetMeta(TUint32 aKey, TUint32& aMeta) |
|
409 { |
|
410 return (static_cast<CClientRepository*>(this))->GetMeta(aKey, aMeta); |
|
411 } |
|
412 |
|
413 /** Moves all the settings that exist and match the specification: |
|
414 (oldkey & mask) == (sourcePartialKey & mask) |
|
415 to new locations where |
|
416 (newkey & mask) == (targetPartialKey & mask). |
|
417 For those keys that match the source specification, those bits in the key for |
|
418 which the corresponding mask bit is zero remain unchanged. All remaining bits |
|
419 change from (sourcePartialKey & mask) to (targetPartialKey & mask). |
|
420 Both partial keys are guaranteed to be masked before use. |
|
421 Examples of use: |
|
422 - To move a single key from oldKey to newKey. |
|
423 Move(oldKey, newKey, 0xFFFFFFFF, errorKey); |
|
424 - To move all keys from 0 to 0xFF to be from 0x100 to 0x1FF: |
|
425 Move(0, 0x100, 0xFFFFFF00, errorKey); |
|
426 (digits from 0 to 0xFF would be ignored if given in the partial keys) |
|
427 - To move all keys matching 0x5B??3A?6 to 0xDC??44?F: |
|
428 Move(0x5B003A06, 0xDC00440F, 0xFF00FF0F, errorKey); |
|
429 |
|
430 @param aSourcePartialKey |
|
431 Contains a bit pattern that all the source keys which must at least partially |
|
432 match. |
|
433 @param aMask |
|
434 Has bits set for all the bits in aPartialKey that must match the keys being moved. |
|
435 @param aTargetPartialKey |
|
436 Contains a bit pattern that all the target keys which must at least partially |
|
437 match. |
|
438 @param aErrorKey on failure, contains the key or partial key involved in the error |
|
439 or KUnspecifiedKey if failure could not be attributed to any key. |
|
440 @return |
|
441 KErrNone if successful, |
|
442 KErrAbort if in a transaction that has previously failed |
|
443 KErrNotFound if no items were found in the source range. |
|
444 KErrPermissionDenied if caller fails capability check, |
|
445 KErrAlreadyExists if an existing setting is using any intended target key. |
|
446 plus other system-wide error codes. |
|
447 @post |
|
448 Transactions fail on all error conditions except KErrNotFound. |
|
449 Outside transactions: on success the changes are persistent, on failure the |
|
450 repository is unmodified. |
|
451 @capability Dependent Caller must satisfy the read and write policies of all settings found in the |
|
452 source range, and write policies on all intended target keys. |
|
453 */ |
|
454 EXPORT_C TInt CRepository::Move (TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, |
|
455 TUint32 aMask, TUint32 &aErrorKey) |
|
456 { |
|
457 return (static_cast<CClientRepository*>(this))->Move(aSourcePartialKey, aTargetPartialKey, aMask, aErrorKey); |
|
458 } |
|
459 |
|
460 |
|
461 /** Finds all the settings that exist and match the specification given by |
|
462 aPartialKey and aMask. |
|
463 Matches occur whenever (key & mask) == (partialKey & mask). |
|
464 The partial key is guaranteed to be masked before use. |
|
465 @param aPartialKey |
|
466 Contains a bit pattern that all the keys returned must at least partially |
|
467 match. |
|
468 @param aMask |
|
469 Has bits set for all the bits in aPartialKey that must match the returned |
|
470 keys. |
|
471 @param aFoundKeys All the keys found. |
|
472 @return |
|
473 KErrNone if successful, |
|
474 KErrAbort if in a transaction that has previously failed |
|
475 KErrNotFound if no items were found in the source range, |
|
476 plus other system-wide error codes. |
|
477 @post Transactions fail only on those "other system-wide error codes". |
|
478 */ |
|
479 EXPORT_C TInt CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, |
|
480 RArray<TUint32>& aFoundKeys) |
|
481 { |
|
482 return (static_cast<CClientRepository*>(this))->FindL(aPartialKey, aMask, aFoundKeys); |
|
483 } |
|
484 |
|
485 |
|
486 /** Finds all the settings that contain a given integer and match the |
|
487 specification given by aPartialKey and aMask. |
|
488 @param aPartialKey |
|
489 Contains a bit pattern that all the keys returned must at least partially |
|
490 match. |
|
491 @param aMask |
|
492 Has bits set for all the bits in aPartialKey that must match the returned |
|
493 keys. |
|
494 @param aValue Settings for the keys found will be integers with value aValue. |
|
495 @param aFoundKeys All the keys found. |
|
496 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
497 the setting with key k is an integer aValue. |
|
498 @see FindL() |
|
499 @return |
|
500 KErrNone if successful, |
|
501 KErrAbort if in a transaction that has previously failed |
|
502 KErrPermissionDenied if caller fails capability check, |
|
503 KErrNotFound if capability check passed but no matching items are found, |
|
504 plus other system-wide error codes. |
|
505 @post Transactions fail only on those "other system-wide error codes". |
|
506 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
507 */ |
|
508 EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
509 TInt aValue, RArray<TUint32>& aFoundKeys) |
|
510 { |
|
511 return (static_cast<CClientRepository*>(this))->FindEqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
512 } |
|
513 |
|
514 |
|
515 /** Finds all the settings that contain a given floating point value and match |
|
516 the specification given by aPartialKey and aMask. |
|
517 @param aPartialKey |
|
518 Contains a bit pattern that all the keys returned must at least partially |
|
519 match. |
|
520 @param aMask |
|
521 Has bits set for all the bits in aPartialKey that must match the returned |
|
522 keys. |
|
523 @param aValue |
|
524 Settings for the keys found will be floating point values with value aValue. |
|
525 @param aFoundKeys All the keys found. |
|
526 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
527 the setting with key k is a floating point value aValue. |
|
528 @see FindL() |
|
529 @return |
|
530 KErrNone if successful, |
|
531 KErrAbort if in a transaction that has previously failed |
|
532 KErrPermissionDenied if caller fails capability check, |
|
533 KErrNotFound if capability check passed but no matching items are found, |
|
534 plus other system-wide error codes. |
|
535 @post Transactions fail only on those "other system-wide error codes". |
|
536 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
537 */ |
|
538 EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
539 const TReal& aValue, RArray<TUint32>& aFoundKeys) |
|
540 { |
|
541 return (static_cast<CClientRepository*>(this))->FindEqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
542 } |
|
543 |
|
544 |
|
545 /** Finds all the settings that contain a given string value and match the |
|
546 specification given by aPartialKey and aMask. |
|
547 @param aPartialKey |
|
548 Contains a bit pattern that all the keys returned must at least partially |
|
549 match. |
|
550 @param aMask |
|
551 Has bits set for all the bits in aPartialKey that must match the returned |
|
552 keys. |
|
553 @param aValue |
|
554 Settings for the keys found will be string values with value aValue. |
|
555 @param aFoundKeys All the keys found. |
|
556 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
557 the setting with key k is a string value aValue. |
|
558 @see FindL() |
|
559 @return |
|
560 KErrNone if successful, |
|
561 KErrAbort if in a transaction that has previously failed |
|
562 KErrPermissionDenied if caller fails capability check, |
|
563 KErrNotFound if capability check passed but no matching items are found, |
|
564 plus other system-wide error codes. |
|
565 @post Transactions fail only on those "other system-wide error codes". |
|
566 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
567 */ |
|
568 EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
569 const TDesC8& aValue, RArray<TUint32>& aFoundKeys) |
|
570 { |
|
571 return (static_cast<CClientRepository*>(this))->FindEqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
572 } |
|
573 |
|
574 |
|
575 /** Finds all the settings that contain a given string value and match the |
|
576 specification given by aPartialKey and aMask. |
|
577 @param aPartialKey |
|
578 Contains a bit pattern that all the keys returned must at least partially |
|
579 match. |
|
580 @param aMask |
|
581 Has bits set for all the bits in aPartialKey that must match the returned |
|
582 keys. |
|
583 @param aValue |
|
584 Settings for the keys found will be string values with value aValue. |
|
585 @param aFoundKeys All the keys found. |
|
586 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
587 the setting with key k is a string value aValue. |
|
588 @see FindL() |
|
589 @return |
|
590 KErrNone if successful, |
|
591 KErrAbort if in a transaction that has previously failed |
|
592 KErrPermissionDenied if caller fails capability check, |
|
593 KErrNotFound if capability check passed but no matching items are found, |
|
594 plus other system-wide error codes. |
|
595 @post Transactions fail only on those "other system-wide error codes". |
|
596 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
597 */ |
|
598 EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, |
|
599 const TDesC16& aValue, RArray<TUint32>& aFoundKeys) |
|
600 { |
|
601 return (static_cast<CClientRepository*>(this))->FindEqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
602 } |
|
603 |
|
604 |
|
605 /** Finds all the settings that match the specification given by aPartialKey |
|
606 and aMask, but are either not integer values or do not have the given value. |
|
607 @param aPartialKey |
|
608 Contains a bit pattern that all the keys returned must at least partially |
|
609 match. |
|
610 @param aMask |
|
611 Has bits set for all the bits in aPartialKey that must match the returned |
|
612 keys. |
|
613 @param aValue |
|
614 Settings for the keys found will be settings that either contain values |
|
615 that are not integers or integers other than aValue. |
|
616 @param aFoundKeys All the keys found. |
|
617 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
618 the setting with key k is either not an integer or an integer not equal to |
|
619 aValue. |
|
620 @see FindL() |
|
621 @return |
|
622 KErrNone if successful, |
|
623 KErrAbort if in a transaction that has previously failed |
|
624 KErrPermissionDenied if caller fails capability check, |
|
625 KErrNotFound if capability check passed but no non-matching items are found, |
|
626 plus other system-wide error codes. |
|
627 @post Transactions fail only on those "other system-wide error codes". |
|
628 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
629 */ |
|
630 EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
631 TInt aValue, RArray<TUint32>& aFoundKeys) |
|
632 { |
|
633 return (static_cast<CClientRepository*>(this))->FindNeqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
634 } |
|
635 |
|
636 |
|
637 /** Finds all the settings that match the specification given by aPartialKey |
|
638 and aMask, but are either not floating point values or do not have the given value. |
|
639 @param aPartialKey |
|
640 Contains a bit pattern that all the keys returned must at least partially |
|
641 match. |
|
642 @param aMask |
|
643 Has bits set for all the bits in aPartialKey that must match the returned |
|
644 keys. |
|
645 @param aValue |
|
646 Settings for the keys found will be settings that either contain values |
|
647 that are not floating point or floating point values other than aValue. |
|
648 @param aFoundKeys All the keys found. |
|
649 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
650 the setting with key k is either not a floating point value or a floating |
|
651 point value not equal to aValue. |
|
652 @see FindL() |
|
653 @return |
|
654 KErrNone if successful, |
|
655 KErrAbort if in a transaction that has previously failed |
|
656 KErrPermissionDenied if caller fails capability check, |
|
657 KErrNotFound if capability check passed but no non-matching items are found, |
|
658 plus other system-wide error codes. |
|
659 @post Transactions fail only on those "other system-wide error codes". |
|
660 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
661 */ |
|
662 EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
663 const TReal& aValue, RArray<TUint32>& aFoundKeys) |
|
664 { |
|
665 return (static_cast<CClientRepository*>(this))->FindNeqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
666 } |
|
667 |
|
668 |
|
669 /** Finds all the settings that match the specification given by aPartialKey |
|
670 and aMask, but are either not string values or do not match the given string. |
|
671 @param aPartialKey |
|
672 Contains a bit pattern that all the keys returned must at least partially |
|
673 match. |
|
674 @param aMask |
|
675 Has bits set for all the bits in aPartialKey that must match the returned |
|
676 keys. |
|
677 @param aValue |
|
678 Settings for the keys found will be settings that either contain values |
|
679 that are not strings or strings with value other than aValue. |
|
680 @param aFoundKeys All the keys found. |
|
681 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
682 the setting with key k is either not a string value or a string value not |
|
683 equal to aValue. |
|
684 @see FindL() |
|
685 @return |
|
686 KErrNone if successful, |
|
687 KErrAbort if in a transaction that has previously failed |
|
688 KErrPermissionDenied if caller fails capability check, |
|
689 KErrNotFound if capability check passed but no non-matching items are found, |
|
690 plus other system-wide error codes. |
|
691 @post Transactions fail only on those "other system-wide error codes". |
|
692 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
693 */ |
|
694 EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
695 const TDesC8& aValue, RArray<TUint32>& aFoundKeys) |
|
696 { |
|
697 return (static_cast<CClientRepository*>(this))->FindNeqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
698 } |
|
699 |
|
700 /** Finds all the settings that match the specification given by aPartialKey |
|
701 and aMask, but are either not string values or do not match the given string. |
|
702 @param aPartialKey |
|
703 Contains a bit pattern that all the keys returned must at least partially |
|
704 match. |
|
705 @param aMask |
|
706 Has bits set for all the bits in aPartialKey that must match the returned |
|
707 keys. |
|
708 @param aValue |
|
709 Settings for the keys found will be settings that either contain values |
|
710 that are not strings or strings with value other than aValue. |
|
711 @param aFoundKeys All the keys found. |
|
712 For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and |
|
713 the setting with key k is either not a string value or a string value not |
|
714 equal to aValue. |
|
715 @see FindL() |
|
716 @return |
|
717 KErrNone if successful, |
|
718 KErrAbort if in a transaction that has previously failed |
|
719 KErrPermissionDenied if caller fails capability check, |
|
720 KErrNotFound if capability check passed but no non-matching items are found, |
|
721 plus other system-wide error codes. |
|
722 @post Transactions fail only on those "other system-wide error codes". |
|
723 @capability Dependent Caller must satisfy the read policies of all settings found in the source range. |
|
724 */ |
|
725 EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, |
|
726 const TDesC16& aValue, RArray<TUint32>& aFoundKeys) |
|
727 { |
|
728 return (static_cast<CClientRepository*>(this))->FindNeqL(aPartialKey, aMask, aValue, aFoundKeys); |
|
729 } |
|
730 |
|
731 |
|
732 /** Requests a notification if the value of a given setting changes. |
|
733 Only one notification can be received per call to NotifyRequest. |
|
734 Only one notification per setting per CRepository may be active at any one |
|
735 time. |
|
736 @param aKey The key setting to be informed about. |
|
737 @param aStatus The object that will receive the notification. On a successful |
|
738 outcome, this will contain the Uid of the changed setting. |
|
739 If there is an existing notification on the same setting and same session, aStatus |
|
740 will be set to KErrAlreadyExists and the return value will be KErrNone. |
|
741 @return |
|
742 KErrNone if successful or if aStatus is set to KErrAlreadyExists. |
|
743 KErrPermissionDenied if caller fails capability check. |
|
744 KErrNotFound if the requested setting does not exist. |
|
745 @capability Note The caller must satisfy the relevant access policies for the repository |
|
746 */ |
|
747 EXPORT_C TInt CRepository::NotifyRequest(TUint32 aKey, TRequestStatus& aStatus) |
|
748 { |
|
749 return (static_cast<CClientRepository*>(this))->NotifyRequest(aKey, aStatus); |
|
750 } |
|
751 |
|
752 |
|
753 /** Cancels a notification previously requested from the two-argument overload |
|
754 of NotifyRequest. |
|
755 @param aKey The parameter to the previous call to NotifyRequest to be cancelled. |
|
756 @return KErrNone The method always returns KErrNone. |
|
757 */ |
|
758 EXPORT_C TInt CRepository::NotifyCancel(TUint32 aKey) |
|
759 { |
|
760 //We deliberately ignore the return value from the server and return KErrNone because |
|
761 //it is incorrect for a cancel function to return an error code - if there is no |
|
762 //outstanding notification then the cancel should do nothing. |
|
763 (void)(static_cast<CClientRepository*>(this))->NotifyCancel(aKey); |
|
764 return KErrNone; |
|
765 } |
|
766 |
|
767 |
|
768 /** Cancels all uncompleted notifications from this CRepository. |
|
769 @return KErrNone The method always returns KErrNone. |
|
770 */ |
|
771 EXPORT_C TInt CRepository::NotifyCancelAll() |
|
772 { |
|
773 //We deliberately ignore the return value from the server and return KErrNone because |
|
774 //it is incorrect for a cancel function to return an error code - if there is no |
|
775 //outstanding notification then the cancel should do nothing. |
|
776 (void)(static_cast<CClientRepository*>(this))->NotifyCancelAll(); |
|
777 return KErrNone; |
|
778 } |
|
779 |
|
780 |
|
781 /** Requests a notification if the value of a given setting changes. |
|
782 Only one notification can be received per call to NotifyRequest. |
|
783 Only one notification per setting per CRepository may be active at any one |
|
784 time. |
|
785 @param aPartialKey The partial key setting to be informed about. |
|
786 @param aMask The mask to be used with the partial key. |
|
787 @param aStatus The object that will receive the notification. On a successful |
|
788 outcome, this will contain the Uid of the changed setting. |
|
789 On error the error code is stored in aStatus and KErrNone is returned. |
|
790 @return |
|
791 KErrNone The method always returns KErrNone. |
|
792 @capability Note The caller must satisfy the relevant access policies for the repository |
|
793 */ |
|
794 EXPORT_C TInt CRepository::NotifyRequest(TUint32 aPartialKey, TUint32 aMask, |
|
795 TRequestStatus& aStatus) |
|
796 { |
|
797 return (static_cast<CClientRepository*>(this)) |
|
798 ->NotifyRequest(aPartialKey, aMask, aStatus); |
|
799 } |
|
800 |
|
801 |
|
802 /** Cancels a notification previously requested from the three-argument overload |
|
803 of NotifyRequest. |
|
804 @param aPartialKey The parameter to the previous call to NotifyRequest to be cancelled. |
|
805 @param aMask The mask to be used with the partial key |
|
806 @return KErrNone The method always returns KErrNone. |
|
807 */ |
|
808 EXPORT_C TInt CRepository::NotifyCancel(TUint32 aPartialKey, TUint32 aMask) |
|
809 { |
|
810 (void)(static_cast<CClientRepository*>(this))->NotifyCancel(aPartialKey, aMask); |
|
811 return KErrNone; |
|
812 } |
|
813 |
|
814 |
|
815 /** Resets the whole repository to the state of the initialization file |
|
816 originally used to set it up. Not currently supported in transactions. |
|
817 @return |
|
818 KErrNone if successful, |
|
819 KErrNotSupported if this client session is in a transaction |
|
820 plus other system-wide error codes. |
|
821 @post Fails transaction if called when session is in one. |
|
822 @capability Dependent The caller must satisfy the relevant access policies for the repository |
|
823 */ |
|
824 EXPORT_C TInt CRepository::Reset() |
|
825 { |
|
826 return (static_cast<CClientRepository*>(this))->Reset(); |
|
827 } |
|
828 |
|
829 |
|
830 /** Resets the a setting within the repository to the state of the setting |
|
831 described by the initialization file originally used to set the repository up. |
|
832 Not currently supported in transactions. |
|
833 @param aKey Key of setting to be reset. |
|
834 @return |
|
835 KErrNone if successful, |
|
836 KErrNotSupported if this client session is in a transaction |
|
837 plus other system-wide error codes. |
|
838 @post Fails transaction if called when session is in one. |
|
839 @capability Note The caller must satisfy the relevant access policies for the repository |
|
840 */ |
|
841 EXPORT_C TInt CRepository::Reset(TUint32 aKey) |
|
842 { |
|
843 return (static_cast<CClientRepository*>(this))->Reset(aKey); |
|
844 } |
|
845 |
|
846 |
|
847 /** Attempts to starts a transaction in the given mode. |
|
848 Consistency and persistence of all values read and written during the transaction |
|
849 is only guaranteed after a successful return from CommitTransaction. |
|
850 @param aMode transaction mode: EConcurrentReadWriteTransaction (standard), |
|
851 EReadTransaction or EReadWriteTransaction. |
|
852 @return KErrNone if successful - guaranteed for EConcurrentReadWriteTransaction, |
|
853 KErrLocked for other transaction types if read or write locks held by other clients |
|
854 prevent transaction from starting. |
|
855 @see CRepository::TTransactionMode |
|
856 @pre Must not be in a transaction. |
|
857 @post If it returns KErrNone: in a transaction; Any other error code: not in a transaction. |
|
858 @panic CENREPCLI 3 Panics client if this session is already in a transaction. |
|
859 */ |
|
860 EXPORT_C TInt CRepository::StartTransaction(TTransactionMode aMode) |
|
861 { |
|
862 return (static_cast<CClientRepository*>(this))->StartTransaction(aMode); |
|
863 } |
|
864 |
|
865 |
|
866 /** Attempts to starts a transaction in the given mode asynchronously to |
|
867 allow client to avoid being blocked by server activity before starting. |
|
868 Consistency and persistence of all values read and written during the transaction |
|
869 is only guaranteed after a successful return from CommitTransaction. |
|
870 Use CancelTransaction to cancel asynchronous request. |
|
871 @param aMode transaction mode: EConcurrentReadWriteTransaction (standard), |
|
872 EReadTransaction or EReadWriteTransaction. |
|
873 @see CRepository::TTransactionMode |
|
874 @param aStatus On completion of asynchronous request: KErrNone if successful - |
|
875 guaranteed for EConcurrentReadWriteTransaction unless cancelled, |
|
876 KErrLocked for other transaction types if read or write locks held by other clients |
|
877 prevent transaction from starting. |
|
878 @pre Must not be in a transaction. |
|
879 @post If it completes with KErrNone and request not cancelled: in a transaction; |
|
880 Any other error code or request cancelled: not in a transaction. |
|
881 @panic CENREPCLI 3 Panics client if this session is already in a transaction. |
|
882 */ |
|
883 EXPORT_C void CRepository::StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus) |
|
884 { |
|
885 (static_cast<CClientRepository*>(this))->StartTransaction(aMode, aStatus); |
|
886 } |
|
887 |
|
888 |
|
889 /** Commits a transaction. A successful return guarantees the consistency and |
|
890 persistence of all values read and written during the transaction. |
|
891 @return KErrNone on success, or error code giving first reason for failing. |
|
892 If KErrLocked is returned for EConcurrentReadWriteTransaction, transaction |
|
893 was interrupted by another client committing changes and should be repeated. |
|
894 @param aKeyInfo |
|
895 On success: returns the number of keys whose values were modified. |
|
896 On failure: returns the key or partial key involved in the first error, or |
|
897 KUnspecifiedKey if failure could not be attributed to any key. |
|
898 @pre Must be in a transaction. |
|
899 @post Not in a transaction. On success, changes have been made persistent. On failure, |
|
900 transaction changes have been rolled back. |
|
901 @panic CENREPCLI 4 Panics client if this session is not in a transaction. |
|
902 */ |
|
903 EXPORT_C TInt CRepository::CommitTransaction(TUint32& aKeyInfo) |
|
904 { |
|
905 return (static_cast<CClientRepository*>(this))->CommitTransaction(aKeyInfo); |
|
906 } |
|
907 |
|
908 |
|
909 /** Commits a transaction asynchronously to allow client to avoid being blocked |
|
910 during the persist operation and other server activity. A successful return guarantees |
|
911 the consistency and persistence of all values read and written during the transaction. |
|
912 Use CancelTransaction to cancel asynchronous request. |
|
913 @param aKeyInfo |
|
914 A descriptor to receive a TUint32 value, e.g. TTransactionKeyInfoBuf, which |
|
915 client must ensure remains in scope for the duration of the asynchronous request. |
|
916 On success: returns the number of keys whose values were modified. |
|
917 On failure: returns the key or partial key involved in the first error, or |
|
918 KUnspecifiedKey if failure could not be attributed to any key. |
|
919 @see CRepository::TTransactionKeyInfoBuf |
|
920 @param aStatus Completion status of asynchronous request: |
|
921 On success (if not cancelled): KErrNone; |
|
922 On failure: error code giving first reason for failing. |
|
923 If KErrLocked is returned for EConcurrentReadWriteTransaction, transaction |
|
924 was interrupted by another client committing changes and should be repeated. |
|
925 @pre Must be in a transaction. |
|
926 @post Cannot assume that transaction is "pending commit" as may have completed already. |
|
927 Once request is complete, session is not in a transaction: on success, changes |
|
928 have been made persistent; on failure, transaction changes have been rolled back. |
|
929 @panic CENREPCLI 4 Panics client if this session is not in a transaction. |
|
930 */ |
|
931 EXPORT_C void CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus) |
|
932 { |
|
933 (static_cast<CClientRepository*>(this))->CommitTransaction(aKeyInfo, aStatus); |
|
934 } |
|
935 |
|
936 |
|
937 /** Cancels the current transaction with rollback: discards any uncommitted changes. |
|
938 If the transaction is pending start or commit asynchronously, the request is |
|
939 completed with KErrCancel (unless it had already completed). |
|
940 @post Not in a transaction. |
|
941 */ |
|
942 EXPORT_C void CRepository::CancelTransaction() |
|
943 { |
|
944 (static_cast<CClientRepository*>(this))->CancelTransaction(); |
|
945 } |
|
946 |
|
947 |
|
948 /** Pushes onto the CleanupStack a TCleanupItem that calls CancelTransaction if |
|
949 activated by a Leave or PopAndDestroy. Important for releasing transaction resources |
|
950 including caches and read/write locks held over the repository. |
|
951 @post CleanupStack has another item on it which must be popped later with |
|
952 CleanupStack::Pop() or similar. |
|
953 */ |
|
954 EXPORT_C void CRepository::CleanupCancelTransactionPushL() |
|
955 { |
|
956 (static_cast<CClientRepository*>(this))->CleanupCancelTransactionPushL(); |
|
957 } |
|
958 |
|
959 |
|
960 /** Sets the active transaction to a failed state, releasing cache and locks but |
|
961 keeping it open. Has no effect when not in an active transaction, including when it |
|
962 has already failed or when pending asynchronous start or commit request completion. |
|
963 Use in preference to CancelTransaction whenever it is inappropriate to close the |
|
964 transaction at the time. |
|
965 @post |
|
966 If previously in an active transaction: It is marked as failed. All uncommitted |
|
967 changes are discarded. Transaction resources including cache and read/write locks |
|
968 are released in the repository. All subsequent operations in the transaction fail |
|
969 until it is closed by CancelTransaction or CommitTransaction. CommitTransaction |
|
970 will fail and return KErrAbort. |
|
971 */ |
|
972 EXPORT_C void CRepository::FailTransaction() |
|
973 { |
|
974 (static_cast<CClientRepository*>(this))->FailTransaction(); |
|
975 } |
|
976 |
|
977 |
|
978 /** Pushes onto the CleanupStack a TCleanupItem that calls FailTransaction if |
|
979 activated by a Leave or PopAndDestroy. |
|
980 @post CleanupStack has another item on it which must be popped later with |
|
981 CleanupStack::Pop() or similar. |
|
982 */ |
|
983 EXPORT_C void CRepository::CleanupFailTransactionPushL() |
|
984 { |
|
985 (static_cast<CClientRepository*>(this))->CleanupFailTransactionPushL(); |
|
986 } |