CRepository Class Reference

class CRepository : public CBase

Provides access to a repository.

There are potentially 2^32 repositories, each identified by a UID. Within each repository up to 2^32 settings can be stored. Settings within a repository are identified by a 32-bit key and may be of the types integer, real or descriptor.

Inherits from

Public Member Functions
~CRepository ()
IMPORT_C void CancelTransaction ()
IMPORT_C void CleanupCancelTransactionPushL ()
IMPORT_C void CleanupFailTransactionPushL ()
void CleanupRollbackTransactionPushL ()
IMPORT_C TInt CommitTransaction ( TUint32 &)
IMPORT_C void CommitTransaction ( TDes8 &, TRequestStatus &)
IMPORT_C TInt Create ( TUint32 , TInt )
IMPORT_C TInt Create ( TUint32 , const TReal &)
IMPORT_C TInt Create ( TUint32 , const TDesC8 &)
IMPORT_C TInt Create ( TUint32 , const TDesC16 &)
IMPORT_C TInt Delete ( TUint32 )
IMPORT_C TInt Delete ( TUint32 , TUint32 , TUint32 &)
IMPORT_C void FailTransaction ()
IMPORT_C TInt FindEqL ( TUint32 , TUint32 , TInt , RArray < TUint32 > &)
IMPORT_C TInt FindEqL ( TUint32 , TUint32 , const TReal &, RArray < TUint32 > &)
IMPORT_C TInt FindEqL ( TUint32 , TUint32 , const TDesC8 &, RArray < TUint32 > &)
IMPORT_C TInt FindEqL ( TUint32 , TUint32 , const TDesC16 &, RArray < TUint32 > &)
IMPORT_C TInt FindL ( TUint32 , TUint32 , RArray < TUint32 > &)
IMPORT_C TInt FindNeqL ( TUint32 , TUint32 , TInt , RArray < TUint32 > &)
IMPORT_C TInt FindNeqL ( TUint32 , TUint32 , const TReal &, RArray < TUint32 > &)
IMPORT_C TInt FindNeqL ( TUint32 , TUint32 , const TDesC8 &, RArray < TUint32 > &)
IMPORT_C TInt FindNeqL ( TUint32 , TUint32 , const TDesC16 &, RArray < TUint32 > &)
IMPORT_C TInt Get ( TUint32 , TInt &)
IMPORT_C TInt Get ( TUint32 , TReal &)
IMPORT_C TInt Get ( TUint32 , TDes8 &)
IMPORT_C TInt Get ( TUint32 , TDes8 &, TInt &)
IMPORT_C TInt Get ( TUint32 , TDes16 &)
IMPORT_C TInt Get ( TUint32 , TDes16 &, TInt &)
IMPORT_C TInt GetMeta ( TUint32 , TUint32 &)
IMPORT_C TInt Move ( TUint32 , TUint32 , TUint32 , TUint32 &)
IMPORT_C CRepository * NewL ( TUid )
IMPORT_C CRepository * NewLC ( TUid )
IMPORT_C TInt NotifyCancel ( TUint32 )
IMPORT_C TInt NotifyCancel ( TUint32 , TUint32 )
IMPORT_C TInt NotifyCancelAll ()
IMPORT_C TInt NotifyRequest ( TUint32 , TRequestStatus &)
IMPORT_C TInt NotifyRequest ( TUint32 , TUint32 , TRequestStatus &)
IMPORT_C TInt Reset ()
IMPORT_C TInt Reset ( TUint32 )
void RollbackTransaction ()
IMPORT_C TInt Set ( TUint32 , TInt )
IMPORT_C TInt Set ( TUint32 , const TReal &)
IMPORT_C TInt Set ( TUint32 , const TDesC8 &)
IMPORT_C TInt Set ( TUint32 , const TDesC16 &)
IMPORT_C TInt StartTransaction ( TTransactionMode )
IMPORT_C void StartTransaction ( TTransactionMode , TRequestStatus &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TTransactionMode { EConcurrentReadWriteTransaction  = 2, EReadTransaction  = 1, EReadWriteTransaction  = 3 }
Public Member Type Definitions
typedef TPckgBuf < TUint32 > TTransactionKeyInfoBuf

Constructor & Destructor Documentation

~CRepository()

IMPORT_C ~CRepository ( ) [virtual]

Destructor.

Member Functions Documentation

CancelTransaction()

IMPORT_C void CancelTransaction ( )
Cancels the current transaction with rollback: discards any uncommitted changes. If the transaction is pending start or commit asynchronously, the request is completed with KErrCancel (unless it had already completed).
Post-condition
Not in a transaction.

CleanupCancelTransactionPushL()

IMPORT_C void CleanupCancelTransactionPushL ( )
Pushes onto the CleanupStack a TCleanupItem that calls CancelTransaction if activated by a Leave or PopAndDestroy. Important for releasing transaction resources including caches and read/write locks held over the repository.
Post-condition
CleanupStack has another item on it which must be popped later with CleanupStack::Pop() or similar.

CleanupFailTransactionPushL()

IMPORT_C void CleanupFailTransactionPushL ( )
Pushes onto the CleanupStack a TCleanupItem that calls FailTransaction if activated by a Leave or PopAndDestroy.
Post-condition
CleanupStack has another item on it which must be popped later with CleanupStack::Pop() or similar.

CleanupRollbackTransactionPushL()

void CleanupRollbackTransactionPushL ( ) [inline]

Same as CleanupCancelTransactionPushL. CleanupCancelTransactionPushL

CommitTransaction(TUint32 &)

IMPORT_C TInt CommitTransaction ( TUint32 & aKeyInfo )
Commits a transaction. A successful return guarantees the consistency and persistence of all values read and written during the transaction.
Pre-condition
Must be in a transaction.
Post-condition
Not in a transaction. On success, changes have been made persistent. On failure, transaction changes have been rolled back.
panic
CENREPCLI 4 Panics client if this session is not in a transaction.

Parameters

TUint32 & aKeyInfo On success: returns the number of keys whose values were modified. On failure: returns the key or partial key involved in the first error, or KUnspecifiedKey if failure could not be attributed to any key.

CommitTransaction(TDes8 &, TRequestStatus &)

IMPORT_C void CommitTransaction ( TDes8 & aKeyInfo,
TRequestStatus & aStatus
)
Commits a transaction asynchronously to allow client to avoid being blocked during the persist operation and other server activity. A successful return guarantees the consistency and persistence of all values read and written during the transaction. Use CancelTransaction to cancel asynchronous request. CRepository::TTransactionKeyInfoBuf
Pre-condition
Must be in a transaction.
Post-condition
Cannot assume that transaction is "pending commit" as may have completed already. Once request is complete, session is not in a transaction: on success, changes have been made persistent; on failure, transaction changes have been rolled back.
panic
CENREPCLI 4 Panics client if this session is not in a transaction.

Parameters

TDes8 & aKeyInfo A descriptor to receive a TUint32 value, e.g. TTransactionKeyInfoBuf, which client must ensure remains in scope for the duration of the asynchronous request. On success: returns the number of keys whose values were modified. On failure: returns the key or partial key involved in the first error, or KUnspecifiedKey if failure could not be attributed to any key.
TRequestStatus & aStatus Completion status of asynchronous request: On success (if not cancelled): KErrNone; On failure: error code giving first reason for failing. If KErrLocked is returned for EConcurrentReadWriteTransaction, transaction was interrupted by another client committing changes and should be repeated.

Create(TUint32, TInt)

IMPORT_C TInt Create ( TUint32 aKey,
TInt aValue
)
Creates a new setting with an integer value.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new setting is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey New setting key.
TInt aValue Setting value.

Create(TUint32, const TReal &)

IMPORT_C TInt Create ( TUint32 aKey,
const TReal & aValue
)
Creates a new setting with a floating-point value.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new setting is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey New setting key.
const TReal & aValue Setting value.

Create(TUint32, const TDesC8 &)

IMPORT_C TInt Create ( TUint32 aKey,
const TDesC8 & aValue
)
Creates a new setting with a descriptor value.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new setting is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey New setting key.
const TDesC8 & aValue Setting value.

Create(TUint32, const TDesC16 &)

IMPORT_C TInt Create ( TUint32 aKey,
const TDesC16 & aValue
)
Creates a new setting with a descriptor value.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new setting is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey New setting key.
const TDesC16 & aValue Setting value.

Delete(TUint32)

IMPORT_C TInt Delete ( TUint32 aKey )
Deletes a setting.
Post-condition
Transactions fail on all error conditions except KErrNotFound. Outside transactions: on success the deletion of the setting is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy for that key in the repository

Parameters

TUint32 aKey Key of setting to be deleted.

Delete(TUint32, TUint32, TUint32 &)

IMPORT_C TInt Delete ( TUint32 aPartialKey,
TUint32 aMask,
TUint32 & aErrorKey
)
Deletes all the settings that exist and match the specification: (key & mask) == (partialKey & mask) Partial key is guaranteed to be masked before use. Examples of use:
  • To delete a single key. Delete(key, 0xFFFFFFFF, errorKey);

  • To delete all keys from 0 to 0xFF: Delete(0, 0xFFFFFF00, errorKey); (digits from 0 to 0xFF would be ignored if given in the partial key)

  • To delete all keys matching 0x5B??3A?6: Delete(0x5B003A06, 0xFF00FF0F, errorKey);

Post-condition
Transactions fail on all error conditions except KErrNotFound Outside transactions: on success the changes are persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write policies of all settings found in the partial key range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the keys being deleted.
TUint32 & aErrorKey If the delete operation fails this contains the key involved in the failure, or aPartialKey or KUnspecifiedKey if it could not be attributed to any key

FailTransaction()

IMPORT_C void FailTransaction ( )
Sets the active transaction to a failed state, releasing cache and locks but keeping it open. Has no effect when not in an active transaction, including when it has already failed or when pending asynchronous start or commit request completion. Use in preference to CancelTransaction whenever it is inappropriate to close the transaction at the time.
Post-condition
If previously in an active transaction: It is marked as failed. All uncommitted changes are discarded. Transaction resources including cache and read/write locks are released in the repository. All subsequent operations in the transaction fail until it is closed by CancelTransaction or CommitTransaction. CommitTransaction will fail and return KErrAbort.

FindEqL(TUint32, TUint32, TInt, RArray< TUint32 > &)

IMPORT_C TInt FindEqL ( TUint32 aPartialKey,
TUint32 aMask,
TInt aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that contain a given integer and match the specification given by aPartialKey and aMask. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
TInt aValue Settings for the keys found will be integers with value aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is an integer aValue.

FindEqL(TUint32, TUint32, const TReal &, RArray< TUint32 > &)

IMPORT_C TInt FindEqL ( TUint32 aPartialKey,
TUint32 aMask,
const TReal & aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that contain a given floating point value and match the specification given by aPartialKey and aMask. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
const TReal & aValue Settings for the keys found will be floating point values with value aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is a floating point value aValue.

FindEqL(TUint32, TUint32, const TDesC8 &, RArray< TUint32 > &)

IMPORT_C TInt FindEqL ( TUint32 aPartialKey,
TUint32 aMask,
const TDesC8 & aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that contain a given string value and match the specification given by aPartialKey and aMask. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
const TDesC8 & aValue Settings for the keys found will be string values with value aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is a string value aValue.

FindEqL(TUint32, TUint32, const TDesC16 &, RArray< TUint32 > &)

IMPORT_C TInt FindEqL ( TUint32 aPartialKey,
TUint32 aMask,
const TDesC16 & aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that contain a given string value and match the specification given by aPartialKey and aMask. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
const TDesC16 & aValue Settings for the keys found will be string values with value aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is a string value aValue.

FindL(TUint32, TUint32, RArray< TUint32 > &)

IMPORT_C TInt FindL ( TUint32 aPartialKey,
TUint32 aMask,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that exist and match the specification given by aPartialKey and aMask. Matches occur whenever (key & mask) == (partialKey & mask). The partial key is guaranteed to be masked before use.
Post-condition
Transactions fail only on those "other system-wide error codes".

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
RArray < TUint32 > & aFoundKeys All the keys found.

FindNeqL(TUint32, TUint32, TInt, RArray< TUint32 > &)

IMPORT_C TInt FindNeqL ( TUint32 aPartialKey,
TUint32 aMask,
TInt aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that match the specification given by aPartialKey and aMask, but are either not integer values or do not have the given value. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
TInt aValue Settings for the keys found will be settings that either contain values that are not integers or integers other than aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is either not an integer or an integer not equal to aValue.

FindNeqL(TUint32, TUint32, const TReal &, RArray< TUint32 > &)

IMPORT_C TInt FindNeqL ( TUint32 aPartialKey,
TUint32 aMask,
const TReal & aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that match the specification given by aPartialKey and aMask, but are either not floating point values or do not have the given value. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
const TReal & aValue Settings for the keys found will be settings that either contain values that are not floating point or floating point values other than aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is either not a floating point value or a floating point value not equal to aValue.

FindNeqL(TUint32, TUint32, const TDesC8 &, RArray< TUint32 > &)

IMPORT_C TInt FindNeqL ( TUint32 aPartialKey,
TUint32 aMask,
const TDesC8 & aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that match the specification given by aPartialKey and aMask, but are either not string values or do not match the given string. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
const TDesC8 & aValue Settings for the keys found will be settings that either contain values that are not strings or strings with value other than aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is either not a string value or a string value not equal to aValue.

FindNeqL(TUint32, TUint32, const TDesC16 &, RArray< TUint32 > &)

IMPORT_C TInt FindNeqL ( TUint32 aPartialKey,
TUint32 aMask,
const TDesC16 & aValue,
RArray < TUint32 > & aFoundKeys
)
Finds all the settings that match the specification given by aPartialKey and aMask, but are either not string values or do not match the given string. FindL()
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read policies of all settings found in the source range.

Parameters

TUint32 aPartialKey Contains a bit pattern that all the keys returned must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the returned keys.
const TDesC16 & aValue Settings for the keys found will be settings that either contain values that are not strings or strings with value other than aValue.
RArray < TUint32 > & aFoundKeys All the keys found. For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and the setting with key k is either not a string value or a string value not equal to aValue.

Get(TUint32, TInt &)

IMPORT_C TInt Get ( TUint32 aKey,
TInt & aValue
)
Reads an integer setting.
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be read.
TInt & aValue Returns the value of the setting if it is an integer.

Get(TUint32, TReal &)

IMPORT_C TInt Get ( TUint32 aKey,
TReal & aValue
)
Reads a floating point setting.
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be read.
TReal & aValue Returns the value of the setting if it is a floating point value.

Get(TUint32, TDes8 &)

IMPORT_C TInt Get ( TUint32 aKey,
TDes8 & aValue
)
Reads a descriptor setting.
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be read.
TDes8 & aValue Returns the value of the setting if it is a descriptor.

Get(TUint32, TDes8 &, TInt &)

IMPORT_C TInt Get ( TUint32 aId,
TDes8 & aValue,
TInt & aActualLength
)
Reads a descriptor setting.
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aId Key of setting to be read.
TDes8 & aValue Returns the value of the setting if it is a descriptor.
TInt & aActualLength Returns the actual length of the setting if it is a descriptor.

Get(TUint32, TDes16 &)

IMPORT_C TInt Get ( TUint32 aKey,
TDes16 & aValue
)
Reads a descriptor setting.
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be read.
TDes16 & aValue Returns the value of the setting if it is a descriptor.

Get(TUint32, TDes16 &, TInt &)

IMPORT_C TInt Get ( TUint32 aId,
TDes16 & aValue,
TInt & aActualLength
)
Reads a descriptor setting.
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aId Key of setting to be read.
TDes16 & aValue Returns the value of the setting if it is a descriptor.
TInt & aActualLength Returns the actual length of the setting if it is a descriptor.

GetMeta(TUint32, TUint32 &)

IMPORT_C TInt GetMeta ( TUint32 aKey,
TUint32 & aMeta
)
Reads the metadata bound to a key
Post-condition
Transactions fail only on those "other system-wide error codes".
capability
Dependent Caller must satisfy the read access policy of that key in the repository.

Parameters

TUint32 aKey The key
TUint32 & aMeta Returns the metadata value for the key

Move(TUint32, TUint32, TUint32, TUint32 &)

IMPORT_C TInt Move ( TUint32 aSourcePartialKey,
TUint32 aTargetPartialKey,
TUint32 aMask,
TUint32 & aErrorKey
)
Moves all the settings that exist and match the specification: (oldkey & mask) == (sourcePartialKey & mask) to new locations where (newkey & mask) == (targetPartialKey & mask). For those keys that match the source specification, those bits in the key for which the corresponding mask bit is zero remain unchanged. All remaining bits change from (sourcePartialKey & mask) to (targetPartialKey & mask). Both partial keys are guaranteed to be masked before use. Examples of use:
  • To move a single key from oldKey to newKey. Move(oldKey, newKey, 0xFFFFFFFF, errorKey);

  • To move all keys from 0 to 0xFF to be from 0x100 to 0x1FF: Move(0, 0x100, 0xFFFFFF00, errorKey); (digits from 0 to 0xFF would be ignored if given in the partial keys)

  • To move all keys matching 0x5B??3A?6 to 0xDC??44?F: Move(0x5B003A06, 0xDC00440F, 0xFF00FF0F, errorKey);

Post-condition
Transactions fail on all error conditions except KErrNotFound. Outside transactions: on success the changes are persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the read and write policies of all settings found in the source range, and write policies on all intended target keys.

Parameters

TUint32 aSourcePartialKey Contains a bit pattern that all the source keys which must at least partially match.
TUint32 aTargetPartialKey Contains a bit pattern that all the target keys which must at least partially match.
TUint32 aMask Has bits set for all the bits in aPartialKey that must match the keys being moved.
TUint32 & aErrorKey on failure, contains the key or partial key involved in the error or KUnspecifiedKey if failure could not be attributed to any key.

NewL(TUid)

IMPORT_C CRepository * NewL ( TUid aRepositoryUid ) [static]

Creates a CRepository object for accessing a repository. If there is no such repository, the function leaves with KErrNotFound.

Parameters

TUid aRepositoryUid The UID of the repository to be accessed

NewLC(TUid)

IMPORT_C CRepository * NewLC ( TUid aRepositoryUid ) [static]

Creates a CRepository object for accessing a repository. If there is no such repository, the function leaves with KErrNotFound. A pointer to the object is left on the cleanup stack.

Parameters

TUid aRepositoryUid The UID of the repository to be accessed

NotifyCancel(TUint32)

IMPORT_C TInt NotifyCancel ( TUint32 aKey )

Cancels a notification previously requested from the two-argument overload of NotifyRequest.

Parameters

TUint32 aKey The parameter to the previous call to NotifyRequest to be cancelled.

NotifyCancel(TUint32, TUint32)

IMPORT_C TInt NotifyCancel ( TUint32 aPartialKey,
TUint32 aMask
)

Cancels a notification previously requested from the three-argument overload of NotifyRequest.

Parameters

TUint32 aPartialKey The parameter to the previous call to NotifyRequest to be cancelled.
TUint32 aMask The mask to be used with the partial key

NotifyCancelAll()

IMPORT_C TInt NotifyCancelAll ( )

Cancels all uncompleted notifications from this CRepository .

NotifyRequest(TUint32, TRequestStatus &)

IMPORT_C TInt NotifyRequest ( TUint32 aKey,
TRequestStatus & aStatus
)
Requests a notification if the value of a given setting changes. Only one notification can be received per call to NotifyRequest. Only one notification per setting per CRepository may be active at any one time.
capability
Note The caller must satisfy the relevant access policies for the repository

Parameters

TUint32 aKey The key setting to be informed about.
TRequestStatus & aStatus The object that will receive the notification. On a successful outcome, this will contain the Uid of the changed setting. If there is an existing notification on the same setting and same session, aStatus will be set to KErrAlreadyExists and the return value will be KErrNone.

NotifyRequest(TUint32, TUint32, TRequestStatus &)

IMPORT_C TInt NotifyRequest ( TUint32 aPartialKey,
TUint32 aMask,
TRequestStatus & aStatus
)
Requests a notification if the value of a given setting changes. Only one notification can be received per call to NotifyRequest. Only one notification per setting per CRepository may be active at any one time.
capability
Note The caller must satisfy the relevant access policies for the repository

Parameters

TUint32 aPartialKey The partial key setting to be informed about.
TUint32 aMask The mask to be used with the partial key.
TRequestStatus & aStatus The object that will receive the notification. On a successful outcome, this will contain the Uid of the changed setting. On error the error code is stored in aStatus and KErrNone is returned.

Reset()

IMPORT_C TInt Reset ( )
Resets the whole repository to the state of the initialization file originally used to set it up. Not currently supported in transactions.
Post-condition
Fails transaction if called when session is in one.
capability
Dependent The caller must satisfy the relevant access policies for the repository

Reset(TUint32)

IMPORT_C TInt Reset ( TUint32 aKey )
Resets the a setting within the repository to the state of the setting described by the initialization file originally used to set the repository up. Not currently supported in transactions.
Post-condition
Fails transaction if called when session is in one.
capability
Note The caller must satisfy the relevant access policies for the repository

Parameters

TUint32 aKey Key of setting to be reset.

RollbackTransaction()

void RollbackTransaction ( ) [inline]

Same as CancelTransaction. CancelTransaction

Set(TUint32, TInt)

IMPORT_C TInt Set ( TUint32 aKey,
TInt aValue
)
Sets an existing integer setting to a new value or creates a new setting with an integer value if the setting doesn't exist.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new value is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be written to.
TInt aValue Value to be written.

Set(TUint32, const TReal &)

IMPORT_C TInt Set ( TUint32 aKey,
const TReal & aValue
)
Sets an existing floating point setting to a new value or creates a new setting with a floating point value if the setting doesn't exist.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new value is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be written to.
const TReal & aValue Value to be written.

Set(TUint32, const TDesC8 &)

IMPORT_C TInt Set ( TUint32 aKey,
const TDesC8 & aValue
)
Sets an existing descriptor setting to a new value or creates a new setting with a descriptor value if the setting doesn't exist.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new value is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be written to.
const TDesC8 & aValue Value to be written.

Set(TUint32, const TDesC16 &)

IMPORT_C TInt Set ( TUint32 aKey,
const TDesC16 & aValue
)
Sets an existing descriptor setting to a new value or creates a new setting with a descriptor value if it doesn't exist.
Post-condition
Transactions fail on all error conditions. Outside transactions: on success the new value is persistent, on failure the repository is unmodified.
capability
Dependent Caller must satisfy the write access policy of that key in the repository.

Parameters

TUint32 aKey Key of setting to be written to.
const TDesC16 & aValue Value to be written.

StartTransaction(TTransactionMode)

IMPORT_C TInt StartTransaction ( TTransactionMode aMode )
Attempts to starts a transaction in the given mode. Consistency and persistence of all values read and written during the transaction is only guaranteed after a successful return from CommitTransaction. CRepository::TTransactionMode
Pre-condition
Must not be in a transaction.
Post-condition
If it returns KErrNone: in a transaction; Any other error code: not in a transaction.
panic
CENREPCLI 3 Panics client if this session is already in a transaction.

Parameters

TTransactionMode aMode transaction mode: EConcurrentReadWriteTransaction (standard), EReadTransaction or EReadWriteTransaction.

StartTransaction(TTransactionMode, TRequestStatus &)

IMPORT_C void StartTransaction ( TTransactionMode aMode,
TRequestStatus & aStatus
)
Attempts to starts a transaction in the given mode asynchronously to allow client to avoid being blocked by server activity before starting. Consistency and persistence of all values read and written during the transaction is only guaranteed after a successful return from CommitTransaction. Use CancelTransaction to cancel asynchronous request. CRepository::TTransactionMode
Pre-condition
Must not be in a transaction.
Post-condition
If it completes with KErrNone and request not cancelled: in a transaction; Any other error code or request cancelled: not in a transaction.
panic
CENREPCLI 3 Panics client if this session is already in a transaction.

Parameters

TTransactionMode aMode transaction mode: EConcurrentReadWriteTransaction (standard), EReadTransaction or EReadWriteTransaction.
TRequestStatus & aStatus On completion of asynchronous request: KErrNone if successful - guaranteed for EConcurrentReadWriteTransaction unless cancelled, KErrLocked for other transaction types if read or write locks held by other clients prevent transaction from starting.

Member Enumerations Documentation

Enum TTransactionMode

Transaction mode chosen with StartTransaction.

Enumerators

EConcurrentReadWriteTransaction = 2

Standard optimistic non-serialised transaction. Can be started at any time Commit fails with KErrLocked if another client interrupts it by first committing changes: transaction should be repeated until KErrLocked is not returned.

EReadTransaction = 1

Pessimistic locking transaction intended for reading consistent values. Can only be started if EReadWriteTransaction is not in progress. Automatically promoted to EReadWriteTransaction on first write operation if no other read transaction is in progress (or fails if not attainable). Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, and only make changes in an EReadWriteTransaction.

EReadWriteTransaction = 3

Pessimistic locking transaction intended for writing values. Can only be started if no EReadTransaction or EReadWriteTransactions are in progress. Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction, and only make changes in an EReadWriteTransaction.

Member Type Definitions Documentation

Typedef TTransactionKeyInfoBuf

typedef TPckgBuf < TUint32 > TTransactionKeyInfoBuf

Buffer type for aKeyInfo parameter to asynchronous CommitTransaction. CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus)