os/persistentdata/persistentstorage/centralrepository/pccenrep/src/pccenrep.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/centralrepository/pccenrep/src/pccenrep.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,893 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "centralrepository.h"
    1.20 +#include "heaprepos.h"
    1.21 +#include "datatype.h"
    1.22 +#include "pccenrepimpl.h"
    1.23 +
    1.24 +/** Creates a CRepository object for accessing a repository.
    1.25 +If there is no such repository, the function leaves with KErrNotFound.
    1.26 +A pointer to the object is left on the cleanup stack.
    1.27 +@param aRepositoryUid The UID of the repository to be accessed
    1.28 +@return A pointer to a newly created CRepository object
    1.29 +@capability None
    1.30 +*/
    1.31 +EXPORT_C CRepository* CRepository::NewLC(TUid aRepositoryUid)
    1.32 +	{
    1.33 +	CRepository* self=new (ELeave)CRepository();
    1.34 +	CleanupStack::PushL(self);
    1.35 +	self->ConstructL(aRepositoryUid,KNullDesC,KNullDesC,ETrue);
    1.36 +	return self;
    1.37 +	}
    1.38 +
    1.39 +
    1.40 +/** Creates a CRepository object for accessing a repository.
    1.41 +If there is no such repository, the function leaves with KErrNotFound.
    1.42 +@param aRepositoryUid The UID of the repository to be accessed
    1.43 +@return A pointer to a newly created CRepository object
    1.44 +@capability None
    1.45 +*/
    1.46 +EXPORT_C CRepository* CRepository::NewL(TUid aRepositoryUid)
    1.47 +	{
    1.48 +	CRepository* self=CRepository::NewLC(aRepositoryUid);
    1.49 +	CleanupStack::Pop();
    1.50 +	return self;
    1.51 +	}
    1.52 +
    1.53 +/**
    1.54 +Creates a CRepository object for accessing a repository specified in the input file
    1.55 +@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
    1.56 +@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
    1.57 +@leave KErrArgument if the file specified in the input and output do not follow the specification above
    1.58 +	 KErrCorrupt if the input file is corrupted
    1.59 +   	 KErrNoMemory if run out of memory
    1.60 +*/
    1.61 +EXPORT_C CRepository* CRepository::NewL(const TDesC& aInputRepositoryFile,const TDesC& aOutputRepositoryFile)	
    1.62 +	{
    1.63 +	CRepository* self=CRepository::NewLC(aInputRepositoryFile,aOutputRepositoryFile);
    1.64 +	CleanupStack::Pop();
    1.65 +	return self;		
    1.66 +	}
    1.67 +
    1.68 +/**
    1.69 +Creates a CRepository object for accessing a repository specified in the input file.
    1.70 +A pointer to the object is left on the cleanup stack.
    1.71 +@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
    1.72 +@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
    1.73 +@leave KErrArgument if the file specified in the input and output do not follow the specification above
    1.74 +	 KErrCorrupt if the input file is corrupted
    1.75 +   	 KErrNoMemory if run out of memory
    1.76 +*/
    1.77 +EXPORT_C CRepository* CRepository::NewLC(const TDesC& aInputRepositoryFile,const TDesC& aOutputRepositoryFile)
    1.78 +	{
    1.79 +	CRepository* self=new (ELeave)CRepository();
    1.80 +	CleanupStack::PushL(self);
    1.81 +	self->ConstructL(KNullUid,aInputRepositoryFile,aOutputRepositoryFile,EFalse);
    1.82 +	return self;
    1.83 +	}
    1.84 +
    1.85 +void CRepository::ConstructL(TUid aRepositoryUid,const TDesC& aInFileName,const TDesC& aOutFileName,TBool aAutoLoading)
    1.86 +	{
    1.87 +	iImpl = CPcRepImpl::NewL(aRepositoryUid,aInFileName,aOutFileName,aAutoLoading);
    1.88 +	}
    1.89 +
    1.90 +/**
    1.91 +Flush any content of the repository in the heap to physical file, the target file is either the explicitly
    1.92 +specified output file or the implicitly determined output file depending on which NewL function is used
    1.93 +to construct the repository
    1.94 +@return KErrNone if successful,
    1.95 +	plus other system-wide error codes.
    1.96 +*/
    1.97 +EXPORT_C TInt CRepository::Flush()
    1.98 +	{
    1.99 +	return iImpl->Flush();
   1.100 +	}
   1.101 +
   1.102 +/** Destructor. 
   1.103 +@capability None
   1.104 +*/
   1.105 +EXPORT_C CRepository::~CRepository()
   1.106 +	{
   1.107 +	delete iImpl;
   1.108 +	}
   1.109 +
   1.110 +
   1.111 +/** Creates a new setting with an integer value.
   1.112 +@param aKey New setting key.
   1.113 +@param aValue Setting value.
   1.114 +@return
   1.115 +	KErrNone if successful,
   1.116 +	KErrAlreadyExists if a setting with that key already exists
   1.117 +	plus other system-wide error codes.
   1.118 +@post
   1.119 +	Transactions fail on all error conditions.
   1.120 +	Outside transactions: on success the new setting is persistent,
   1.121 +	on failure the repository is unmodified.
   1.122 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.123 +*/
   1.124 +EXPORT_C TInt CRepository::Create(TUint32 aKey, TInt aValue)
   1.125 +	{
   1.126 +	TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
   1.127 +	return err;
   1.128 +	}
   1.129 +
   1.130 +
   1.131 +/** Creates a new setting with a floating-point value.
   1.132 +@param aKey New setting key.
   1.133 +@param aValue Setting value.
   1.134 +@return
   1.135 +	KErrNone if successful,
   1.136 +	KErrAlreadyExists if a setting with that key already exists
   1.137 +	plus other system-wide error codes.
   1.138 +@post
   1.139 +	Transactions fail on all error conditions.
   1.140 +	Outside transactions: on success the new setting is persistent,
   1.141 +	on failure the repository is unmodified.
   1.142 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.143 +*/
   1.144 +EXPORT_C TInt CRepository::Create(TUint32 aKey, const TReal& aValue)
   1.145 +	{
   1.146 +	TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
   1.147 +	return err;
   1.148 +	}
   1.149 +
   1.150 +
   1.151 +/** Creates a new setting with a descriptor value.
   1.152 +@param aKey New setting key.
   1.153 +@param aValue Setting value.
   1.154 +@return
   1.155 +	KErrNone if successful,
   1.156 +	KErrAlreadyExists if a setting with that key already exists
   1.157 +	KErrArgument if the descriptor is longer than KMaxBinaryLength,
   1.158 +	plus other system-wide error codes.
   1.159 +@post
   1.160 +	Transactions fail on all error conditions.
   1.161 +	Outside transactions: on success the new setting is persistent,
   1.162 +	on failure the repository is unmodified.
   1.163 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.164 +*/
   1.165 +EXPORT_C TInt CRepository::Create(TUint32 aKey, const TDesC8& aValue)
   1.166 +	{
   1.167 +	if (aValue.Length()>KMaxBinaryLength)
   1.168 +		return KErrArgument;	
   1.169 +	TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
   1.170 +	return err;	
   1.171 +	}
   1.172 +
   1.173 +/** Creates a new setting with a descriptor value.
   1.174 +@param aKey New setting key.
   1.175 +@param aValue Setting value.
   1.176 +@return
   1.177 +	KErrNone if successful,
   1.178 +	KErrAlreadyExists if a setting with that key already exists
   1.179 +	KErrArgument if the descriptor is longer than KMaxUnicodeStringLength,
   1.180 +	plus other system-wide error codes.
   1.181 +@post
   1.182 +	Transactions fail on all error conditions.
   1.183 +	Outside transactions: on success the new setting is persistent,
   1.184 +	on failure the repository is unmodified.
   1.185 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.186 +*/
   1.187 +EXPORT_C TInt CRepository::Create(TUint32 aKey, const TDesC16& aValue)
   1.188 +	{
   1.189 +	if (aValue.Length()>KMaxUnicodeStringLength)
   1.190 +		return KErrArgument;
   1.191 +	TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);		
   1.192 +	return Create(aKey,pVal);
   1.193 +	}
   1.194 +
   1.195 +/** Deletes a setting.
   1.196 +@param aKey Key of setting to be deleted.
   1.197 +@return
   1.198 +	KErrNone if successful, 
   1.199 +	KErrNotFound if the setting does not exist,
   1.200 +	plus other system-wide error codes.
   1.201 +@post
   1.202 +	Transactions fail on all error conditions except KErrNotFound.
   1.203 +	Outside transactions: on success the deletion of the setting is persistent,
   1.204 +	on failure the repository is unmodified.
   1.205 +@capability Dependent Caller must satisfy the write access policy for that key in the repository
   1.206 +*/
   1.207 +EXPORT_C TInt CRepository::Delete(TUint32 aKey)
   1.208 +	{
   1.209 +	TRAPD(err,iImpl->DeleteSettingL(aKey));
   1.210 +	iImpl->RemoveAnyMarkDeleted();
   1.211 +	return err;
   1.212 +	}
   1.213 +	
   1.214 +/** Deletes all the settings that exist and match the specification:
   1.215 +	(key & mask) == (partialKey & mask)
   1.216 +Partial key is guaranteed to be masked before use.
   1.217 +Examples of use:
   1.218 +- To delete a single key.
   1.219 +	Delete(key, 0xFFFFFFFF, errorKey);
   1.220 +- To delete all keys from 0 to 0xFF:
   1.221 +	Delete(0, 0xFFFFFF00, errorKey);
   1.222 +	(digits from 0 to 0xFF would be ignored if given in the partial key)
   1.223 +- To delete all keys matching 0x5B??3A?6:
   1.224 +	Delete(0x5B003A06, 0xFF00FF0F, errorKey);
   1.225 +
   1.226 +@param aPartialKey
   1.227 +	Contains a bit pattern that all the keys must at least partially
   1.228 +	match.
   1.229 +@param aMask
   1.230 +	Has bits set for all the bits in aPartialKey that must match the keys being deleted.
   1.231 +@param aErrorKey If the delete operation fails this contains the key involved in the
   1.232 +	failure, or aPartialKey or KUnspecifiedKey if it could not be attributed to any key
   1.233 +@return
   1.234 +	KErrNone if successful,
   1.235 +	KErrNotFound if no items were found in the partial key range.
   1.236 +	plus other system-wide error codes.
   1.237 +@post
   1.238 +	Transactions fail on all error conditions except KErrNotFound
   1.239 +	Outside transactions: on success the changes are persistent, on failure the
   1.240 +	repository is unmodified.
   1.241 +@capability Dependent Caller must satisfy the write policies of all settings found in the
   1.242 +					  partial key range.
   1.243 +*/	
   1.244 +EXPORT_C TInt CRepository::Delete(TUint32 aPartialKey, TUint32 aMask, TUint32& aErrorKey)
   1.245 +	{
   1.246 +	TRAPD(ret,iImpl->DeleteRangeL(aPartialKey,aMask,aErrorKey));
   1.247 +	return ret;
   1.248 +	}
   1.249 +
   1.250 +
   1.251 +/** Reads an integer setting.
   1.252 +@param aKey Key of setting to be read.
   1.253 +@param aValue Returns the value of the setting if it is an integer.
   1.254 +@return
   1.255 +	KErrNone if successful,
   1.256 +	KErrNotFound if the setting does not exist,
   1.257 +	KErrArgument if the setting exists but is not an integer,
   1.258 +	plus other system-wide error codes.
   1.259 +@post Transactions fail only on those "other system-wide error codes".
   1.260 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.261 +*/
   1.262 +EXPORT_C TInt CRepository::Get(TUint32 aKey, TInt& aValue)
   1.263 +	{
   1.264 +	return iImpl->Get(aKey,aValue);
   1.265 +	}
   1.266 +
   1.267 +/** Reads a floating point setting.
   1.268 +@param aKey Key of setting to be read.
   1.269 +@param aValue Returns the value of the setting if it is a floating point value.
   1.270 +@return
   1.271 +	KErrNone if successful,
   1.272 +	KErrNotFound if the setting does not exist,
   1.273 +	KErrArgument if the setting exists but is not a floating point value,
   1.274 +	plus other system-wide error codes.
   1.275 +@post Transactions fail only on those "other system-wide error codes".
   1.276 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.277 +*/
   1.278 +EXPORT_C TInt CRepository::Get(TUint32 aKey, TReal& aValue)
   1.279 +	{
   1.280 +	return iImpl->Get(aKey,aValue);
   1.281 +	}
   1.282 +	
   1.283 +/** Reads a descriptor setting.
   1.284 +@param aKey Key of setting to be read.
   1.285 +@param aValue Returns the value of the setting if it is a descriptor.
   1.286 +@return
   1.287 +	KErrNone if successful,
   1.288 +	KErrNotFound if the setting does not exist,
   1.289 +	KErrArgument if the setting exists but is not a descriptor,
   1.290 +	KErrOverflow if the descriptor is too small to receive the value in the repository,
   1.291 +	plus other system-wide error codes.
   1.292 +@post Transactions fail only on those "other system-wide error codes".
   1.293 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.294 +*/
   1.295 +EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue)
   1.296 +	{
   1.297 +	TInt actual;
   1.298 +	return Get(aKey,aValue,actual);
   1.299 +	}
   1.300 +
   1.301 +/** Reads a descriptor setting.
   1.302 +@param aKey Key of setting to be read.
   1.303 +@param aValue Returns the value of the setting if it is a descriptor.
   1.304 +@param aActualLength Returns the actual length of the setting if it is a descriptor.
   1.305 +@return
   1.306 +	KErrNone if successful,
   1.307 +	KErrNotFound if the setting does not exist,
   1.308 +	KErrArgument if the setting exists but is not a descriptor,
   1.309 +	KErrOverflow if the descriptor is too small to receive the value in the repository,
   1.310 +	plus other system-wide error codes.
   1.311 +@post Transactions fail only on those "other system-wide error codes".
   1.312 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.313 +*/
   1.314 +EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue, TInt& aActualLength)
   1.315 +	{
   1.316 +	TBuf8<KMaxBinaryLength> val;
   1.317 +	TInt ret = iImpl->Get(aKey, val);	
   1.318 +	if (ret==KErrNone)
   1.319 +		{
   1.320 +		TInt settingValueLength=val.Length();
   1.321 +		//now check whether any string overflow
   1.322 +		if (settingValueLength > aValue.MaxLength())
   1.323 +			{
   1.324 +			aActualLength=settingValueLength;
   1.325 +			aValue.Copy(val.Left(aValue.MaxLength()));
   1.326 +			return KErrOverflow;
   1.327 +			}
   1.328 +		else
   1.329 +			{
   1.330 +			aValue.Copy(val);
   1.331 +			}
   1.332 +		}	
   1.333 +	return ret;	
   1.334 +	}
   1.335 +
   1.336 +/** Reads a descriptor setting.
   1.337 +@param aKey Key of setting to be read.
   1.338 +@param aValue Returns the value of the setting if it is a descriptor.
   1.339 +@return
   1.340 +	KErrNone if successful,
   1.341 +	KErrNotFound if the setting does not exist,
   1.342 +	KErrArgument if the setting exists but is not a descriptor,
   1.343 +	KErrOverflow if the descriptor is too small to receive the value in the repository,
   1.344 +	plus other system-wide error codes.
   1.345 +@post Transactions fail only on those "other system-wide error codes".
   1.346 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.347 +*/
   1.348 +EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue)
   1.349 +	{
   1.350 +	TPtr8 ptr8((TUint8*)aValue.Ptr(), 0, aValue.MaxSize());
   1.351 +	TInt ret=Get(aKey,ptr8);
   1.352 +	if (ret==KErrNone)
   1.353 +		aValue.SetLength(ptr8.Length()/2);
   1.354 +	return ret;
   1.355 +	}
   1.356 +
   1.357 +/** Reads a descriptor setting.
   1.358 +@param aKey Key of setting to be read.
   1.359 +@param aValue Returns the value of the setting if it is a descriptor.
   1.360 +@param aActualLength Returns the actual length of the setting if it is a descriptor.
   1.361 +@return
   1.362 +	KErrNone if successful,
   1.363 +	KErrNotFound if the setting does not exist,
   1.364 +	KErrArgument if the setting exists but is not a descriptor,
   1.365 +	KErrOverflow if the descriptor is too small to receive the value in the repository,
   1.366 +	plus other system-wide error codes.
   1.367 +@post Transactions fail only on those "other system-wide error codes".
   1.368 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.369 +*/
   1.370 +EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue, TInt& aActualLength)
   1.371 +	{
   1.372 +	TInt actualLength8;
   1.373 +	TPtr8 ptr8((TUint8*)aValue.Ptr(), 0, aValue.MaxSize());
   1.374 +	TInt ret=Get(aKey,ptr8,actualLength8);
   1.375 +	aValue.SetLength(ptr8.Length()/2);			
   1.376 +	aActualLength=actualLength8/2;		
   1.377 +	return ret;
   1.378 +	}
   1.379 +
   1.380 +/** Sets an existing integer setting to a new value or creates a new setting 
   1.381 +with an integer value if the setting doesn't exist.
   1.382 +@param aKey Key of setting to be written to.
   1.383 +@param aValue Value to be written.
   1.384 +@return
   1.385 +	KErrNone if successful,
   1.386 +	KErrArgument if the setting exists but is not an integer
   1.387 +	plus other system-wide error codes.
   1.388 +@post
   1.389 +	Transactions fail on all error conditions.
   1.390 +	Outside transactions: on success the new value is persistent,
   1.391 +	on failure the repository is unmodified.
   1.392 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.393 +*/
   1.394 +EXPORT_C TInt CRepository::Set(TUint32 aKey, TInt aValue)
   1.395 +	{
   1.396 +	TRAPD(err,iImpl->SetSettingL(aKey,aValue));
   1.397 +	return err;
   1.398 +	}
   1.399 +
   1.400 +/** Sets an existing floating point setting to a new value or creates a new setting
   1.401 +with a floating point value if the setting doesn't exist.
   1.402 +@param aKey Key of setting to be written to.
   1.403 +@param aValue Value to be written.
   1.404 +@return
   1.405 +	KErrNone if successful,
   1.406 +	KErrArgument if the setting exists but is not a floating point value
   1.407 +	plus other system-wide error codes.
   1.408 +@post
   1.409 +	Transactions fail on all error conditions.
   1.410 +	Outside transactions: on success the new value is persistent,
   1.411 +	on failure the repository is unmodified.
   1.412 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.413 +*/
   1.414 +EXPORT_C TInt CRepository::Set(TUint32 aKey, const TReal& aValue)
   1.415 +	{
   1.416 +	TRAPD(err,iImpl->SetSettingL(aKey,aValue));
   1.417 +	return err;
   1.418 +	}
   1.419 +
   1.420 +/** Sets an existing descriptor setting to a new value or creates a new setting
   1.421 +with a descriptor value if the setting doesn't exist.
   1.422 +@param aKey Key of setting to be written to.
   1.423 +@param aValue Value to be written.
   1.424 +@return
   1.425 +	KErrNone if successful,
   1.426 +	KErrArgument if aValue is longer than KMaxBinaryLength or
   1.427 +	the setting exists but is not a descriptor,
   1.428 +	plus other system-wide error codes.
   1.429 +@post
   1.430 +	Transactions fail on all error conditions.
   1.431 +	Outside transactions: on success the new value is persistent,
   1.432 +	on failure the repository is unmodified.
   1.433 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.434 +*/
   1.435 +EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC8& aValue)
   1.436 +	{
   1.437 +	if (aValue.Length()>KMaxBinaryLength)
   1.438 +		return KErrArgument;
   1.439 +	TRAPD(err,iImpl->SetSettingL(aKey,aValue));
   1.440 +	return err;
   1.441 +	}
   1.442 +
   1.443 +/** Sets an existing descriptor setting to a new value or creates a new setting
   1.444 +with a descriptor value if it doesn't exist.
   1.445 +@param aKey Key of setting to be written to.
   1.446 +@param aValue Value to be written.
   1.447 +@return
   1.448 +	KErrNone if successful,
   1.449 +	KErrArgument if aValue is longer than KMaxUnicodeStringLength or
   1.450 +	the setting exists but is not a descriptor,
   1.451 +	plus other system-wide error codes.
   1.452 +@post
   1.453 +	Transactions fail on all error conditions.
   1.454 +	Outside transactions: on success the new value is persistent,
   1.455 +	on failure the repository is unmodified.
   1.456 +@capability Dependent Caller must satisfy the write access policy of that key in the repository.
   1.457 +*/
   1.458 +EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC16& aValue)
   1.459 +	{
   1.460 +	if (aValue.Length()>KMaxUnicodeStringLength)
   1.461 +		return KErrArgument;	
   1.462 +	TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);
   1.463 +	return Set(aKey,pVal);
   1.464 +	}
   1.465 +
   1.466 +/** Reads the metadata bound to a key
   1.467 +@param aKey The key
   1.468 +@param aMeta Returns the metadata value for the key
   1.469 +@return
   1.470 +	KErrNone if successful,
   1.471 +	KErrNotFound if the setting does not exist,
   1.472 +	plus other system-wide error codes.
   1.473 +@post Transactions fail only on those "other system-wide error codes".
   1.474 +@capability Dependent Caller must satisfy the read access policy of that key in the repository.
   1.475 +*/
   1.476 +EXPORT_C TInt CRepository::GetMeta(TUint32 aKey, TUint32& aMeta)
   1.477 +	{
   1.478 +	return iImpl->GetMeta(aKey,aMeta);	
   1.479 +	}
   1.480 +
   1.481 +/** Moves all the settings that exist and match the specification:
   1.482 +	(oldkey & mask) == (sourcePartialKey & mask)
   1.483 +to new locations where 
   1.484 +	(newkey & mask) == (targetPartialKey & mask).
   1.485 +For those keys that match the source specification, those bits in the key for
   1.486 +which the corresponding mask bit is zero remain unchanged. All remaining bits
   1.487 +change from (sourcePartialKey & mask) to (targetPartialKey & mask).
   1.488 +Both partial keys are guaranteed to be masked before use.
   1.489 +Examples of use:
   1.490 +- To move a single key from oldKey to newKey.
   1.491 +	Move(oldKey, newKey, 0xFFFFFFFF, errorKey);
   1.492 +- To move all keys from 0 to 0xFF to be from 0x100 to 0x1FF:
   1.493 +	Move(0, 0x100, 0xFFFFFF00, errorKey);
   1.494 +	(digits from 0 to 0xFF would be ignored if given in the partial keys)
   1.495 +- To move all keys matching 0x5B??3A?6 to 0xDC??44?F:
   1.496 +	Move(0x5B003A06, 0xDC00440F, 0xFF00FF0F, errorKey);
   1.497 +
   1.498 +@param aSourcePartialKey
   1.499 +	Contains a bit pattern that all the source keys which must at least partially
   1.500 +	match.
   1.501 +@param aMask
   1.502 +	Has bits set for all the bits in aPartialKey that must match the keys being moved.
   1.503 +@param aTargetPartialKey
   1.504 +	Contains a bit pattern that all the target keys which must at least partially
   1.505 +	match.	
   1.506 +@param aErrorKey on failure, contains the key or partial key involved in the error
   1.507 +	or KUnspecifiedKey if failure could not be attributed to any key.
   1.508 +@return
   1.509 +	KErrNone if successful,
   1.510 +	KErrNotFound if no items were found in the source range.
   1.511 +	KErrAlreadyExists if an existing setting is using any intended target key.
   1.512 +	plus other system-wide error codes.
   1.513 +@post
   1.514 +	Transactions fail on all error conditions except KErrNotFound.
   1.515 +	Outside transactions: on success the changes are persistent, on failure the
   1.516 +	repository is unmodified.
   1.517 +@capability Dependent Caller must satisfy the read and write policies of all settings found in the
   1.518 +					  source range, and write policies on all intended target keys.
   1.519 +*/
   1.520 +EXPORT_C TInt CRepository::Move (TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, 
   1.521 +								 TUint32 aMask, TUint32& aErrorKey)
   1.522 +	{
   1.523 +	TRAPD(ret,iImpl->MoveL(aSourcePartialKey,aTargetPartialKey,aMask,aErrorKey));
   1.524 +	return ret;
   1.525 +	}
   1.526 +
   1.527 +	
   1.528 +/** Finds all the settings that exist and match the specification given by
   1.529 +aPartialKey and aMask.
   1.530 +Matches occur whenever (key & mask) == (partialKey & mask).
   1.531 +The partial key is guaranteed to be masked before use.
   1.532 +@param aPartialKey
   1.533 +	Contains a bit pattern that all the keys returned must at least partially
   1.534 +	match.
   1.535 +@param aMask
   1.536 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.537 +	keys.
   1.538 +@param aFoundKeys All the keys found.
   1.539 +@return
   1.540 +	KErrNone if successful,
   1.541 +	KErrNotFound if no items were found in the source range,
   1.542 +	plus other system-wide error codes.
   1.543 +@post Transactions fail only on those "other system-wide error codes".
   1.544 +*/
   1.545 +EXPORT_C TInt CRepository::FindL(TUint32 aPartialKey, TUint32 aMask,
   1.546 +	RArray<TUint32>& aFoundKeys)
   1.547 +	{
   1.548 +	RArray<TUint32> dummy;
   1.549 +	TRAPD(ret,iImpl->FindL(aPartialKey,aMask,aFoundKeys,KMaximumKey,dummy));
   1.550 +	if (ret==KErrNoMemory)
   1.551 +		User::LeaveNoMemory();
   1.552 +	return ret;
   1.553 +	}
   1.554 +
   1.555 +
   1.556 +/** Finds all the settings that contain a given integer and match the
   1.557 +specification given by aPartialKey and aMask.
   1.558 +@param aPartialKey
   1.559 +	Contains a bit pattern that all the keys returned must at least partially
   1.560 +	match.
   1.561 +@param aMask
   1.562 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.563 +	keys.
   1.564 +@param aValue Settings for the keys found will be integers with value aValue.
   1.565 +@param aFoundKeys All the keys found.
   1.566 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.567 +	the setting with key k is an integer aValue.
   1.568 +@see FindL()
   1.569 +@return
   1.570 +	KErrNone if successful,
   1.571 +	KErrNotFound if capability check passed but no matching items are found,
   1.572 +	plus other system-wide error codes.
   1.573 +@post Transactions fail only on those "other system-wide error codes".
   1.574 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.575 +*/
   1.576 +EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.577 +	TInt aValue, RArray<TUint32>& aFoundKeys)
   1.578 +	{
   1.579 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,EEqual,aFoundKeys));
   1.580 +	if (ret==KErrNoMemory)
   1.581 +		User::LeaveNoMemory();
   1.582 +	return ret;	
   1.583 +	}
   1.584 +
   1.585 +
   1.586 +/** Finds all the settings that contain a given floating point value and match
   1.587 +the specification given by aPartialKey and aMask.
   1.588 +@param aPartialKey
   1.589 +	Contains a bit pattern that all the keys returned must at least partially
   1.590 +	match.
   1.591 +@param aMask
   1.592 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.593 +	keys.
   1.594 +@param aValue
   1.595 +	Settings for the keys found will be floating point values with value aValue.
   1.596 +@param aFoundKeys All the keys found.
   1.597 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.598 +	the setting with key k is a floating point value aValue.
   1.599 +@see FindL()
   1.600 +@return
   1.601 +	KErrNone if successful,
   1.602 +	KErrNotFound if capability check passed but no matching items are found,
   1.603 +	plus other system-wide error codes.
   1.604 +@post Transactions fail only on those "other system-wide error codes".
   1.605 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.606 +*/
   1.607 +EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.608 +	const TReal& aValue, RArray<TUint32>& aFoundKeys)
   1.609 +	{
   1.610 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,EEqual,aFoundKeys));
   1.611 +	if (ret==KErrNoMemory)
   1.612 +		User::LeaveNoMemory();
   1.613 +	return ret;	
   1.614 +	}
   1.615 +
   1.616 +
   1.617 +/** Finds all the settings that contain a given string value and match the
   1.618 +specification given by aPartialKey and aMask.
   1.619 +@param aPartialKey
   1.620 +	Contains a bit pattern that all the keys returned must at least partially
   1.621 +	match.
   1.622 +@param aMask
   1.623 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.624 +	keys.
   1.625 +@param aValue
   1.626 +	Settings for the keys found will be string values with value aValue.
   1.627 +@param aFoundKeys All the keys found.
   1.628 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.629 +	the setting with key k is a string value aValue.
   1.630 +@see FindL()
   1.631 +@return
   1.632 +	KErrNone if successful,
   1.633 +	KErrNotFound if capability check passed but no matching items are found,
   1.634 +	plus other system-wide error codes.
   1.635 +@post Transactions fail only on those "other system-wide error codes".
   1.636 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.637 +*/
   1.638 +EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.639 +	const TDesC8& aValue, RArray<TUint32>& aFoundKeys)
   1.640 +	{
   1.641 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,EEqual,aFoundKeys));
   1.642 +	if (ret==KErrNoMemory)
   1.643 +		User::LeaveNoMemory();
   1.644 +	return ret;	
   1.645 +	}
   1.646 +
   1.647 +
   1.648 +/** Finds all the settings that contain a given string value and match the
   1.649 +specification given by aPartialKey and aMask.
   1.650 +
   1.651 +@param aPartialKey
   1.652 +	Contains a bit pattern that all the keys returned must at least partially
   1.653 +	match.
   1.654 +@param aMask
   1.655 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.656 +	keys.
   1.657 +@param aValue
   1.658 +	Settings for the keys found will be string values with value aValue.
   1.659 +@param aFoundKeys All the keys found.
   1.660 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.661 +	the setting with key k is a string value aValue.
   1.662 +@see FindL()
   1.663 +@return
   1.664 +	KErrNone if successful,
   1.665 +	KErrNotFound if capability check passed but no matching items are found,
   1.666 +	plus other system-wide error codes.
   1.667 +@post Transactions fail only on those "other system-wide error codes".
   1.668 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.669 +*/
   1.670 +EXPORT_C TInt CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.671 +	const TDesC16& aValue, RArray<TUint32>& aFoundKeys)
   1.672 +	{
   1.673 +	TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);	
   1.674 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,pVal,EEqual,aFoundKeys));
   1.675 +	if (ret==KErrNoMemory)
   1.676 +		User::LeaveNoMemory();
   1.677 +	return ret;	
   1.678 +	}
   1.679 +
   1.680 +
   1.681 +/** Finds all the settings that match the specification given by aPartialKey
   1.682 +and aMask, but are either not integer values or do not have the given value.
   1.683 +@param aPartialKey
   1.684 +	Contains a bit pattern that all the keys returned must at least partially
   1.685 +	match.
   1.686 +@param aMask
   1.687 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.688 +	keys.
   1.689 +@param aValue
   1.690 +	Settings for the keys found will be settings that either contain values
   1.691 +	that are not integers or integers other than aValue.
   1.692 +@param aFoundKeys All the keys found.
   1.693 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.694 +	the setting with key k is either not an integer or an integer not equal to
   1.695 +	aValue.
   1.696 +@see FindL()
   1.697 +@return
   1.698 +	KErrNone if successful,
   1.699 +	KErrNotFound if capability check passed but no non-matching items are found,
   1.700 +	plus other system-wide error codes.
   1.701 +@post Transactions fail only on those "other system-wide error codes".
   1.702 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.703 +*/
   1.704 +EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.705 +	TInt aValue, RArray<TUint32>& aFoundKeys)
   1.706 +	{
   1.707 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,ENotEqual,aFoundKeys));
   1.708 +	if (ret==KErrNoMemory)
   1.709 +		User::LeaveNoMemory();
   1.710 +	return ret;	
   1.711 +	}
   1.712 +
   1.713 +
   1.714 +/** Finds all the settings that match the specification given by aPartialKey
   1.715 +and aMask, but are either not floating point values or do not have the given value.
   1.716 +@param aPartialKey
   1.717 +	Contains a bit pattern that all the keys returned must at least partially
   1.718 +	match.
   1.719 +@param aMask
   1.720 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.721 +	keys.
   1.722 +@param aValue
   1.723 +	Settings for the keys found will be settings that either contain values
   1.724 +	that are not floating point or floating point values other than aValue.
   1.725 +@param aFoundKeys All the keys found.
   1.726 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.727 +	the setting with key k is either not a floating point value or a floating
   1.728 +	point value not equal to aValue.
   1.729 +@see FindL()
   1.730 +@return
   1.731 +	KErrNone if successful,
   1.732 +	KErrNotFound if capability check passed but no non-matching items are found,
   1.733 +	plus other system-wide error codes.
   1.734 +@post Transactions fail only on those "other system-wide error codes".
   1.735 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.736 +*/
   1.737 +EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.738 +	const TReal& aValue, RArray<TUint32>& aFoundKeys)
   1.739 +	{
   1.740 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,ENotEqual,aFoundKeys));
   1.741 +	if (ret==KErrNoMemory)
   1.742 +		User::LeaveNoMemory();
   1.743 +	return ret;
   1.744 +	}
   1.745 +
   1.746 +
   1.747 +/** Finds all the settings that match the specification given by aPartialKey
   1.748 +and aMask, but are either not string values or do not match the given string.
   1.749 +@param aPartialKey
   1.750 +	Contains a bit pattern that all the keys returned must at least partially
   1.751 +	match.
   1.752 +@param aMask
   1.753 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.754 +	keys.
   1.755 +@param aValue
   1.756 +	Settings for the keys found will be settings that either contain values
   1.757 +	that are not strings or strings with value other than aValue.
   1.758 +@param aFoundKeys All the keys found.
   1.759 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.760 +	the setting with key k is either not a string value or a string value not
   1.761 +	equal to aValue.
   1.762 +@see FindL()
   1.763 +@return
   1.764 +	KErrNone if successful,
   1.765 +	KErrNotFound if capability check passed but no non-matching items are found,
   1.766 +	plus other system-wide error codes.
   1.767 +@post Transactions fail only on those "other system-wide error codes".
   1.768 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.769 +*/
   1.770 +EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.771 +	const TDesC8& aValue, RArray<TUint32>& aFoundKeys)
   1.772 +	{
   1.773 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,aValue,ENotEqual,aFoundKeys));
   1.774 +	if (ret==KErrNoMemory)
   1.775 +		User::LeaveNoMemory();
   1.776 +	return ret;
   1.777 +	}
   1.778 +
   1.779 +/** Finds all the settings that match the specification given by aPartialKey
   1.780 +and aMask, but are either not string values or do not match the given string.
   1.781 +@param aPartialKey
   1.782 +	Contains a bit pattern that all the keys returned must at least partially
   1.783 +	match.
   1.784 +@param aMask
   1.785 +	Has bits set for all the bits in aPartialKey that must match the returned
   1.786 +	keys.
   1.787 +@param aValue
   1.788 +	Settings for the keys found will be settings that either contain values
   1.789 +	that are not strings or strings with value other than aValue.
   1.790 +@param aFoundKeys All the keys found.
   1.791 +	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
   1.792 +	the setting with key k is either not a string value or a string value not
   1.793 +	equal to aValue.
   1.794 +@see FindL()
   1.795 +@return
   1.796 +	KErrNone if successful,
   1.797 +	KErrNotFound if capability check passed but no non-matching items are found,
   1.798 +	plus other system-wide error codes.
   1.799 +@post Transactions fail only on those "other system-wide error codes".
   1.800 +@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
   1.801 +*/
   1.802 +EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.803 +	const TDesC16& aValue, RArray<TUint32>& aFoundKeys)
   1.804 +	{
   1.805 +	TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);	
   1.806 +	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,pVal,ENotEqual,aFoundKeys));
   1.807 +	if (ret==KErrNoMemory)
   1.808 +		User::LeaveNoMemory();
   1.809 +	return ret;
   1.810 +	}
   1.811 +
   1.812 +/** Attempts to starts a transaction in the given mode.
   1.813 +This function is doing nothing and just return KErrNone
   1.814 +@param aMode transaction mode: EConcurrentReadWriteTransaction (standard),
   1.815 +	EReadTransaction or EReadWriteTransaction.
   1.816 +@return KErrNone
   1.817 +@see CRepository::TTransactionMode
   1.818 +*/
   1.819 +EXPORT_C TInt CRepository::StartTransaction(TTransactionMode /**aMode*/)
   1.820 +	{
   1.821 +	return KErrNone;
   1.822 +	}
   1.823 +
   1.824 +
   1.825 +/** Attempts to starts a transaction in the given mode asynchronously
   1.826 +This function does nothing
   1.827 +@param aMode transaction mode: EConcurrentReadWriteTransaction (standard),
   1.828 +	EReadTransaction or EReadWriteTransaction.
   1.829 +@see CRepository::TTransactionMode
   1.830 +@param aStatus No effect on this parameter
   1.831 +*/
   1.832 +EXPORT_C void CRepository::StartTransaction(TTransactionMode /**aMode*/, TRequestStatus& /**aStatus*/)
   1.833 +	{
   1.834 +	return;
   1.835 +	}
   1.836 +
   1.837 +
   1.838 +/** Commits a transaction.
   1.839 +This function does nothing and just return KErrNone
   1.840 +@return KErrNone
   1.841 +@param aKeyInfo no effect on this parameter
   1.842 +*/
   1.843 +EXPORT_C TInt CRepository::CommitTransaction(TUint32& /**aKeyInfo*/)
   1.844 +	{
   1.845 +	return KErrNone;
   1.846 +	}
   1.847 +
   1.848 +
   1.849 +/** Commits a transaction asynchronously
   1.850 +This function does nothing
   1.851 +@param aKeyInfo
   1.852 +	A descriptor to receive a TUint32 value, e.g. TTransactionKeyInfoBuf, which
   1.853 +	client must ensure remains in scope for the duration of the asynchronous request.
   1.854 +	No effect on this input parameter
   1.855 +@see CRepository::TTransactionKeyInfoBuf
   1.856 +@param aStatus Completion status of asynchronous request:
   1.857 +	No effect on this input parameter
   1.858 +*/
   1.859 +EXPORT_C void CRepository::CommitTransaction(TDes8& /**aKeyInfo*/, TRequestStatus& /**aStatus*/)
   1.860 +	{
   1.861 +	return;
   1.862 +	}
   1.863 +
   1.864 +
   1.865 +/** Cancels the current transaction with rollback
   1.866 +This function does nothing
   1.867 +*/
   1.868 +EXPORT_C void CRepository::CancelTransaction()
   1.869 +	{
   1.870 +	}
   1.871 +
   1.872 +/** Sets the active transaction to a failed state
   1.873 +This function does nothing
   1.874 +*/
   1.875 +EXPORT_C void CRepository::FailTransaction()
   1.876 +	{
   1.877 +	}
   1.878 +
   1.879 +/** Pushes onto the CleanupStack a TCleanupItem that calls CancelTransaction if
   1.880 +activated by a Leave or PopAndDestroy.
   1.881 +This function does nothing 
   1.882 +*/
   1.883 +EXPORT_C void CRepository::CleanupCancelTransactionPushL()
   1.884 +	{
   1.885 +	CleanupStack::PushL(TCleanupItem(CPcRepImpl::FailTransactionCleanupOperation, this));	
   1.886 +	}
   1.887 +	
   1.888 +/** Pushes onto the CleanupStack a TCleanupItem that calls FailTransaction if
   1.889 +activated by a Leave or PopAndDestroy.
   1.890 +This function does nothing
   1.891 +*/
   1.892 +EXPORT_C void CRepository::CleanupFailTransactionPushL()
   1.893 +	{
   1.894 +	CleanupStack::PushL(TCleanupItem(CPcRepImpl::FailTransactionCleanupOperation, this));	
   1.895 +	}
   1.896 +