epoc32/include/centralrepository.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __CENTRALREPOSITORY_H__
williamr@2
    17
#define __CENTRALREPOSITORY_H__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
williamr@2
    21
williamr@2
    22
namespace NCentralRepositoryConstants
williamr@2
    23
/** Namespace encapsulating the CentralRepository constants.
williamr@2
    24
@publishedAll
williamr@2
    25
@released
williamr@2
    26
*/
williamr@2
    27
{
williamr@2
    28
	
williamr@2
    29
/** The maximum number of unicode characters that can be stored in a setting
williamr@2
    30
@publishedAll
williamr@2
    31
@released
williamr@2
    32
*/
williamr@2
    33
const TInt KMaxUnicodeStringLength = 1024;
williamr@2
    34
williamr@2
    35
/** The maximum number of bytes that can be stored in a setting
williamr@2
    36
@publishedAll
williamr@2
    37
@released
williamr@2
    38
*/
williamr@2
    39
const TInt KMaxBinaryLength = KMaxUnicodeStringLength*2;
williamr@2
    40
williamr@2
    41
/** Error key returned by CommitTransaction in case of an error that cannot be
williamr@2
    42
attributed to any single or partial key. Also notify value for spurious 
williamr@2
    43
notifications (eg when a notification is cancelled or several values change at once )
williamr@2
    44
@internalAll
williamr@2
    45
@released
williamr@2
    46
*/
williamr@2
    47
const TUint32 KUnspecifiedKey = 0xffffffffUL;
williamr@2
    48
williamr@2
    49
/** Initial buffer size for Find~ API. Initial buffer is used to cut on the number
williamr@2
    50
of IPC calls required for each Find~ API call. If the number of settings found is 
williamr@2
    51
less than or equal to KCentRepFindBufSize then all the settings can be retrieved with
williamr@2
    52
a single IPC.
williamr@2
    53
@internalAll
williamr@2
    54
*/
williamr@2
    55
const TInt KCentRepFindBufSize = 16;
williamr@2
    56
williamr@2
    57
/** Use KUnspecifiedKey instead of this value.
williamr@2
    58
@publishedAll
williamr@2
    59
@deprecated
williamr@2
    60
*/
williamr@2
    61
const TUint32 KInvalidNotificationId = KUnspecifiedKey;
williamr@2
    62
williamr@2
    63
/** The 8 most significant bits of a setting's meta-data are reserved for internal use.
williamr@2
    64
Clients should not make use of the reserved bits (unless it is specifically stated
williamr@2
    65
otherwise in Symbian developer documentation).  Clients should not rely on the value
williamr@2
    66
of the reserved bits.  Reserved bits are not guaranteed to be 0 or 1 and are not
williamr@2
    67
guaranteed to stay constant from one GetMeta call to the next.
williamr@2
    68
@publishedPartner
williamr@2
    69
@released
williamr@2
    70
@see CRepository::GetMeta
williamr@2
    71
@see KMetaUnreserved
williamr@2
    72
*/
williamr@2
    73
const TUint32 KMetaSymbianReserved = 0xFF000000; 
williamr@2
    74
williamr@2
    75
/** The 24 least significant bits of a setting's meta-data are available for use. Clients
williamr@2
    76
should make use of KMetaUnreserved to mask out the reserved bits following a call
williamr@2
    77
to GetMeta.  Clients should not rely on the value of the reserved bits.  Reserved bits
williamr@2
    78
are not guaranteed to be 0 or 1 and are not guaranteed to stay constant from one
williamr@2
    79
GetMeta call to the next.
williamr@2
    80
@publishedPartner
williamr@2
    81
@released
williamr@2
    82
@see CRepository::GetMeta
williamr@2
    83
@see KMetaSymbianReserved 
williamr@2
    84
*/
williamr@2
    85
const TUint32 KMetaUnreserved = 0x00FFFFFF; 
williamr@2
    86
williamr@2
    87
} // namespace NCentralRepositoryConstants
williamr@2
    88
williamr@2
    89
/** Provides access to a repository.
williamr@2
    90
williamr@2
    91
There are potentially 2^32 repositories, each identified by a UID. Within each
williamr@2
    92
repository up to 2^32 settings can be stored. Settings within a repository are
williamr@2
    93
identified by a 32-bit key and may be of the types integer, real or descriptor.
williamr@2
    94
@publishedAll
williamr@2
    95
@released
williamr@2
    96
*/
williamr@2
    97
class CRepository : public CBase
williamr@2
    98
	{
williamr@2
    99
public:
williamr@2
   100
williamr@2
   101
	/**	Transaction mode chosen with StartTransaction.
williamr@2
   102
	@publishedPartner
williamr@2
   103
	@released */
williamr@2
   104
	enum TTransactionMode
williamr@2
   105
		{
williamr@2
   106
		/** Standard optimistic non-serialised transaction. Can be started at any time
williamr@2
   107
		Commit fails with KErrLocked if another client interrupts it by first committing
williamr@2
   108
		changes: transaction should be repeated until KErrLocked is not returned. */
williamr@2
   109
		EConcurrentReadWriteTransaction = 2,
williamr@2
   110
		/** Pessimistic locking transaction intended for reading consistent values.
williamr@2
   111
		Can only be started if EReadWriteTransaction is not in progress.
williamr@2
   112
		Automatically promoted to EReadWriteTransaction on first write operation
williamr@2
   113
		if no other read transaction is in progress (or fails if not attainable).
williamr@2
   114
		Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction,
williamr@2
   115
		and only make changes in an EReadWriteTransaction. */
williamr@2
   116
		EReadTransaction = 1,
williamr@2
   117
		/** Pessimistic locking transaction intended for writing values. Can only be
williamr@2
   118
		started if no EReadTransaction or EReadWriteTransactions are in progress.
williamr@2
   119
		Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction,
williamr@2
   120
		and only make changes in an EReadWriteTransaction. */
williamr@2
   121
		EReadWriteTransaction = 3
williamr@2
   122
		};
williamr@2
   123
williamr@2
   124
	/** Buffer type for aKeyInfo parameter to asynchronous CommitTransaction.
williamr@2
   125
	@see CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus)
williamr@2
   126
	@publishedPartner
williamr@2
   127
	@released
williamr@2
   128
	*/
williamr@2
   129
	typedef TPckgBuf<TUint32> TTransactionKeyInfoBuf;
williamr@2
   130
williamr@2
   131
	IMPORT_C static CRepository* NewL(TUid aRepositoryUid);
williamr@2
   132
	IMPORT_C static CRepository* NewLC(TUid aRepositoryUid);
williamr@2
   133
williamr@2
   134
	IMPORT_C virtual ~CRepository();
williamr@2
   135
	IMPORT_C TInt Create(TUint32 aKey, TInt aValue);
williamr@2
   136
	IMPORT_C TInt Create(TUint32 aKey, const TReal& aValue);
williamr@2
   137
	IMPORT_C TInt Create(TUint32 aKey, const TDesC8& aValue);
williamr@2
   138
	IMPORT_C TInt Create(TUint32 aKey, const TDesC16& aValue);
williamr@2
   139
williamr@2
   140
	IMPORT_C TInt Delete(TUint32 aKey);
williamr@2
   141
	IMPORT_C TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey) ;
williamr@2
   142
williamr@2
   143
	IMPORT_C TInt Get(TUint32 aKey, TInt& aValue);
williamr@2
   144
	IMPORT_C TInt Set(TUint32 aKey, TInt aValue);
williamr@2
   145
	
williamr@2
   146
	IMPORT_C TInt Get(TUint32 aKey, TReal& aValue);
williamr@2
   147
	IMPORT_C TInt Set(TUint32 aKey, const TReal& aValue);
williamr@2
   148
williamr@2
   149
	IMPORT_C TInt Get(TUint32 aKey, TDes8& aValue);
williamr@2
   150
	IMPORT_C TInt Get(TUint32 aId, TDes8& aValue, TInt& aActualLength);
williamr@2
   151
	IMPORT_C TInt Set(TUint32 aKey, const TDesC8& aValue);
williamr@2
   152
williamr@2
   153
	IMPORT_C TInt Get(TUint32 aKey, TDes16& aValue);
williamr@2
   154
	IMPORT_C TInt Get(TUint32 aId, TDes16& aValue, TInt& aActualLength);
williamr@2
   155
	IMPORT_C TInt Set(TUint32 aKey, const TDesC16& aValue);
williamr@2
   156
williamr@2
   157
	IMPORT_C TInt GetMeta(TUint32 aKey, TUint32& aMeta);
williamr@2
   158
williamr@2
   159
	IMPORT_C TInt Move (TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, 
williamr@2
   160
	                    TUint32 aMask, TUint32 &aErrorKey) ;
williamr@2
   161
williamr@2
   162
	IMPORT_C TInt FindL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   163
		RArray<TUint32>& aFoundKeys);
williamr@2
   164
williamr@2
   165
	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   166
		TInt aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   167
	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   168
		const TReal& aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   169
	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   170
		const TDesC8& aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   171
	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   172
		const TDesC16& aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   173
williamr@2
   174
	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   175
		TInt aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   176
	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   177
		const TReal& aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   178
	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   179
		const TDesC8& aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   180
	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   181
		const TDesC16& aValue, RArray<TUint32>& aFoundKeys);
williamr@2
   182
williamr@2
   183
	IMPORT_C TInt NotifyRequest(TUint32 aKey, TRequestStatus& aStatus);
williamr@2
   184
	IMPORT_C TInt NotifyRequest(TUint32 aPartialKey, TUint32 aMask,
williamr@2
   185
		TRequestStatus& aStatus);
williamr@2
   186
williamr@2
   187
	IMPORT_C TInt NotifyCancel(TUint32 aKey);
williamr@2
   188
	IMPORT_C TInt NotifyCancel(TUint32 aPartialKey, TUint32 aMask);
williamr@2
   189
	IMPORT_C TInt NotifyCancelAll();
williamr@2
   190
williamr@2
   191
	IMPORT_C TInt Reset();
williamr@2
   192
	IMPORT_C TInt Reset(TUint32 aKey);
williamr@2
   193
williamr@2
   194
	IMPORT_C TInt StartTransaction(TTransactionMode aMode);
williamr@2
   195
	IMPORT_C void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus);
williamr@2
   196
	IMPORT_C TInt CommitTransaction(TUint32& aKeyInfo);
williamr@2
   197
	IMPORT_C void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus);
williamr@2
   198
	IMPORT_C void CancelTransaction();
williamr@2
   199
	IMPORT_C void CleanupCancelTransactionPushL();
williamr@2
   200
	IMPORT_C void FailTransaction();
williamr@2
   201
	IMPORT_C void CleanupFailTransactionPushL();
williamr@2
   202
williamr@2
   203
	/** Same as CancelTransaction.
williamr@2
   204
	@publishedPartner
williamr@2
   205
	@released
williamr@2
   206
	@see CancelTransaction */
williamr@2
   207
	inline void RollbackTransaction() 
williamr@2
   208
		{
williamr@2
   209
		CancelTransaction();
williamr@2
   210
		}
williamr@2
   211
williamr@2
   212
	/** Same as CleanupCancelTransactionPushL.
williamr@2
   213
	@publishedPartner
williamr@2
   214
	@released
williamr@2
   215
	@see CleanupCancelTransactionPushL */
williamr@2
   216
	inline void CleanupRollbackTransactionPushL()
williamr@2
   217
		{
williamr@2
   218
		CleanupCancelTransactionPushL();
williamr@2
   219
		}
williamr@2
   220
williamr@2
   221
	IMPORT_C TInt TransactionState();
williamr@2
   222
williamr@2
   223
	/** This API is for internal use only and for testing purposes.
williamr@2
   224
	@internalAll
williamr@2
   225
	*/
williamr@2
   226
	IMPORT_C static TInt SetGetParameters(const TIpcArgs& aArgs);
williamr@2
   227
	};
williamr@2
   228
williamr@2
   229
#endif // __CENTRALREPOSITORY_H__