|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef CLIREP_H |
|
17 #define CLIREP_H |
|
18 |
|
19 #include <centralrepository.h> |
|
20 #include "centralrepositoryinternal.h" |
|
21 |
|
22 const TInt32 KCentRepFindWithLenghtBufSize = NCentralRepositoryConstants::KCentRepFindBufSize + 1; |
|
23 |
|
24 class RRepositorySubSession; |
|
25 /** Client-side session. |
|
26 @internalComponent |
|
27 */ |
|
28 class RRepositorySession : public RSessionBase |
|
29 { |
|
30 public: |
|
31 RRepositorySession(); |
|
32 TInt Connect(); |
|
33 inline TInt IncrementSubSessionCounter(); |
|
34 inline TInt DecrementSubSessionCounter(); |
|
35 |
|
36 #if defined(__CENTREP_SERVER_PERFTEST__) || defined(__CENTREP_SERVER_MEMTEST__) || defined(__CENTREP_SERVER_CACHETEST__) |
|
37 TInt SendReceive(TInt aFunction) const; |
|
38 TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const; |
|
39 void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const; |
|
40 #endif |
|
41 |
|
42 private: |
|
43 TInt iSubSessionCounter; |
|
44 }; |
|
45 |
|
46 /** Client-side subSession. |
|
47 @internalComponent |
|
48 */ |
|
49 class RRepositorySubSession : public RSubSessionBase |
|
50 { |
|
51 public: |
|
52 TInt Open(RRepositorySession* aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
53 void Close(); |
|
54 TInt SendReceive(TInt aFunction) const; |
|
55 TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const; |
|
56 void SendReceive(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const; |
|
57 private: |
|
58 RRepositorySession* iSession; |
|
59 }; |
|
60 |
|
61 |
|
62 /** Implementation of CRepository. |
|
63 @internalComponent |
|
64 */ |
|
65 NONSHARABLE_CLASS(CClientRepository) : public CRepository |
|
66 { |
|
67 friend class CRepository; |
|
68 public: |
|
69 static CClientRepository* NewLC(TUid aRepositoryUid); |
|
70 |
|
71 ~CClientRepository(); |
|
72 |
|
73 TInt Create(TUint32 aId, TInt aVal); // TInt |
|
74 TInt Create(TUint32 aId, const TReal& aVal); // TReal |
|
75 TInt Create(TUint32 aId, const TDesC8& aVal); // TDesC8 |
|
76 TInt Create(TUint32 aId, const TDesC16& aVal); // TDesC16 |
|
77 |
|
78 TInt Delete(TUint32 aId); |
|
79 TInt Delete(TUint32 aPartialKey, TUint32 aMask, TUint32 &aErrorKey); |
|
80 |
|
81 TInt Get(TUint32 aId, TInt& aVal); |
|
82 TInt Set(TUint32 aId, TInt aVal); |
|
83 |
|
84 TInt Get(TUint32 aId, TReal& aVal); |
|
85 TInt Set(TUint32 aId, const TReal& aVal); |
|
86 |
|
87 TInt Get(TUint32 aId, TDes8& aVal); |
|
88 TInt Get(TUint32 aId, TDes8& aVal, TInt& aActualLen); |
|
89 TInt Set(TUint32 aId, const TDesC8& aVal); |
|
90 |
|
91 TInt Get(TUint32 aId, TDes& aVal); |
|
92 TInt Get(TUint32 aId, TDes& aVal, TInt& aActualLen); |
|
93 TInt Set(TUint32 aId, const TDesC& aVal); |
|
94 |
|
95 TInt GetMeta(TUint32 aId, TUint32& aMeta); |
|
96 |
|
97 TInt Move(TUint32 aSourcePartialId, TUint32 aTargetPartialId, TUint32 aIdMask, TUint32 &aErrorId) ; |
|
98 |
|
99 TInt FindL(TUint32 aPartialId, TUint32 aIdMask, RArray<TUint32>& aFoundIds); |
|
100 |
|
101 TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray<TUint32>& aFoundIds); |
|
102 TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray<TUint32>& aFoundIds); |
|
103 TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray<TUint32>& aFoundIds); |
|
104 TInt FindEqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray<TUint32>& aFoundIds); |
|
105 |
|
106 TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, TInt aVal, RArray<TUint32>& aFoundIds); |
|
107 TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TReal& aVal, RArray<TUint32>& aFoundIds); |
|
108 TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC8& aVal, RArray<TUint32>& aFoundIds); |
|
109 TInt FindNeqL(TUint32 aPartialId, TUint32 aIdMask, const TDesC& aVal, RArray<TUint32>& aFoundIds); |
|
110 |
|
111 TInt NotifyRequest(TUint32 aId, TRequestStatus& aStatus); |
|
112 TInt NotifyRequest(TUint32 aPartialId, TUint32 aIdMask, TRequestStatus& aStatus); |
|
113 TInt NotifyCancel(TUint32 aId); |
|
114 TInt NotifyCancel(TUint32 aPartialId, TUint32 aIdMask); |
|
115 TInt NotifyCancelAll(); |
|
116 |
|
117 TInt Reset(); |
|
118 TInt Reset(TUint32 aId); |
|
119 |
|
120 TInt StartTransaction(TTransactionMode aMode); |
|
121 void StartTransaction(TTransactionMode aMode, TRequestStatus& aStatus); |
|
122 TInt CommitTransaction(TUint32& aKeyInfo); |
|
123 void CommitTransaction(TDes8& aKeyInfo, TRequestStatus& aStatus); |
|
124 void CancelTransaction(); |
|
125 void CleanupCancelTransactionPushL(); |
|
126 void FailTransaction(); |
|
127 void CleanupFailTransactionPushL(); |
|
128 TInt TransactionState(); |
|
129 |
|
130 private: |
|
131 CClientRepository(); |
|
132 void ConstructL(TUid aRepositoryUid); |
|
133 TInt GetFindResult(const TFixedArray<TUint32, KCentRepFindWithLenghtBufSize>& aUids, RArray<TUint32>& aFoundIds); |
|
134 RRepositorySession* Session(); |
|
135 private: |
|
136 RRepositorySubSession* iSubSession; |
|
137 TInt iClientErr; |
|
138 }; |
|
139 |
|
140 #endif // CLIREP_H |
|
141 |