00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef MOCKPP_COUNTEDCHAINABLEMETHOD_H
00032 #define MOCKPP_COUNTEDCHAINABLEMETHOD_H
00033
00034 #include <mockpp/mockpp.h>
00035
00036 #include <mockpp/CountParameters.h>
00037
00038 #include <mockpp/chaining/ChainableMockMethod0.h>
00039 #include <mockpp/chaining/ChainableMockMethod1.h>
00040 #include <mockpp/chaining/ChainableMockMethod2.h>
00041 #include <mockpp/chaining/ChainableMockMethod3.h>
00042 #include <mockpp/chaining/ChainableMockMethod4.h>
00043 #include <mockpp/chaining/ChainableMockMethod5.h>
00044 #include <mockpp/chaining/ChainableMockMethod6.h>
00045
00046
00047 MOCKPP_NS_START
00048
00049
00050 #ifndef MOCKPP_COUNTED_WEAKNESS
00051
00052
00057 template<unsigned params>
00058 class SwitchChainable
00059 {
00060 };
00061
00062
00067 template<>
00068 class SwitchChainable<0>
00069 {
00070 public:
00071
00074 template< typename RT
00075 , typename P1
00076 , typename P2
00077 , typename P3
00078 , typename P4
00079 , typename P5
00080 , typename P6>
00081 class Method
00082 {
00083 public:
00084
00085 typedef ChainableMockMethod0<RT> ChainableMockMethodType;
00086 };
00087 };
00088
00089
00094 template<>
00095 class SwitchChainable<1>
00096 {
00097 public:
00098
00101 template< typename RT
00102 , typename P1
00103 , typename P2
00104 , typename P3
00105 , typename P4
00106 , typename P5
00107 , typename P6>
00108 class Method
00109 {
00110 public:
00111
00112 typedef ChainableMockMethod1<RT, P1> ChainableMockMethodType;
00113 };
00114 };
00115
00116
00121 template<>
00122 class SwitchChainable<2>
00123 {
00124 public:
00125
00128 template< typename RT
00129 , typename P1
00130 , typename P2
00131 , typename P3
00132 , typename P4
00133 , typename P5
00134 , typename P6>
00135 class Method
00136 {
00137 public:
00138
00139 typedef ChainableMockMethod2<RT, P1, P2> ChainableMockMethodType;
00140 };
00141 };
00142
00143
00148 template<>
00149 class SwitchChainable<3>
00150 {
00151 public:
00152
00155 template< typename RT
00156 , typename P1
00157 , typename P2
00158 , typename P3
00159 , typename P4
00160 , typename P5
00161 , typename P6>
00162 class Method
00163 {
00164 public:
00165
00166 typedef ChainableMockMethod3<RT, P1, P2, P3> ChainableMockMethodType;
00167 };
00168 };
00169
00170
00175 template<>
00176 class SwitchChainable<4>
00177 {
00178 public:
00179
00182 template< typename RT
00183 , typename P1
00184 , typename P2
00185 , typename P3
00186 , typename P4
00187 , typename P5
00188 , typename P6>
00189 class Method
00190 {
00191 public:
00192
00193 typedef ChainableMockMethod4<RT, P1, P2, P3, P4> ChainableMockMethodType;
00194 };
00195 };
00196
00197
00202 template<>
00203 class SwitchChainable<5>
00204 {
00205 public:
00206
00209 template< typename RT
00210 , typename P1
00211 , typename P2
00212 , typename P3
00213 , typename P4
00214 , typename P5
00215 , typename P6>
00216 class Method
00217 {
00218 public:
00219
00220 typedef ChainableMockMethod5<RT, P1, P2, P3, P4, P5> ChainableMockMethodType;
00221 };
00222 };
00223
00224
00229 template<>
00230 class SwitchChainable<6>
00231 {
00232 public:
00233
00236 template< typename RT
00237 , typename P1
00238 , typename P2
00239 , typename P3
00240 , typename P4
00241 , typename P5
00242 , typename P6>
00243 class Method
00244 {
00245 public:
00246
00247 typedef ChainableMockMethod6<RT, P1, P2, P3, P4, P5, P6> ChainableMockMethodType;
00248 };
00249 };
00250
00251
00255 template< typename RT
00256 , typename P1 = NoParameter
00257 , typename P2 = NoParameter
00258 , typename P3 = NoParameter
00259 , typename P4 = NoParameter
00260 , typename P5 = NoParameter
00261 , typename P6 = NoParameter>
00262 class ChainableMockMethod
00263 : public SwitchChainable<CountParameters<RT, P1, P2, P3, P4, P5, P6>::value >
00264 #ifdef MOCKPP_NO_TEMPLATE_HINT
00265 ::Method<RT, P1, P2, P3, P4, P5, P6>
00266 #else
00267 ::template Method<RT, P1, P2, P3, P4, P5, P6>
00268 #endif
00269 ::ChainableMockMethodType
00270 {
00271 public:
00272
00277 ChainableMockMethod(const String &name, ChainableMockObject *parent )
00278 : SwitchChainable<CountParameters<RT, P1, P2, P3, P4, P5, P6>::value >
00279 #ifdef MOCKPP_NO_TEMPLATE_HINT
00280 ::Method<RT, P1, P2, P3, P4, P5, P6>
00281 #else
00282 ::template Method<RT, P1, P2, P3, P4, P5, P6>
00283 #endif
00284 ::ChainableMockMethodType(name, parent)
00285 {
00286 }
00287 };
00288
00289
00290 #else // MOCKPP_COUNTED_WEAKNESS
00291
00292
00297 template< typename RT
00298 , typename P1 = NoParameter
00299 , typename P2 = NoParameter
00300 , typename P3 = NoParameter
00301 , typename P4 = NoParameter
00302 , typename P5 = NoParameter
00303 , typename P6 = NoParameter
00304 , typename P7 = NoParameter>
00305 class ChainableMockMethod
00306 {
00307 };
00308
00309
00313 template<typename RT>
00314 class ChainableMockMethod<RT, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter>
00315 : public ChainableMockMethod0<RT>
00316 {
00317 public:
00318
00323 ChainableMockMethod<RT, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter>
00324 (const String &name, ChainableMockObject *parent )
00325 : ChainableMockMethod0<RT>(name, parent)
00326 {
00327 }
00328 };
00329
00330
00334 template<typename RT, typename P1>
00335 class ChainableMockMethod<RT, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter>
00336 : public ChainableMockMethod1<RT, P1>
00337 {
00338 public:
00339
00344 ChainableMockMethod<RT, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter>
00345 (const String &name, ChainableMockObject *parent )
00346 : ChainableMockMethod1<RT, P1>(name, parent)
00347 {
00348 }
00349 };
00350
00351
00355 template<typename RT, typename P1, typename P2>
00356 class ChainableMockMethod<RT, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter>
00357 : public ChainableMockMethod2<RT, P1, P2>
00358 {
00359 public:
00360
00365 ChainableMockMethod<RT, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter>
00366 (const String &name, ChainableMockObject *parent )
00367 : ChainableMockMethod2<RT, P1, P2>(name, parent)
00368 {
00369 }
00370 };
00371
00372
00376 template<typename RT, typename P1, typename P2, typename P3>
00377 class ChainableMockMethod<RT, P1, P2, P3, NoParameter, NoParameter, NoParameter>
00378 : public ChainableMockMethod3<RT, P1, P2, P3>
00379 {
00380 public:
00381
00386 ChainableMockMethod<RT, P1, P2, P3, NoParameter, NoParameter, NoParameter>
00387 (const String &name, ChainableMockObject *parent )
00388 : ChainableMockMethod3<RT, P1, P2, P3>(name, parent)
00389 {
00390 }
00391 };
00392
00393
00397 template<typename RT, typename P1, typename P2, typename P3, typename P4>
00398 class ChainableMockMethod<RT, P1, P2, P3, P4, NoParameter, NoParameter>
00399 : public ChainableMockMethod4<RT, P1, P2, P3, P4>
00400 {
00401 public:
00402
00407 ChainableMockMethod<RT, P1, P2, P3, P4, NoParameter, NoParameter>
00408 (const String &name, ChainableMockObject *parent )
00409 : ChainableMockMethod4<RT, P1, P2, P3, P4>(name, parent)
00410 {
00411 }
00412 };
00413
00414
00418 template<typename RT, typename P1, typename P2, typename P3, typename P4, typename P5>
00419 class ChainableMockMethod<RT, P1, P2, P3, P4, P5, NoParameter>
00420 : public ChainableMockMethod5<RT, P1, P2, P3, P4, P5>
00421 {
00422 public:
00423
00428 ChainableMockMethod<RT, P1, P2, P3, P4, P5, NoParameter>
00429 (const String &name, ChainableMockObject *parent )
00430 : ChainableMockMethod5<RT, P1, P2, P3, P4, P5>(name, parent)
00431 {
00432 }
00433 };
00434
00435
00439 template<typename RT, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
00440 class ChainableMockMethod<RT, P1, P2, P3, P4, P5, P6>
00441 : public ChainableMockMethod6<RT, P1, P2, P3, P4, P5, P6>
00442 {
00443 public:
00444
00449 ChainableMockMethod<RT, P1, P2, P3, P4, P5, P6>
00450 (const String &name, ChainableMockObject *parent )
00451 : ChainableMockMethod6<RT, P1, P2, P3, P4, P5, P6>(name, parent)
00452 {
00453 }
00454 };
00455
00456
00457 #endif // MOCKPP_COUNTED_WEAKNESS
00458
00459
00460 MOCKPP_NS_END
00461
00462
00463 #endif // MOCKPP_COUNTEDCHAINABLEMETHOD_H
00464