sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "centralrepository.h"
|
sl@0
|
17 |
#include "heaprepos.h"
|
sl@0
|
18 |
#include "datatype.h"
|
sl@0
|
19 |
#include "pccenrepimpl.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
/** Creates a CRepository object for accessing a repository.
|
sl@0
|
22 |
If there is no such repository, the function leaves with KErrNotFound.
|
sl@0
|
23 |
A pointer to the object is left on the cleanup stack.
|
sl@0
|
24 |
@param aRepositoryUid The UID of the repository to be accessed
|
sl@0
|
25 |
@return A pointer to a newly created CRepository object
|
sl@0
|
26 |
@capability None
|
sl@0
|
27 |
*/
|
sl@0
|
28 |
EXPORT_C CRepository* CRepository::NewLC(TUid aRepositoryUid)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
CRepository* self=new (ELeave)CRepository();
|
sl@0
|
31 |
CleanupStack::PushL(self);
|
sl@0
|
32 |
self->ConstructL(aRepositoryUid,KNullDesC,KNullDesC,ETrue);
|
sl@0
|
33 |
return self;
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
/** Creates a CRepository object for accessing a repository.
|
sl@0
|
38 |
If there is no such repository, the function leaves with KErrNotFound.
|
sl@0
|
39 |
@param aRepositoryUid The UID of the repository to be accessed
|
sl@0
|
40 |
@return A pointer to a newly created CRepository object
|
sl@0
|
41 |
@capability None
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
EXPORT_C CRepository* CRepository::NewL(TUid aRepositoryUid)
|
sl@0
|
44 |
{
|
sl@0
|
45 |
CRepository* self=CRepository::NewLC(aRepositoryUid);
|
sl@0
|
46 |
CleanupStack::Pop();
|
sl@0
|
47 |
return self;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
/**
|
sl@0
|
51 |
Creates a CRepository object for accessing a repository specified in the input file
|
sl@0
|
52 |
@param aInputFileName the location of the input file it should be in the format <file_path><XXXXXXXX><.txt/.cre> where XXXXXXXX is a 32 bit hex number
|
sl@0
|
53 |
@param aOutputFileName the location fo the output it should be in the format <file_path><XXXXXXXX><.cre> where XXXXXXX is a 32 bit hex number
|
sl@0
|
54 |
@leave KErrArgument if the file specified in the input and output do not follow the specification above
|
sl@0
|
55 |
KErrCorrupt if the input file is corrupted
|
sl@0
|
56 |
KErrNoMemory if run out of memory
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
EXPORT_C CRepository* CRepository::NewL(const TDesC& aInputRepositoryFile,const TDesC& aOutputRepositoryFile)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
CRepository* self=CRepository::NewLC(aInputRepositoryFile,aOutputRepositoryFile);
|
sl@0
|
61 |
CleanupStack::Pop();
|
sl@0
|
62 |
return self;
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
Creates a CRepository object for accessing a repository specified in the input file.
|
sl@0
|
67 |
A pointer to the object is left on the cleanup stack.
|
sl@0
|
68 |
@param aInputFileName the location of the input file it should be in the format <file_path><XXXXXXXX><.txt/.cre> where XXXXXXXX is a 32 bit hex number
|
sl@0
|
69 |
@param aOutputFileName the location fo the output it should be in the format <file_path><XXXXXXXX><.cre> where XXXXXXX is a 32 bit hex number
|
sl@0
|
70 |
@leave KErrArgument if the file specified in the input and output do not follow the specification above
|
sl@0
|
71 |
KErrCorrupt if the input file is corrupted
|
sl@0
|
72 |
KErrNoMemory if run out of memory
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
EXPORT_C CRepository* CRepository::NewLC(const TDesC& aInputRepositoryFile,const TDesC& aOutputRepositoryFile)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
CRepository* self=new (ELeave)CRepository();
|
sl@0
|
77 |
CleanupStack::PushL(self);
|
sl@0
|
78 |
self->ConstructL(KNullUid,aInputRepositoryFile,aOutputRepositoryFile,EFalse);
|
sl@0
|
79 |
return self;
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
void CRepository::ConstructL(TUid aRepositoryUid,const TDesC& aInFileName,const TDesC& aOutFileName,TBool aAutoLoading)
|
sl@0
|
83 |
{
|
sl@0
|
84 |
iImpl = CPcRepImpl::NewL(aRepositoryUid,aInFileName,aOutFileName,aAutoLoading);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
/**
|
sl@0
|
88 |
Flush any content of the repository in the heap to physical file, the target file is either the explicitly
|
sl@0
|
89 |
specified output file or the implicitly determined output file depending on which NewL function is used
|
sl@0
|
90 |
to construct the repository
|
sl@0
|
91 |
@return KErrNone if successful,
|
sl@0
|
92 |
plus other system-wide error codes.
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
EXPORT_C TInt CRepository::Flush()
|
sl@0
|
95 |
{
|
sl@0
|
96 |
return iImpl->Flush();
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
/** Destructor.
|
sl@0
|
100 |
@capability None
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
EXPORT_C CRepository::~CRepository()
|
sl@0
|
103 |
{
|
sl@0
|
104 |
delete iImpl;
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
|
sl@0
|
108 |
/** Creates a new setting with an integer value.
|
sl@0
|
109 |
@param aKey New setting key.
|
sl@0
|
110 |
@param aValue Setting value.
|
sl@0
|
111 |
@return
|
sl@0
|
112 |
KErrNone if successful,
|
sl@0
|
113 |
KErrAlreadyExists if a setting with that key already exists
|
sl@0
|
114 |
plus other system-wide error codes.
|
sl@0
|
115 |
@post
|
sl@0
|
116 |
Transactions fail on all error conditions.
|
sl@0
|
117 |
Outside transactions: on success the new setting is persistent,
|
sl@0
|
118 |
on failure the repository is unmodified.
|
sl@0
|
119 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
120 |
*/
|
sl@0
|
121 |
EXPORT_C TInt CRepository::Create(TUint32 aKey, TInt aValue)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
|
sl@0
|
124 |
return err;
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
/** Creates a new setting with a floating-point value.
|
sl@0
|
129 |
@param aKey New setting key.
|
sl@0
|
130 |
@param aValue Setting value.
|
sl@0
|
131 |
@return
|
sl@0
|
132 |
KErrNone if successful,
|
sl@0
|
133 |
KErrAlreadyExists if a setting with that key already exists
|
sl@0
|
134 |
plus other system-wide error codes.
|
sl@0
|
135 |
@post
|
sl@0
|
136 |
Transactions fail on all error conditions.
|
sl@0
|
137 |
Outside transactions: on success the new setting is persistent,
|
sl@0
|
138 |
on failure the repository is unmodified.
|
sl@0
|
139 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
140 |
*/
|
sl@0
|
141 |
EXPORT_C TInt CRepository::Create(TUint32 aKey, const TReal& aValue)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
|
sl@0
|
144 |
return err;
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
|
sl@0
|
148 |
/** Creates a new setting with a descriptor value.
|
sl@0
|
149 |
@param aKey New setting key.
|
sl@0
|
150 |
@param aValue Setting value.
|
sl@0
|
151 |
@return
|
sl@0
|
152 |
KErrNone if successful,
|
sl@0
|
153 |
KErrAlreadyExists if a setting with that key already exists
|
sl@0
|
154 |
KErrArgument if the descriptor is longer than KMaxBinaryLength,
|
sl@0
|
155 |
plus other system-wide error codes.
|
sl@0
|
156 |
@post
|
sl@0
|
157 |
Transactions fail on all error conditions.
|
sl@0
|
158 |
Outside transactions: on success the new setting is persistent,
|
sl@0
|
159 |
on failure the repository is unmodified.
|
sl@0
|
160 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
161 |
*/
|
sl@0
|
162 |
EXPORT_C TInt CRepository::Create(TUint32 aKey, const TDesC8& aValue)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
if (aValue.Length()>KMaxBinaryLength)
|
sl@0
|
165 |
return KErrArgument;
|
sl@0
|
166 |
TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
|
sl@0
|
167 |
return err;
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
/** Creates a new setting with a descriptor value.
|
sl@0
|
171 |
@param aKey New setting key.
|
sl@0
|
172 |
@param aValue Setting value.
|
sl@0
|
173 |
@return
|
sl@0
|
174 |
KErrNone if successful,
|
sl@0
|
175 |
KErrAlreadyExists if a setting with that key already exists
|
sl@0
|
176 |
KErrArgument if the descriptor is longer than KMaxUnicodeStringLength,
|
sl@0
|
177 |
plus other system-wide error codes.
|
sl@0
|
178 |
@post
|
sl@0
|
179 |
Transactions fail on all error conditions.
|
sl@0
|
180 |
Outside transactions: on success the new setting is persistent,
|
sl@0
|
181 |
on failure the repository is unmodified.
|
sl@0
|
182 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
183 |
*/
|
sl@0
|
184 |
EXPORT_C TInt CRepository::Create(TUint32 aKey, const TDesC16& aValue)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
if (aValue.Length()>KMaxUnicodeStringLength)
|
sl@0
|
187 |
return KErrArgument;
|
sl@0
|
188 |
TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);
|
sl@0
|
189 |
return Create(aKey,pVal);
|
sl@0
|
190 |
}
|
sl@0
|
191 |
|
sl@0
|
192 |
/** Deletes a setting.
|
sl@0
|
193 |
@param aKey Key of setting to be deleted.
|
sl@0
|
194 |
@return
|
sl@0
|
195 |
KErrNone if successful,
|
sl@0
|
196 |
KErrNotFound if the setting does not exist,
|
sl@0
|
197 |
plus other system-wide error codes.
|
sl@0
|
198 |
@post
|
sl@0
|
199 |
Transactions fail on all error conditions except KErrNotFound.
|
sl@0
|
200 |
Outside transactions: on success the deletion of the setting is persistent,
|
sl@0
|
201 |
on failure the repository is unmodified.
|
sl@0
|
202 |
@capability Dependent Caller must satisfy the write access policy for that key in the repository
|
sl@0
|
203 |
*/
|
sl@0
|
204 |
EXPORT_C TInt CRepository::Delete(TUint32 aKey)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
TRAPD(err,iImpl->DeleteSettingL(aKey));
|
sl@0
|
207 |
iImpl->RemoveAnyMarkDeleted();
|
sl@0
|
208 |
return err;
|
sl@0
|
209 |
}
|
sl@0
|
210 |
|
sl@0
|
211 |
/** Deletes all the settings that exist and match the specification:
|
sl@0
|
212 |
(key & mask) == (partialKey & mask)
|
sl@0
|
213 |
Partial key is guaranteed to be masked before use.
|
sl@0
|
214 |
Examples of use:
|
sl@0
|
215 |
- To delete a single key.
|
sl@0
|
216 |
Delete(key, 0xFFFFFFFF, errorKey);
|
sl@0
|
217 |
- To delete all keys from 0 to 0xFF:
|
sl@0
|
218 |
Delete(0, 0xFFFFFF00, errorKey);
|
sl@0
|
219 |
(digits from 0 to 0xFF would be ignored if given in the partial key)
|
sl@0
|
220 |
- To delete all keys matching 0x5B??3A?6:
|
sl@0
|
221 |
Delete(0x5B003A06, 0xFF00FF0F, errorKey);
|
sl@0
|
222 |
|
sl@0
|
223 |
@param aPartialKey
|
sl@0
|
224 |
Contains a bit pattern that all the keys must at least partially
|
sl@0
|
225 |
match.
|
sl@0
|
226 |
@param aMask
|
sl@0
|
227 |
Has bits set for all the bits in aPartialKey that must match the keys being deleted.
|
sl@0
|
228 |
@param aErrorKey If the delete operation fails this contains the key involved in the
|
sl@0
|
229 |
failure, or aPartialKey or KUnspecifiedKey if it could not be attributed to any key
|
sl@0
|
230 |
@return
|
sl@0
|
231 |
KErrNone if successful,
|
sl@0
|
232 |
KErrNotFound if no items were found in the partial key range.
|
sl@0
|
233 |
plus other system-wide error codes.
|
sl@0
|
234 |
@post
|
sl@0
|
235 |
Transactions fail on all error conditions except KErrNotFound
|
sl@0
|
236 |
Outside transactions: on success the changes are persistent, on failure the
|
sl@0
|
237 |
repository is unmodified.
|
sl@0
|
238 |
@capability Dependent Caller must satisfy the write policies of all settings found in the
|
sl@0
|
239 |
partial key range.
|
sl@0
|
240 |
*/
|
sl@0
|
241 |
EXPORT_C TInt CRepository::Delete(TUint32 aPartialKey, TUint32 aMask, TUint32& aErrorKey)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
TRAPD(ret,iImpl->DeleteRangeL(aPartialKey,aMask,aErrorKey));
|
sl@0
|
244 |
return ret;
|
sl@0
|
245 |
}
|
sl@0
|
246 |
|
sl@0
|
247 |
|
sl@0
|
248 |
/** Reads an integer setting.
|
sl@0
|
249 |
@param aKey Key of setting to be read.
|
sl@0
|
250 |
@param aValue Returns the value of the setting if it is an integer.
|
sl@0
|
251 |
@return
|
sl@0
|
252 |
KErrNone if successful,
|
sl@0
|
253 |
KErrNotFound if the setting does not exist,
|
sl@0
|
254 |
KErrArgument if the setting exists but is not an integer,
|
sl@0
|
255 |
plus other system-wide error codes.
|
sl@0
|
256 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
257 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
258 |
*/
|
sl@0
|
259 |
EXPORT_C TInt CRepository::Get(TUint32 aKey, TInt& aValue)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
return iImpl->Get(aKey,aValue);
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
/** Reads a floating point setting.
|
sl@0
|
265 |
@param aKey Key of setting to be read.
|
sl@0
|
266 |
@param aValue Returns the value of the setting if it is a floating point value.
|
sl@0
|
267 |
@return
|
sl@0
|
268 |
KErrNone if successful,
|
sl@0
|
269 |
KErrNotFound if the setting does not exist,
|
sl@0
|
270 |
KErrArgument if the setting exists but is not a floating point value,
|
sl@0
|
271 |
plus other system-wide error codes.
|
sl@0
|
272 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
273 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
274 |
*/
|
sl@0
|
275 |
EXPORT_C TInt CRepository::Get(TUint32 aKey, TReal& aValue)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
return iImpl->Get(aKey,aValue);
|
sl@0
|
278 |
}
|
sl@0
|
279 |
|
sl@0
|
280 |
/** Reads a descriptor setting.
|
sl@0
|
281 |
@param aKey Key of setting to be read.
|
sl@0
|
282 |
@param aValue Returns the value of the setting if it is a descriptor.
|
sl@0
|
283 |
@return
|
sl@0
|
284 |
KErrNone if successful,
|
sl@0
|
285 |
KErrNotFound if the setting does not exist,
|
sl@0
|
286 |
KErrArgument if the setting exists but is not a descriptor,
|
sl@0
|
287 |
KErrOverflow if the descriptor is too small to receive the value in the repository,
|
sl@0
|
288 |
plus other system-wide error codes.
|
sl@0
|
289 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
290 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
291 |
*/
|
sl@0
|
292 |
EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue)
|
sl@0
|
293 |
{
|
sl@0
|
294 |
TInt actual;
|
sl@0
|
295 |
return Get(aKey,aValue,actual);
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
/** Reads a descriptor setting.
|
sl@0
|
299 |
@param aKey Key of setting to be read.
|
sl@0
|
300 |
@param aValue Returns the value of the setting if it is a descriptor.
|
sl@0
|
301 |
@param aActualLength Returns the actual length of the setting if it is a descriptor.
|
sl@0
|
302 |
@return
|
sl@0
|
303 |
KErrNone if successful,
|
sl@0
|
304 |
KErrNotFound if the setting does not exist,
|
sl@0
|
305 |
KErrArgument if the setting exists but is not a descriptor,
|
sl@0
|
306 |
KErrOverflow if the descriptor is too small to receive the value in the repository,
|
sl@0
|
307 |
plus other system-wide error codes.
|
sl@0
|
308 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
309 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
310 |
*/
|
sl@0
|
311 |
EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue, TInt& aActualLength)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
TBuf8<KMaxBinaryLength> val;
|
sl@0
|
314 |
TInt ret = iImpl->Get(aKey, val);
|
sl@0
|
315 |
if (ret==KErrNone)
|
sl@0
|
316 |
{
|
sl@0
|
317 |
TInt settingValueLength=val.Length();
|
sl@0
|
318 |
//now check whether any string overflow
|
sl@0
|
319 |
if (settingValueLength > aValue.MaxLength())
|
sl@0
|
320 |
{
|
sl@0
|
321 |
aActualLength=settingValueLength;
|
sl@0
|
322 |
aValue.Copy(val.Left(aValue.MaxLength()));
|
sl@0
|
323 |
return KErrOverflow;
|
sl@0
|
324 |
}
|
sl@0
|
325 |
else
|
sl@0
|
326 |
{
|
sl@0
|
327 |
aValue.Copy(val);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
}
|
sl@0
|
330 |
return ret;
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
/** Reads a descriptor setting.
|
sl@0
|
334 |
@param aKey Key of setting to be read.
|
sl@0
|
335 |
@param aValue Returns the value of the setting if it is a descriptor.
|
sl@0
|
336 |
@return
|
sl@0
|
337 |
KErrNone if successful,
|
sl@0
|
338 |
KErrNotFound if the setting does not exist,
|
sl@0
|
339 |
KErrArgument if the setting exists but is not a descriptor,
|
sl@0
|
340 |
KErrOverflow if the descriptor is too small to receive the value in the repository,
|
sl@0
|
341 |
plus other system-wide error codes.
|
sl@0
|
342 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
343 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
344 |
*/
|
sl@0
|
345 |
EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue)
|
sl@0
|
346 |
{
|
sl@0
|
347 |
TPtr8 ptr8((TUint8*)aValue.Ptr(), 0, aValue.MaxSize());
|
sl@0
|
348 |
TInt ret=Get(aKey,ptr8);
|
sl@0
|
349 |
if (ret==KErrNone)
|
sl@0
|
350 |
aValue.SetLength(ptr8.Length()/2);
|
sl@0
|
351 |
return ret;
|
sl@0
|
352 |
}
|
sl@0
|
353 |
|
sl@0
|
354 |
/** Reads a descriptor setting.
|
sl@0
|
355 |
@param aKey Key of setting to be read.
|
sl@0
|
356 |
@param aValue Returns the value of the setting if it is a descriptor.
|
sl@0
|
357 |
@param aActualLength Returns the actual length of the setting if it is a descriptor.
|
sl@0
|
358 |
@return
|
sl@0
|
359 |
KErrNone if successful,
|
sl@0
|
360 |
KErrNotFound if the setting does not exist,
|
sl@0
|
361 |
KErrArgument if the setting exists but is not a descriptor,
|
sl@0
|
362 |
KErrOverflow if the descriptor is too small to receive the value in the repository,
|
sl@0
|
363 |
plus other system-wide error codes.
|
sl@0
|
364 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
365 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
366 |
*/
|
sl@0
|
367 |
EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue, TInt& aActualLength)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
TInt actualLength8;
|
sl@0
|
370 |
TPtr8 ptr8((TUint8*)aValue.Ptr(), 0, aValue.MaxSize());
|
sl@0
|
371 |
TInt ret=Get(aKey,ptr8,actualLength8);
|
sl@0
|
372 |
aValue.SetLength(ptr8.Length()/2);
|
sl@0
|
373 |
aActualLength=actualLength8/2;
|
sl@0
|
374 |
return ret;
|
sl@0
|
375 |
}
|
sl@0
|
376 |
|
sl@0
|
377 |
/** Sets an existing integer setting to a new value or creates a new setting
|
sl@0
|
378 |
with an integer value if the setting doesn't exist.
|
sl@0
|
379 |
@param aKey Key of setting to be written to.
|
sl@0
|
380 |
@param aValue Value to be written.
|
sl@0
|
381 |
@return
|
sl@0
|
382 |
KErrNone if successful,
|
sl@0
|
383 |
KErrArgument if the setting exists but is not an integer
|
sl@0
|
384 |
plus other system-wide error codes.
|
sl@0
|
385 |
@post
|
sl@0
|
386 |
Transactions fail on all error conditions.
|
sl@0
|
387 |
Outside transactions: on success the new value is persistent,
|
sl@0
|
388 |
on failure the repository is unmodified.
|
sl@0
|
389 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
390 |
*/
|
sl@0
|
391 |
EXPORT_C TInt CRepository::Set(TUint32 aKey, TInt aValue)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
TRAPD(err,iImpl->SetSettingL(aKey,aValue));
|
sl@0
|
394 |
return err;
|
sl@0
|
395 |
}
|
sl@0
|
396 |
|
sl@0
|
397 |
/** Sets an existing floating point setting to a new value or creates a new setting
|
sl@0
|
398 |
with a floating point value if the setting doesn't exist.
|
sl@0
|
399 |
@param aKey Key of setting to be written to.
|
sl@0
|
400 |
@param aValue Value to be written.
|
sl@0
|
401 |
@return
|
sl@0
|
402 |
KErrNone if successful,
|
sl@0
|
403 |
KErrArgument if the setting exists but is not a floating point value
|
sl@0
|
404 |
plus other system-wide error codes.
|
sl@0
|
405 |
@post
|
sl@0
|
406 |
Transactions fail on all error conditions.
|
sl@0
|
407 |
Outside transactions: on success the new value is persistent,
|
sl@0
|
408 |
on failure the repository is unmodified.
|
sl@0
|
409 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
410 |
*/
|
sl@0
|
411 |
EXPORT_C TInt CRepository::Set(TUint32 aKey, const TReal& aValue)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
TRAPD(err,iImpl->SetSettingL(aKey,aValue));
|
sl@0
|
414 |
return err;
|
sl@0
|
415 |
}
|
sl@0
|
416 |
|
sl@0
|
417 |
/** Sets an existing descriptor setting to a new value or creates a new setting
|
sl@0
|
418 |
with a descriptor value if the setting doesn't exist.
|
sl@0
|
419 |
@param aKey Key of setting to be written to.
|
sl@0
|
420 |
@param aValue Value to be written.
|
sl@0
|
421 |
@return
|
sl@0
|
422 |
KErrNone if successful,
|
sl@0
|
423 |
KErrArgument if aValue is longer than KMaxBinaryLength or
|
sl@0
|
424 |
the setting exists but is not a descriptor,
|
sl@0
|
425 |
plus other system-wide error codes.
|
sl@0
|
426 |
@post
|
sl@0
|
427 |
Transactions fail on all error conditions.
|
sl@0
|
428 |
Outside transactions: on success the new value is persistent,
|
sl@0
|
429 |
on failure the repository is unmodified.
|
sl@0
|
430 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
431 |
*/
|
sl@0
|
432 |
EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC8& aValue)
|
sl@0
|
433 |
{
|
sl@0
|
434 |
if (aValue.Length()>KMaxBinaryLength)
|
sl@0
|
435 |
return KErrArgument;
|
sl@0
|
436 |
TRAPD(err,iImpl->SetSettingL(aKey,aValue));
|
sl@0
|
437 |
return err;
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
/** Sets an existing descriptor setting to a new value or creates a new setting
|
sl@0
|
441 |
with a descriptor value if it doesn't exist.
|
sl@0
|
442 |
@param aKey Key of setting to be written to.
|
sl@0
|
443 |
@param aValue Value to be written.
|
sl@0
|
444 |
@return
|
sl@0
|
445 |
KErrNone if successful,
|
sl@0
|
446 |
KErrArgument if aValue is longer than KMaxUnicodeStringLength or
|
sl@0
|
447 |
the setting exists but is not a descriptor,
|
sl@0
|
448 |
plus other system-wide error codes.
|
sl@0
|
449 |
@post
|
sl@0
|
450 |
Transactions fail on all error conditions.
|
sl@0
|
451 |
Outside transactions: on success the new value is persistent,
|
sl@0
|
452 |
on failure the repository is unmodified.
|
sl@0
|
453 |
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
|
sl@0
|
454 |
*/
|
sl@0
|
455 |
EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC16& aValue)
|
sl@0
|
456 |
{
|
sl@0
|
457 |
if (aValue.Length()>KMaxUnicodeStringLength)
|
sl@0
|
458 |
return KErrArgument;
|
sl@0
|
459 |
TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);
|
sl@0
|
460 |
return Set(aKey,pVal);
|
sl@0
|
461 |
}
|
sl@0
|
462 |
|
sl@0
|
463 |
/** Reads the metadata bound to a key
|
sl@0
|
464 |
@param aKey The key
|
sl@0
|
465 |
@param aMeta Returns the metadata value for the key
|
sl@0
|
466 |
@return
|
sl@0
|
467 |
KErrNone if successful,
|
sl@0
|
468 |
KErrNotFound if the setting does not exist,
|
sl@0
|
469 |
plus other system-wide error codes.
|
sl@0
|
470 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
471 |
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
|
sl@0
|
472 |
*/
|
sl@0
|
473 |
EXPORT_C TInt CRepository::GetMeta(TUint32 aKey, TUint32& aMeta)
|
sl@0
|
474 |
{
|
sl@0
|
475 |
return iImpl->GetMeta(aKey,aMeta);
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
/** Moves all the settings that exist and match the specification:
|
sl@0
|
479 |
(oldkey & mask) == (sourcePartialKey & mask)
|
sl@0
|
480 |
to new locations where
|
sl@0
|
481 |
(newkey & mask) == (targetPartialKey & mask).
|
sl@0
|
482 |
For those keys that match the source specification, those bits in the key for
|
sl@0
|
483 |
which the corresponding mask bit is zero remain unchanged. All remaining bits
|
sl@0
|
484 |
change from (sourcePartialKey & mask) to (targetPartialKey & mask).
|
sl@0
|
485 |
Both partial keys are guaranteed to be masked before use.
|
sl@0
|
486 |
Examples of use:
|
sl@0
|
487 |
- To move a single key from oldKey to newKey.
|
sl@0
|
488 |
Move(oldKey, newKey, 0xFFFFFFFF, errorKey);
|
sl@0
|
489 |
- To move all keys from 0 to 0xFF to be from 0x100 to 0x1FF:
|
sl@0
|
490 |
Move(0, 0x100, 0xFFFFFF00, errorKey);
|
sl@0
|
491 |
(digits from 0 to 0xFF would be ignored if given in the partial keys)
|
sl@0
|
492 |
- To move all keys matching 0x5B??3A?6 to 0xDC??44?F:
|
sl@0
|
493 |
Move(0x5B003A06, 0xDC00440F, 0xFF00FF0F, errorKey);
|
sl@0
|
494 |
|
sl@0
|
495 |
@param aSourcePartialKey
|
sl@0
|
496 |
Contains a bit pattern that all the source keys which must at least partially
|
sl@0
|
497 |
match.
|
sl@0
|
498 |
@param aMask
|
sl@0
|
499 |
Has bits set for all the bits in aPartialKey that must match the keys being moved.
|
sl@0
|
500 |
@param aTargetPartialKey
|
sl@0
|
501 |
Contains a bit pattern that all the target keys which must at least partially
|
sl@0
|
502 |
match.
|
sl@0
|
503 |
@param aErrorKey on failure, contains the key or partial key involved in the error
|
sl@0
|
504 |
or KUnspecifiedKey if failure could not be attributed to any key.
|
sl@0
|
505 |
@return
|
sl@0
|
506 |
KErrNone if successful,
|
sl@0
|
507 |
KErrNotFound if no items were found in the source range.
|
sl@0
|
508 |
KErrAlreadyExists if an existing setting is using any intended target key.
|
sl@0
|
509 |
plus other system-wide error codes.
|
sl@0
|
510 |
@post
|
sl@0
|
511 |
Transactions fail on all error conditions except KErrNotFound.
|
sl@0
|
512 |
Outside transactions: on success the changes are persistent, on failure the
|
sl@0
|
513 |
repository is unmodified.
|
sl@0
|
514 |
@capability Dependent Caller must satisfy the read and write policies of all settings found in the
|
sl@0
|
515 |
source range, and write policies on all intended target keys.
|
sl@0
|
516 |
*/
|
sl@0
|
517 |
EXPORT_C TInt CRepository::Move (TUint32 aSourcePartialKey, TUint32 aTargetPartialKey,
|
sl@0
|
518 |
TUint32 aMask, TUint32& aErrorKey)
|
sl@0
|
519 |
{
|
sl@0
|
520 |
TRAPD(ret,iImpl->MoveL(aSourcePartialKey,aTargetPartialKey,aMask,aErrorKey));
|
sl@0
|
521 |
return ret;
|
sl@0
|
522 |
}
|
sl@0
|
523 |
|
sl@0
|
524 |
|
sl@0
|
525 |
/** Finds all the settings that exist and match the specification given by
|
sl@0
|
526 |
aPartialKey and aMask.
|
sl@0
|
527 |
Matches occur whenever (key & mask) == (partialKey & mask).
|
sl@0
|
528 |
The partial key is guaranteed to be masked before use.
|
sl@0
|
529 |
@param aPartialKey
|
sl@0
|
530 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
531 |
match.
|
sl@0
|
532 |
@param aMask
|
sl@0
|
533 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
534 |
keys.
|
sl@0
|
535 |
@param aFoundKeys All the keys found.
|
sl@0
|
536 |
@return
|
sl@0
|
537 |
KErrNone if successful,
|
sl@0
|
538 |
KErrNotFound if no items were found in the source range,
|
sl@0
|
539 |
plus other system-wide error codes.
|
sl@0
|
540 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
541 |
*/
|
sl@0
|
542 |
EXPORT_C TInt CRepository::FindL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
543 |
RArray<TUint32>& aFoundKeys)
|
sl@0
|
544 |
{
|
sl@0
|
545 |
RArray<TUint32> dummy;
|
sl@0
|
546 |
TRAPD(ret,iImpl->FindL(aPartialKey,aMask,aFoundKeys,KMaximumKey,dummy));
|
sl@0
|
547 |
if (ret==KErrNoMemory)
|
sl@0
|
548 |
User::LeaveNoMemory();
|
sl@0
|
549 |
return ret;
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
|
sl@0
|
553 |
/** Finds all the settings that contain a given integer and match the
|
sl@0
|
554 |
specification given by aPartialKey and aMask.
|
sl@0
|
555 |
@param aPartialKey
|
sl@0
|
556 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
557 |
match.
|
sl@0
|
558 |
@param aMask
|
sl@0
|
559 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
560 |
keys.
|
sl@0
|
561 |
@param aValue Settings for the keys found will be integers with value aValue.
|
sl@0
|
562 |
@param aFoundKeys All the keys found.
|
sl@0
|
563 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
564 |
the setting with key k is an integer aValue.
|
sl@0
|
565 |
@see FindL()
|
sl@0
|
566 |
@return
|
sl@0
|
567 |
KErrNone if successful,
|
sl@0
|
568 |
KErrNotFound if capability check passed but no matching items are found,
|
sl@0
|
569 |
plus other system-wide error codes.
|
sl@0
|
570 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
571 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
572 |
*/
|
sl@0
|
573 |
EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
574 |
TInt aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
575 |
{
|
sl@0
|
576 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,EEqual,aFoundKeys));
|
sl@0
|
577 |
if (ret==KErrNoMemory)
|
sl@0
|
578 |
User::LeaveNoMemory();
|
sl@0
|
579 |
return ret;
|
sl@0
|
580 |
}
|
sl@0
|
581 |
|
sl@0
|
582 |
|
sl@0
|
583 |
/** Finds all the settings that contain a given floating point value and match
|
sl@0
|
584 |
the specification given by aPartialKey and aMask.
|
sl@0
|
585 |
@param aPartialKey
|
sl@0
|
586 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
587 |
match.
|
sl@0
|
588 |
@param aMask
|
sl@0
|
589 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
590 |
keys.
|
sl@0
|
591 |
@param aValue
|
sl@0
|
592 |
Settings for the keys found will be floating point values with value aValue.
|
sl@0
|
593 |
@param aFoundKeys All the keys found.
|
sl@0
|
594 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
595 |
the setting with key k is a floating point value aValue.
|
sl@0
|
596 |
@see FindL()
|
sl@0
|
597 |
@return
|
sl@0
|
598 |
KErrNone if successful,
|
sl@0
|
599 |
KErrNotFound if capability check passed but no matching items are found,
|
sl@0
|
600 |
plus other system-wide error codes.
|
sl@0
|
601 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
602 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
603 |
*/
|
sl@0
|
604 |
EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
605 |
const TReal& aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
606 |
{
|
sl@0
|
607 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,EEqual,aFoundKeys));
|
sl@0
|
608 |
if (ret==KErrNoMemory)
|
sl@0
|
609 |
User::LeaveNoMemory();
|
sl@0
|
610 |
return ret;
|
sl@0
|
611 |
}
|
sl@0
|
612 |
|
sl@0
|
613 |
|
sl@0
|
614 |
/** Finds all the settings that contain a given string value and match the
|
sl@0
|
615 |
specification given by aPartialKey and aMask.
|
sl@0
|
616 |
@param aPartialKey
|
sl@0
|
617 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
618 |
match.
|
sl@0
|
619 |
@param aMask
|
sl@0
|
620 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
621 |
keys.
|
sl@0
|
622 |
@param aValue
|
sl@0
|
623 |
Settings for the keys found will be string values with value aValue.
|
sl@0
|
624 |
@param aFoundKeys All the keys found.
|
sl@0
|
625 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
626 |
the setting with key k is a string value aValue.
|
sl@0
|
627 |
@see FindL()
|
sl@0
|
628 |
@return
|
sl@0
|
629 |
KErrNone if successful,
|
sl@0
|
630 |
KErrNotFound if capability check passed but no matching items are found,
|
sl@0
|
631 |
plus other system-wide error codes.
|
sl@0
|
632 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
633 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
634 |
*/
|
sl@0
|
635 |
EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
636 |
const TDesC8& aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
637 |
{
|
sl@0
|
638 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,EEqual,aFoundKeys));
|
sl@0
|
639 |
if (ret==KErrNoMemory)
|
sl@0
|
640 |
User::LeaveNoMemory();
|
sl@0
|
641 |
return ret;
|
sl@0
|
642 |
}
|
sl@0
|
643 |
|
sl@0
|
644 |
|
sl@0
|
645 |
/** Finds all the settings that contain a given string value and match the
|
sl@0
|
646 |
specification given by aPartialKey and aMask.
|
sl@0
|
647 |
|
sl@0
|
648 |
@param aPartialKey
|
sl@0
|
649 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
650 |
match.
|
sl@0
|
651 |
@param aMask
|
sl@0
|
652 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
653 |
keys.
|
sl@0
|
654 |
@param aValue
|
sl@0
|
655 |
Settings for the keys found will be string values with value aValue.
|
sl@0
|
656 |
@param aFoundKeys All the keys found.
|
sl@0
|
657 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
658 |
the setting with key k is a string value aValue.
|
sl@0
|
659 |
@see FindL()
|
sl@0
|
660 |
@return
|
sl@0
|
661 |
KErrNone if successful,
|
sl@0
|
662 |
KErrNotFound if capability check passed but no matching items are found,
|
sl@0
|
663 |
plus other system-wide error codes.
|
sl@0
|
664 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
665 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
666 |
*/
|
sl@0
|
667 |
EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
668 |
const TDesC16& aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
669 |
{
|
sl@0
|
670 |
TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);
|
sl@0
|
671 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,pVal,EEqual,aFoundKeys));
|
sl@0
|
672 |
if (ret==KErrNoMemory)
|
sl@0
|
673 |
User::LeaveNoMemory();
|
sl@0
|
674 |
return ret;
|
sl@0
|
675 |
}
|
sl@0
|
676 |
|
sl@0
|
677 |
|
sl@0
|
678 |
/** Finds all the settings that match the specification given by aPartialKey
|
sl@0
|
679 |
and aMask, but are either not integer values or do not have the given value.
|
sl@0
|
680 |
@param aPartialKey
|
sl@0
|
681 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
682 |
match.
|
sl@0
|
683 |
@param aMask
|
sl@0
|
684 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
685 |
keys.
|
sl@0
|
686 |
@param aValue
|
sl@0
|
687 |
Settings for the keys found will be settings that either contain values
|
sl@0
|
688 |
that are not integers or integers other than aValue.
|
sl@0
|
689 |
@param aFoundKeys All the keys found.
|
sl@0
|
690 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
691 |
the setting with key k is either not an integer or an integer not equal to
|
sl@0
|
692 |
aValue.
|
sl@0
|
693 |
@see FindL()
|
sl@0
|
694 |
@return
|
sl@0
|
695 |
KErrNone if successful,
|
sl@0
|
696 |
KErrNotFound if capability check passed but no non-matching items are found,
|
sl@0
|
697 |
plus other system-wide error codes.
|
sl@0
|
698 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
699 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
700 |
*/
|
sl@0
|
701 |
EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
702 |
TInt aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
703 |
{
|
sl@0
|
704 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,ENotEqual,aFoundKeys));
|
sl@0
|
705 |
if (ret==KErrNoMemory)
|
sl@0
|
706 |
User::LeaveNoMemory();
|
sl@0
|
707 |
return ret;
|
sl@0
|
708 |
}
|
sl@0
|
709 |
|
sl@0
|
710 |
|
sl@0
|
711 |
/** Finds all the settings that match the specification given by aPartialKey
|
sl@0
|
712 |
and aMask, but are either not floating point values or do not have the given value.
|
sl@0
|
713 |
@param aPartialKey
|
sl@0
|
714 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
715 |
match.
|
sl@0
|
716 |
@param aMask
|
sl@0
|
717 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
718 |
keys.
|
sl@0
|
719 |
@param aValue
|
sl@0
|
720 |
Settings for the keys found will be settings that either contain values
|
sl@0
|
721 |
that are not floating point or floating point values other than aValue.
|
sl@0
|
722 |
@param aFoundKeys All the keys found.
|
sl@0
|
723 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
724 |
the setting with key k is either not a floating point value or a floating
|
sl@0
|
725 |
point value not equal to aValue.
|
sl@0
|
726 |
@see FindL()
|
sl@0
|
727 |
@return
|
sl@0
|
728 |
KErrNone if successful,
|
sl@0
|
729 |
KErrNotFound if capability check passed but no non-matching items are found,
|
sl@0
|
730 |
plus other system-wide error codes.
|
sl@0
|
731 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
732 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
733 |
*/
|
sl@0
|
734 |
EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
735 |
const TReal& aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
736 |
{
|
sl@0
|
737 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,ENotEqual,aFoundKeys));
|
sl@0
|
738 |
if (ret==KErrNoMemory)
|
sl@0
|
739 |
User::LeaveNoMemory();
|
sl@0
|
740 |
return ret;
|
sl@0
|
741 |
}
|
sl@0
|
742 |
|
sl@0
|
743 |
|
sl@0
|
744 |
/** Finds all the settings that match the specification given by aPartialKey
|
sl@0
|
745 |
and aMask, but are either not string values or do not match the given string.
|
sl@0
|
746 |
@param aPartialKey
|
sl@0
|
747 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
748 |
match.
|
sl@0
|
749 |
@param aMask
|
sl@0
|
750 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
751 |
keys.
|
sl@0
|
752 |
@param aValue
|
sl@0
|
753 |
Settings for the keys found will be settings that either contain values
|
sl@0
|
754 |
that are not strings or strings with value other than aValue.
|
sl@0
|
755 |
@param aFoundKeys All the keys found.
|
sl@0
|
756 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
757 |
the setting with key k is either not a string value or a string value not
|
sl@0
|
758 |
equal to aValue.
|
sl@0
|
759 |
@see FindL()
|
sl@0
|
760 |
@return
|
sl@0
|
761 |
KErrNone if successful,
|
sl@0
|
762 |
KErrNotFound if capability check passed but no non-matching items are found,
|
sl@0
|
763 |
plus other system-wide error codes.
|
sl@0
|
764 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
765 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
766 |
*/
|
sl@0
|
767 |
EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
768 |
const TDesC8& aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
769 |
{
|
sl@0
|
770 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,ENotEqual,aFoundKeys));
|
sl@0
|
771 |
if (ret==KErrNoMemory)
|
sl@0
|
772 |
User::LeaveNoMemory();
|
sl@0
|
773 |
return ret;
|
sl@0
|
774 |
}
|
sl@0
|
775 |
|
sl@0
|
776 |
/** Finds all the settings that match the specification given by aPartialKey
|
sl@0
|
777 |
and aMask, but are either not string values or do not match the given string.
|
sl@0
|
778 |
@param aPartialKey
|
sl@0
|
779 |
Contains a bit pattern that all the keys returned must at least partially
|
sl@0
|
780 |
match.
|
sl@0
|
781 |
@param aMask
|
sl@0
|
782 |
Has bits set for all the bits in aPartialKey that must match the returned
|
sl@0
|
783 |
keys.
|
sl@0
|
784 |
@param aValue
|
sl@0
|
785 |
Settings for the keys found will be settings that either contain values
|
sl@0
|
786 |
that are not strings or strings with value other than aValue.
|
sl@0
|
787 |
@param aFoundKeys All the keys found.
|
sl@0
|
788 |
For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
|
sl@0
|
789 |
the setting with key k is either not a string value or a string value not
|
sl@0
|
790 |
equal to aValue.
|
sl@0
|
791 |
@see FindL()
|
sl@0
|
792 |
@return
|
sl@0
|
793 |
KErrNone if successful,
|
sl@0
|
794 |
KErrNotFound if capability check passed but no non-matching items are found,
|
sl@0
|
795 |
plus other system-wide error codes.
|
sl@0
|
796 |
@post Transactions fail only on those "other system-wide error codes".
|
sl@0
|
797 |
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
|
sl@0
|
798 |
*/
|
sl@0
|
799 |
EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
|
sl@0
|
800 |
const TDesC16& aValue, RArray<TUint32>& aFoundKeys)
|
sl@0
|
801 |
{
|
sl@0
|
802 |
TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);
|
sl@0
|
803 |
TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,pVal,ENotEqual,aFoundKeys));
|
sl@0
|
804 |
if (ret==KErrNoMemory)
|
sl@0
|
805 |
User::LeaveNoMemory();
|
sl@0
|
806 |
return ret;
|
sl@0
|
807 |
}
|
sl@0
|
808 |
|
sl@0
|
809 |
/** Attempts to starts a transaction in the given mode.
|
sl@0
|
810 |
This function is doing nothing and just return KErrNone
|
sl@0
|
811 |
@param aMode transaction mode: EConcurrentReadWriteTransaction (standard),
|
sl@0
|
812 |
EReadTransaction or EReadWriteTransaction.
|
sl@0
|
813 |
@return KErrNone
|
sl@0
|
814 |
@see CRepository::TTransactionMode
|
sl@0
|
815 |
*/
|
sl@0
|
816 |
EXPORT_C TInt CRepository::StartTransaction(TTransactionMode /**aMode*/)
|
sl@0
|
817 |
{
|
sl@0
|
818 |
return KErrNone;
|
sl@0
|
819 |
}
|
sl@0
|
820 |
|
sl@0
|
821 |
|
sl@0
|
822 |
/** Attempts to starts a transaction in the given mode asynchronously
|
sl@0
|
823 |
This function does nothing
|
sl@0
|
824 |
@param aMode transaction mode: EConcurrentReadWriteTransaction (standard),
|
sl@0
|
825 |
EReadTransaction or EReadWriteTransaction.
|
sl@0
|
826 |
@see CRepository::TTransactionMode
|
sl@0
|
827 |
@param aStatus No effect on this parameter
|
sl@0
|
828 |
*/
|
sl@0
|
829 |
EXPORT_C void CRepository::StartTransaction(TTransactionMode /**aMode*/, TRequestStatus& /**aStatus*/)
|
sl@0
|
830 |
{
|
sl@0
|
831 |
return;
|
sl@0
|
832 |
}
|
sl@0
|
833 |
|
sl@0
|
834 |
|
sl@0
|
835 |
/** Commits a transaction.
|
sl@0
|
836 |
This function does nothing and just return KErrNone
|
sl@0
|
837 |
@return KErrNone
|
sl@0
|
838 |
@param aKeyInfo no effect on this parameter
|
sl@0
|
839 |
*/
|
sl@0
|
840 |
EXPORT_C TInt CRepository::CommitTransaction(TUint32& /**aKeyInfo*/)
|
sl@0
|
841 |
{
|
sl@0
|
842 |
return KErrNone;
|
sl@0
|
843 |
}
|
sl@0
|
844 |
|
sl@0
|
845 |
|
sl@0
|
846 |
/** Commits a transaction asynchronously
|
sl@0
|
847 |
This function does nothing
|
sl@0
|
848 |
@param aKeyInfo
|
sl@0
|
849 |
A descriptor to receive a TUint32 value, e.g. TTransactionKeyInfoBuf, which
|
sl@0
|
850 |
client must ensure remains in scope for the duration of the asynchronous request.
|
sl@0
|
851 |
No effect on this input parameter
|
sl@0
|
852 |
@see CRepository::TTransactionKeyInfoBuf
|
sl@0
|
853 |
@param aStatus Completion status of asynchronous request:
|
sl@0
|
854 |
No effect on this input parameter
|
sl@0
|
855 |
*/
|
sl@0
|
856 |
EXPORT_C void CRepository::CommitTransaction(TDes8& /**aKeyInfo*/, TRequestStatus& /**aStatus*/)
|
sl@0
|
857 |
{
|
sl@0
|
858 |
return;
|
sl@0
|
859 |
}
|
sl@0
|
860 |
|
sl@0
|
861 |
|
sl@0
|
862 |
/** Cancels the current transaction with rollback
|
sl@0
|
863 |
This function does nothing
|
sl@0
|
864 |
*/
|
sl@0
|
865 |
EXPORT_C void CRepository::CancelTransaction()
|
sl@0
|
866 |
{
|
sl@0
|
867 |
}
|
sl@0
|
868 |
|
sl@0
|
869 |
/** Sets the active transaction to a failed state
|
sl@0
|
870 |
This function does nothing
|
sl@0
|
871 |
*/
|
sl@0
|
872 |
EXPORT_C void CRepository::FailTransaction()
|
sl@0
|
873 |
{
|
sl@0
|
874 |
}
|
sl@0
|
875 |
|
sl@0
|
876 |
/** Pushes onto the CleanupStack a TCleanupItem that calls CancelTransaction if
|
sl@0
|
877 |
activated by a Leave or PopAndDestroy.
|
sl@0
|
878 |
This function does nothing
|
sl@0
|
879 |
*/
|
sl@0
|
880 |
EXPORT_C void CRepository::CleanupCancelTransactionPushL()
|
sl@0
|
881 |
{
|
sl@0
|
882 |
CleanupStack::PushL(TCleanupItem(CPcRepImpl::FailTransactionCleanupOperation, this));
|
sl@0
|
883 |
}
|
sl@0
|
884 |
|
sl@0
|
885 |
/** Pushes onto the CleanupStack a TCleanupItem that calls FailTransaction if
|
sl@0
|
886 |
activated by a Leave or PopAndDestroy.
|
sl@0
|
887 |
This function does nothing
|
sl@0
|
888 |
*/
|
sl@0
|
889 |
EXPORT_C void CRepository::CleanupFailTransactionPushL()
|
sl@0
|
890 |
{
|
sl@0
|
891 |
CleanupStack::PushL(TCleanupItem(CPcRepImpl::FailTransactionCleanupOperation, this));
|
sl@0
|
892 |
}
|
sl@0
|
893 |
|