os/persistentdata/persistentstorage/centralrepository/cenrepcli/clirep.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/centralrepository/cenrepcli/clirep.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,141 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef CLIREP_H
    1.20 +#define CLIREP_H
    1.21 +
    1.22 +#include <centralrepository.h>
    1.23 +#include "centralrepositoryinternal.h"
    1.24 +
    1.25 +const TInt32 KCentRepFindWithLenghtBufSize = NCentralRepositoryConstants::KCentRepFindBufSize + 1;
    1.26 +
    1.27 +class RRepositorySubSession;
    1.28 +/** Client-side session.
    1.29 +@internalComponent
    1.30 +*/
    1.31 +class RRepositorySession : public RSessionBase
    1.32 +	{
    1.33 +public:
    1.34 +	RRepositorySession();
    1.35 +	TInt Connect();
    1.36 +	inline TInt IncrementSubSessionCounter();
    1.37 +	inline TInt DecrementSubSessionCounter();
    1.38 +	
    1.39 +#if defined(__CENTREP_SERVER_PERFTEST__) || defined(__CENTREP_SERVER_MEMTEST__) || defined(__CENTREP_SERVER_CACHETEST__)
    1.40 +	TInt SendReceive(TInt aFunction) const;
    1.41 +	TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const;
    1.42 +	void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const;
    1.43 +#endif
    1.44 +
    1.45 +private:
    1.46 +	TInt iSubSessionCounter;
    1.47 +	};
    1.48 +
    1.49 +/** Client-side subSession.
    1.50 +@internalComponent
    1.51 +*/
    1.52 +class RRepositorySubSession : public RSubSessionBase
    1.53 +	{
    1.54 +public:
    1.55 +	TInt Open(RRepositorySession* aSession,TInt aFunction,const TIpcArgs& aArgs);
    1.56 +	void Close();
    1.57 +	TInt SendReceive(TInt aFunction) const;
    1.58 +	TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const;
    1.59 +	void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const;
    1.60 +private:
    1.61 +	RRepositorySession* iSession;
    1.62 +	};
    1.63 +
    1.64 +
    1.65 +/** Implementation of CRepository.
    1.66 +@internalComponent
    1.67 +*/
    1.68 +NONSHARABLE_CLASS(CClientRepository) : public CRepository
    1.69 +	{
    1.70 +	friend class CRepository;
    1.71 +public:
    1.72 +	static CClientRepository* NewLC(TUid aRepositoryUid);
    1.73 +
    1.74 +	~CClientRepository();
    1.75 +
    1.76 +	TInt Create(TUint32 aId, TInt aVal);			// TInt
    1.77 +	TInt Create(TUint32 aId, const TReal& aVal);	// TReal
    1.78 +	TInt Create(TUint32 aId, const TDesC8& aVal);	// TDesC8
    1.79 +	TInt Create(TUint32 aId, const TDesC16& aVal);	// TDesC16
    1.80 +
    1.81 +	TInt Delete(TUint32 aId);
    1.82 +	TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey);
    1.83 +
    1.84 +	TInt Get(TUint32 aId, TInt& aVal);
    1.85 +	TInt Set(TUint32 aId, TInt aVal);
    1.86 +
    1.87 +	TInt Get(TUint32 aId, TReal& aVal);
    1.88 +	TInt Set(TUint32 aId, const TReal& aVal);
    1.89 +
    1.90 +	TInt Get(TUint32 aId, TDes8& aVal);
    1.91 +	TInt Get(TUint32 aId, TDes8& aVal, TInt& aActualLen);
    1.92 +	TInt Set(TUint32 aId, const TDesC8& aVal);
    1.93 +	
    1.94 +	TInt Get(TUint32 aId, TDes& aVal);
    1.95 +	TInt Get(TUint32 aId, TDes& aVal, TInt& aActualLen);
    1.96 +	TInt Set(TUint32 aId, const TDesC& aVal);
    1.97 +
    1.98 +	TInt GetMeta(TUint32 aId, TUint32& aMeta);
    1.99 +
   1.100 +	TInt Move(TUint32 aSourcePartialId, TUint32 aTargetPartialId, TUint32 aIdMask, TUint32 &aErrorId) ;
   1.101 +	
   1.102 +	TInt FindL(TUint32 aPartialId, TUint32 aIdMask, RArray<TUint32>& aFoundIds);
   1.103 +
   1.104 +	TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray<TUint32>& aFoundIds);
   1.105 +	TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray<TUint32>& aFoundIds);
   1.106 +	TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray<TUint32>& aFoundIds);
   1.107 +	TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray<TUint32>& aFoundIds);
   1.108 +
   1.109 +	TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray<TUint32>& aFoundIds);
   1.110 +	TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray<TUint32>& aFoundIds);
   1.111 +	TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray<TUint32>& aFoundIds);
   1.112 +	TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray<TUint32>& aFoundIds);
   1.113 +
   1.114 +	TInt NotifyRequest(TUint32 aId, TRequestStatus& aStatus);
   1.115 +	TInt NotifyRequest(TUint32 aPartialId, TUint32 aIdMask, TRequestStatus& aStatus);
   1.116 +	TInt NotifyCancel(TUint32 aId);
   1.117 +	TInt NotifyCancel(TUint32 aPartialId, TUint32 aIdMask);
   1.118 +	TInt NotifyCancelAll();
   1.119 +
   1.120 +	TInt Reset();
   1.121 +	TInt Reset(TUint32 aId);
   1.122 +
   1.123 +	TInt StartTransaction(TTransactionMode aMode);
   1.124 +	void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus);
   1.125 +	TInt CommitTransaction(TUint32& aKeyInfo);
   1.126 +	void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus);
   1.127 +	void CancelTransaction();
   1.128 +	void CleanupCancelTransactionPushL();
   1.129 +	void FailTransaction();
   1.130 +	void CleanupFailTransactionPushL();
   1.131 +	TInt TransactionState();
   1.132 +	
   1.133 +private:
   1.134 +	CClientRepository();
   1.135 +	void ConstructL(TUid aRepositoryUid);
   1.136 +	TInt GetFindResult(const TFixedArray<TUint32, KCentRepFindWithLenghtBufSize>& aUids, RArray<TUint32>& aFoundIds);
   1.137 +	RRepositorySession* Session();
   1.138 +private:
   1.139 +	RRepositorySubSession* iSubSession;
   1.140 +	TInt iClientErr;
   1.141 +	};
   1.142 +
   1.143 +#endif // CLIREP_H
   1.144 +