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