|
1 /** |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * TRpsFunctor declaration |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 */ |
|
25 |
|
26 //Base class for the functor's. This defines a couple of pure virtual functions that are overriden by the templated functor class. |
|
27 //We need this base class otherwise passing the templated class around becomes more difficult. |
|
28 #ifndef TRPSFUNCTOR_H |
|
29 #define TRPSFUNCTOR_H |
|
30 |
|
31 #include <e32base.h> |
|
32 #include "rpsasciirqstdefs.h" |
|
33 #include "cctsyintegrationtestsuitepanics.h" |
|
34 |
|
35 |
|
36 |
|
37 class MRpsFunctorBase |
|
38 { |
|
39 public: |
|
40 virtual void ExecuteRpsRequestL() = 0; |
|
41 virtual const TDesC& DisplayToClientTxt() = 0; |
|
42 |
|
43 typedef TUint8 TNotUsed; |
|
44 }; |
|
45 |
|
46 class CRPSMaster; |
|
47 //Templates Functor class. This holds a pointer to a CRPSMaster member function and the parameters for that function. |
|
48 //It is templated so that any function of CRPSMaster can be invoked through this class and also so that it can support function prototypes that take up to 3 parameters. |
|
49 template <class TRpsParam1, class TRpsParam2, class TRpsParam3> |
|
50 class TRpsFunctor : public MRpsFunctorBase |
|
51 { |
|
52 public: |
|
53 |
|
54 typedef void (CRPSMaster::*TRpsWith1ParamFptr)(TRpsParam1 aParam1); // typedef pointer to a CRPSMaster member function which takes 1 param |
|
55 typedef void (CRPSMaster::*TRpsWith2ParamFptr)(TRpsParam1 aParam1, TRpsParam2 aParam2); // typedef pointer to a CRPSMaster member function which takes 2 param |
|
56 typedef void (CRPSMaster::*TRpsWith3ParamFptr)(TRpsParam1 aParam1, TRpsParam2 aParam2, TRpsParam3 aParam3); // typedef pointer to a CRPSMaster member function which takes 3 param |
|
57 |
|
58 public: //overloads of constructors taking 1, 2 or 3 paramters |
|
59 TRpsFunctor(CRPSMaster* aRpsMaster, const TDesC& aDisplayToClientTxt, TEtelLine aLine, TRpsWith1ParamFptr aRpsFptr, TRpsParam1 aRpsParam1); |
|
60 TRpsFunctor(CRPSMaster* aRpsMaster, const TDesC& aDisplayToClientTxt, TEtelLine aLine, TRpsWith2ParamFptr aRpsFptr, TRpsParam1 aRpsParam1, TRpsParam2 aRpsParam2); |
|
61 TRpsFunctor(CRPSMaster* aRpsMaster, const TDesC& aDisplayToClientTxt, TEtelLine aLine, TRpsWith3ParamFptr aRpsFptr, TRpsParam1 aRpsParam1, TRpsParam2 aRpsParam2, TRpsParam3 aRpsParam3); |
|
62 |
|
63 public: //from MRpsFunctorBase |
|
64 void ExecuteRpsRequestL(); |
|
65 const TDesC& DisplayToClientTxt(); |
|
66 |
|
67 protected: |
|
68 void SetDisplayToClientTxt(const TDesC& aDisplayToClientTxt, TEtelLine aLine); |
|
69 |
|
70 private: |
|
71 enum TRpsCallType |
|
72 { |
|
73 EZeroParam, |
|
74 EOneParam, |
|
75 ETwoParam, |
|
76 EThreeParam |
|
77 }; |
|
78 TRpsWith1ParamFptr iRpsFptrWith1Param; |
|
79 TRpsWith2ParamFptr iRpsFptrWith2Param; |
|
80 TRpsWith3ParamFptr iRpsFptrWith3Param; |
|
81 CRPSMaster* iRpsMaster; |
|
82 TRpsParam1 iRpsParam1; //1st rps param |
|
83 TRpsParam2 iRpsParam2; //2nd rps param |
|
84 TRpsParam3 iRpsParam3; //3rd rps param |
|
85 TRpsCallType iRpsCallType; //how many params does the RPS call take - 1,2 or 3 |
|
86 TBuf<255> iDisplayToClientTxt; |
|
87 }; |
|
88 #endif //TRPSFUNCTOR_H |