epoc32/include/centralrepository.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/centralrepository.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/centralrepository.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,229 @@
     1.4 -centralrepository.h
     1.5 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __CENTRALREPOSITORY_H__
    1.21 +#define __CENTRALREPOSITORY_H__
    1.22 +
    1.23 +#include <e32base.h>
    1.24 +
    1.25 +
    1.26 +namespace NCentralRepositoryConstants
    1.27 +/** Namespace encapsulating the CentralRepository constants.
    1.28 +@publishedAll
    1.29 +@released
    1.30 +*/
    1.31 +{
    1.32 +	
    1.33 +/** The maximum number of unicode characters that can be stored in a setting
    1.34 +@publishedAll
    1.35 +@released
    1.36 +*/
    1.37 +const TInt KMaxUnicodeStringLength = 1024;
    1.38 +
    1.39 +/** The maximum number of bytes that can be stored in a setting
    1.40 +@publishedAll
    1.41 +@released
    1.42 +*/
    1.43 +const TInt KMaxBinaryLength = KMaxUnicodeStringLength*2;
    1.44 +
    1.45 +/** Error key returned by CommitTransaction in case of an error that cannot be
    1.46 +attributed to any single or partial key. Also notify value for spurious 
    1.47 +notifications (eg when a notification is cancelled or several values change at once )
    1.48 +@internalAll
    1.49 +@released
    1.50 +*/
    1.51 +const TUint32 KUnspecifiedKey = 0xffffffffUL;
    1.52 +
    1.53 +/** Initial buffer size for Find~ API. Initial buffer is used to cut on the number
    1.54 +of IPC calls required for each Find~ API call. If the number of settings found is 
    1.55 +less than or equal to KCentRepFindBufSize then all the settings can be retrieved with
    1.56 +a single IPC.
    1.57 +@internalAll
    1.58 +*/
    1.59 +const TInt KCentRepFindBufSize = 16;
    1.60 +
    1.61 +/** Use KUnspecifiedKey instead of this value.
    1.62 +@publishedAll
    1.63 +@deprecated
    1.64 +*/
    1.65 +const TUint32 KInvalidNotificationId = KUnspecifiedKey;
    1.66 +
    1.67 +/** The 8 most significant bits of a setting's meta-data are reserved for internal use.
    1.68 +Clients should not make use of the reserved bits (unless it is specifically stated
    1.69 +otherwise in Symbian developer documentation).  Clients should not rely on the value
    1.70 +of the reserved bits.  Reserved bits are not guaranteed to be 0 or 1 and are not
    1.71 +guaranteed to stay constant from one GetMeta call to the next.
    1.72 +@publishedPartner
    1.73 +@released
    1.74 +@see CRepository::GetMeta
    1.75 +@see KMetaUnreserved
    1.76 +*/
    1.77 +const TUint32 KMetaSymbianReserved = 0xFF000000; 
    1.78 +
    1.79 +/** The 24 least significant bits of a setting's meta-data are available for use. Clients
    1.80 +should make use of KMetaUnreserved to mask out the reserved bits following a call
    1.81 +to GetMeta.  Clients should not rely on the value of the reserved bits.  Reserved bits
    1.82 +are not guaranteed to be 0 or 1 and are not guaranteed to stay constant from one
    1.83 +GetMeta call to the next.
    1.84 +@publishedPartner
    1.85 +@released
    1.86 +@see CRepository::GetMeta
    1.87 +@see KMetaSymbianReserved 
    1.88 +*/
    1.89 +const TUint32 KMetaUnreserved = 0x00FFFFFF; 
    1.90 +
    1.91 +} // namespace NCentralRepositoryConstants
    1.92 +
    1.93 +/** Provides access to a repository.
    1.94 +
    1.95 +There are potentially 2^32 repositories, each identified by a UID. Within each
    1.96 +repository up to 2^32 settings can be stored. Settings within a repository are
    1.97 +identified by a 32-bit key and may be of the types integer, real or descriptor.
    1.98 +@publishedAll
    1.99 +@released
   1.100 +*/
   1.101 +class CRepository : public CBase
   1.102 +	{
   1.103 +public:
   1.104 +
   1.105 +	/**	Transaction mode chosen with StartTransaction.
   1.106 +	@publishedPartner
   1.107 +	@released */
   1.108 +	enum TTransactionMode
   1.109 +		{
   1.110 +		/** Standard optimistic non-serialised transaction. Can be started at any time
   1.111 +		Commit fails with KErrLocked if another client interrupts it by first committing
   1.112 +		changes: transaction should be repeated until KErrLocked is not returned. */
   1.113 +		EConcurrentReadWriteTransaction = 2,
   1.114 +		/** Pessimistic locking transaction intended for reading consistent values.
   1.115 +		Can only be started if EReadWriteTransaction is not in progress.
   1.116 +		Automatically promoted to EReadWriteTransaction on first write operation
   1.117 +		if no other read transaction is in progress (or fails if not attainable).
   1.118 +		Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction,
   1.119 +		and only make changes in an EReadWriteTransaction. */
   1.120 +		EReadTransaction = 1,
   1.121 +		/** Pessimistic locking transaction intended for writing values. Can only be
   1.122 +		started if no EReadTransaction or EReadWriteTransactions are in progress.
   1.123 +		Use ONLY if all clients can agree not to use EConcurrentReadWriteTransaction,
   1.124 +		and only make changes in an EReadWriteTransaction. */
   1.125 +		EReadWriteTransaction = 3
   1.126 +		};
   1.127 +
   1.128 +	/** Buffer type for aKeyInfo parameter to asynchronous CommitTransaction.
   1.129 +	@see CRepository::CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus)
   1.130 +	@publishedPartner
   1.131 +	@released
   1.132 +	*/
   1.133 +	typedef TPckgBuf<TUint32> TTransactionKeyInfoBuf;
   1.134 +
   1.135 +	IMPORT_C static CRepository* NewL(TUid aRepositoryUid);
   1.136 +	IMPORT_C static CRepository* NewLC(TUid aRepositoryUid);
   1.137 +
   1.138 +	IMPORT_C virtual ~CRepository();
   1.139 +	IMPORT_C TInt Create(TUint32 aKey, TInt aValue);
   1.140 +	IMPORT_C TInt Create(TUint32 aKey, const TReal& aValue);
   1.141 +	IMPORT_C TInt Create(TUint32 aKey, const TDesC8& aValue);
   1.142 +	IMPORT_C TInt Create(TUint32 aKey, const TDesC16& aValue);
   1.143 +
   1.144 +	IMPORT_C TInt Delete(TUint32 aKey);
   1.145 +	IMPORT_C TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey) ;
   1.146 +
   1.147 +	IMPORT_C TInt Get(TUint32 aKey, TInt& aValue);
   1.148 +	IMPORT_C TInt Set(TUint32 aKey, TInt aValue);
   1.149 +	
   1.150 +	IMPORT_C TInt Get(TUint32 aKey, TReal& aValue);
   1.151 +	IMPORT_C TInt Set(TUint32 aKey, const TReal& aValue);
   1.152 +
   1.153 +	IMPORT_C TInt Get(TUint32 aKey, TDes8& aValue);
   1.154 +	IMPORT_C TInt Get(TUint32 aId, TDes8& aValue, TInt& aActualLength);
   1.155 +	IMPORT_C TInt Set(TUint32 aKey, const TDesC8& aValue);
   1.156 +
   1.157 +	IMPORT_C TInt Get(TUint32 aKey, TDes16& aValue);
   1.158 +	IMPORT_C TInt Get(TUint32 aId, TDes16& aValue, TInt& aActualLength);
   1.159 +	IMPORT_C TInt Set(TUint32 aKey, const TDesC16& aValue);
   1.160 +
   1.161 +	IMPORT_C TInt GetMeta(TUint32 aKey, TUint32& aMeta);
   1.162 +
   1.163 +	IMPORT_C TInt Move (TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, 
   1.164 +	                    TUint32 aMask, TUint32 &aErrorKey) ;
   1.165 +
   1.166 +	IMPORT_C TInt FindL(TUint32 aPartialKey, TUint32 aMask,
   1.167 +		RArray<TUint32>& aFoundKeys);
   1.168 +
   1.169 +	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.170 +		TInt aValue, RArray<TUint32>& aFoundKeys);
   1.171 +	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.172 +		const TReal& aValue, RArray<TUint32>& aFoundKeys);
   1.173 +	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.174 +		const TDesC8& aValue, RArray<TUint32>& aFoundKeys);
   1.175 +	IMPORT_C TInt FindEqL(TUint32 aPartialKey, TUint32 aMask,
   1.176 +		const TDesC16& aValue, RArray<TUint32>& aFoundKeys);
   1.177 +
   1.178 +	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.179 +		TInt aValue, RArray<TUint32>& aFoundKeys);
   1.180 +	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.181 +		const TReal& aValue, RArray<TUint32>& aFoundKeys);
   1.182 +	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.183 +		const TDesC8& aValue, RArray<TUint32>& aFoundKeys);
   1.184 +	IMPORT_C TInt FindNeqL(TUint32 aPartialKey, TUint32 aMask,
   1.185 +		const TDesC16& aValue, RArray<TUint32>& aFoundKeys);
   1.186 +
   1.187 +	IMPORT_C TInt NotifyRequest(TUint32 aKey, TRequestStatus& aStatus);
   1.188 +	IMPORT_C TInt NotifyRequest(TUint32 aPartialKey, TUint32 aMask,
   1.189 +		TRequestStatus& aStatus);
   1.190 +
   1.191 +	IMPORT_C TInt NotifyCancel(TUint32 aKey);
   1.192 +	IMPORT_C TInt NotifyCancel(TUint32 aPartialKey, TUint32 aMask);
   1.193 +	IMPORT_C TInt NotifyCancelAll();
   1.194 +
   1.195 +	IMPORT_C TInt Reset();
   1.196 +	IMPORT_C TInt Reset(TUint32 aKey);
   1.197 +
   1.198 +	IMPORT_C TInt StartTransaction(TTransactionMode aMode);
   1.199 +	IMPORT_C void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus);
   1.200 +	IMPORT_C TInt CommitTransaction(TUint32& aKeyInfo);
   1.201 +	IMPORT_C void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus);
   1.202 +	IMPORT_C void CancelTransaction();
   1.203 +	IMPORT_C void CleanupCancelTransactionPushL();
   1.204 +	IMPORT_C void FailTransaction();
   1.205 +	IMPORT_C void CleanupFailTransactionPushL();
   1.206 +
   1.207 +	/** Same as CancelTransaction.
   1.208 +	@publishedPartner
   1.209 +	@released
   1.210 +	@see CancelTransaction */
   1.211 +	inline void RollbackTransaction() 
   1.212 +		{
   1.213 +		CancelTransaction();
   1.214 +		}
   1.215 +
   1.216 +	/** Same as CleanupCancelTransactionPushL.
   1.217 +	@publishedPartner
   1.218 +	@released
   1.219 +	@see CleanupCancelTransactionPushL */
   1.220 +	inline void CleanupRollbackTransactionPushL()
   1.221 +		{
   1.222 +		CleanupCancelTransactionPushL();
   1.223 +		}
   1.224 +
   1.225 +	IMPORT_C TInt TransactionState();
   1.226 +
   1.227 +	/** This API is for internal use only and for testing purposes.
   1.228 +	@internalAll
   1.229 +	*/
   1.230 +	IMPORT_C static TInt SetGetParameters(const TIpcArgs& aArgs);
   1.231 +	};
   1.232 +
   1.233 +#endif // __CENTRALREPOSITORY_H__