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