os/persistentdata/persistentstorage/centralrepository/cenrepsrv/clientrequest.cpp
Update contrib.
1 // Copyright (c) 2003-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #include "clientrequest.h"
24 #ifndef CENTRAL_REPOSITORY_SERVER_TESTING
26 ///////////////////////////////////////////////////////////////////////////////
28 ///////////////////////////////////////////////////////////////////////////////
29 TClientRequest::TClientRequest(const RMessage2& aMessage)
34 TInt TClientRequest::Function() const
36 return iMessage.Function();
39 void TClientRequest::Complete(TInt aReason) const
41 iMessage.Complete(aReason);
44 void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const
46 iMessage.Panic(aCategory, aReason);
49 TInt TClientRequest::Int0() const
51 return iMessage.Int0();
54 TInt TClientRequest::Int1() const
56 return iMessage.Int1();
59 TInt TClientRequest::Int2() const
61 return iMessage.Int2();
64 TInt TClientRequest::Int3() const
66 return iMessage.Int3();
69 TInt TClientRequest::GetDesLengthL(TInt aParam) const
71 return iMessage.GetDesLengthL(aParam);
74 TInt TClientRequest::GetDesMaxLength(TInt aParam) const
76 return iMessage.GetDesMaxLength(aParam);
79 void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const
81 iMessage.ReadL(aParam, aDes, aOffset);
84 void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const
86 iMessage.ReadL(aParam, aDes, aOffset);
89 void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const
91 iMessage.Read(aParam, aDes, aOffset);
94 void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const
96 iMessage.Read(aParam, aDes, aOffset);
99 TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const
101 return iMessage.Write(aParam, aDes, aOffset);
104 void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const
106 iMessage.WriteL(aParam, aDes);
109 void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const
111 iMessage.WriteL(aParam, aDes, aOffset);
114 TBool TClientRequest::CheckPolicy(const TSecurityPolicy& aSecurityPolicy,const char *aDiagnostic) const
116 return (aSecurityPolicy.CheckPolicy(iMessage,aDiagnostic));
119 ///////////////////////////////////////////////////////////////////////////////
120 ///////////////////////////////////////////////////////////////////////////////
121 #else //IF _UNIT_TESTING_
123 TClientRequest::TClientRequest()
124 : iFunction(KMinTInt), iCapability(0U), iCompletion(KRequestPending),
125 iStatusActive(EFalse), iIdentity(KNullUid)
127 Mem::FillZ(&iParams, sizeof(TInt) * KMaxMessageArguments);
130 TInt TClientRequest::Function() const
135 void TClientRequest::Complete(TInt aReason) const
137 iCompletion = aReason;
140 TRequestStatus* stat = iStatus;
141 User::RequestComplete(stat, aReason);
145 void TClientRequest::Panic(const TDesC& aCategory, TInt aReason) const
147 User::Panic(aCategory, aReason);
150 TInt TClientRequest::Int0() const
155 TInt TClientRequest::Int1() const
160 TInt TClientRequest::Int2() const
165 TInt TClientRequest::Int3() const
170 TInt TClientRequest::GetDesLengthL(TInt aParam) const
172 const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
173 return desPtr->Length();
176 TInt TClientRequest::GetDesMaxLength(TInt aParam) const
178 const TDes8* desPtr = (const TDes8*)iParams[aParam];
179 return desPtr->MaxLength();
182 void TClientRequest::ReadL(TInt aParam, TDes8& aDes, TInt aOffset) const
184 const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
185 aDes.Copy(desPtr->Mid(aOffset));
188 void TClientRequest::ReadL(TInt aParam, TDes& aDes, TInt aOffset) const
190 const TDesC* desPtr = (const TDesC*)iParams[aParam];
191 aDes.Copy(desPtr->Mid(aOffset));
194 void TClientRequest::Read(TInt aParam, TDes8& aDes, TInt aOffset) const
196 const TDesC8* desPtr = (const TDesC8*)iParams[aParam];
197 aDes.Copy(desPtr->Mid(aOffset));
200 void TClientRequest::Read(TInt aParam, TDes& aDes, TInt aOffset) const
202 const TDesC* desPtr = (const TDesC*)iParams[aParam];
203 aDes.Copy(desPtr->Mid(aOffset));
206 TInt TClientRequest::Write(TInt aParam, const TDesC8& aDes, TInt aOffset) const
208 TDes8* desPtr = (TDes8*)iParams[aParam];
209 desPtr->Copy(aDes.Mid(aOffset));
213 void TClientRequest::WriteL(TInt aParam, const TDesC8& aDes) const
215 User::LeaveIfError(Write(aParam, aDes));
218 void TClientRequest::WriteL(TInt aParam, const TDesC& aDes, TInt aOffset) const
220 TDes* desPtr = (TDes*)iParams[aParam];
221 desPtr->Copy(aDes.Mid(aOffset));
224 TBool TClientRequest::CheckPolicy(const TSecurityPolicy& /*aSecurityPolicy*/,const char * /*aDiagnostic*/) const
229 #endif //CENTRAL_REPOSITORY_SERVER_TESTING