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_ReturnAndTriggerStub_H
00032 #define MOCKPP_ReturnAndTriggerStub_H
00033
00034 #include <mockpp/mockpp.h>
00035
00036 #include <mockpp/compat/Formatter.h>
00037
00038 #include <mockpp/stub/TypelessStub.h>
00039
00040 #include <mockpp/constraint/TriggeredConstraint.h>
00041
00042
00043 MOCKPP_NS_START
00044
00045
00050 template < typename R
00051 , typename T1
00052 >
00053 class ReturnAndTriggerStub1 : public TypelessStub<R>
00054 {
00055 public:
00056
00061 ReturnAndTriggerStub1( const R &in_result
00062 , TriggeredConstraint<T1> *in_tc1
00063 )
00064 : result(in_result)
00065 , tc1(in_tc1)
00066 {}
00067
00072 virtual R typelessInvoke()
00073 {
00074 tc1->trigger();
00075 return result;
00076 }
00077
00082 virtual String describeTo( String &buffer ) const
00083 {
00084 String fmt;
00085 {
00086 String tcfmt;
00087 tc1->describeTo(tcfmt);
00088 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00089 fmt << tcfmt;
00090 }
00091
00092 fmt += MOCKPP_PCHAR("returns <%1>");
00093 fmt << result;
00094 buffer += fmt;
00095
00096 return buffer;
00097 }
00098
00099 private:
00100
00101 R result;
00102 TriggeredConstraint<T1> *tc1;
00103 };
00104
00105
00110 template < typename R
00111 , typename T1
00112 , typename T2
00113 >
00114 class ReturnAndTriggerStub2 : public TypelessStub<R>
00115 {
00116 public:
00117
00123 ReturnAndTriggerStub2( const R &in_result
00124 , TriggeredConstraint<T1> *in_tc1
00125 , TriggeredConstraint<T2> *in_tc2
00126 )
00127 : result(in_result)
00128 , tc1(in_tc1)
00129 , tc2(in_tc2)
00130 {}
00131
00136 virtual R typelessInvoke()
00137 {
00138 tc1->trigger();
00139 tc2->trigger();
00140 return result;
00141 }
00142
00147 virtual String describeTo( String &buffer ) const
00148 {
00149 String fmt;
00150 {
00151 String tcfmt;
00152 tc1->describeTo(tcfmt);
00153 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00154 fmt << tcfmt;
00155 }
00156
00157 {
00158 String tcfmt;
00159 tc2->describeTo(tcfmt);
00160 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00161 fmt << tcfmt;
00162 }
00163
00164 fmt += MOCKPP_PCHAR("returns <%1>");
00165 fmt << result;
00166 buffer += fmt;
00167
00168 return buffer;
00169 }
00170
00171 private:
00172
00173 R result;
00174 TriggeredConstraint<T1> *tc1;
00175 TriggeredConstraint<T2> *tc2;
00176 };
00177
00178
00183 template < typename R
00184 , typename T1
00185 , typename T2
00186 , typename T3
00187 >
00188 class ReturnAndTriggerStub3 : public TypelessStub<R>
00189 {
00190 public:
00191
00198 ReturnAndTriggerStub3( const R &in_result
00199 , TriggeredConstraint<T1> *in_tc1
00200 , TriggeredConstraint<T2> *in_tc2
00201 , TriggeredConstraint<T3> *in_tc3
00202 )
00203 : result(in_result)
00204 , tc1(in_tc1)
00205 , tc2(in_tc2)
00206 , tc3(in_tc3)
00207 {}
00208
00213 virtual R typelessInvoke()
00214 {
00215 tc1->trigger();
00216 tc2->trigger();
00217 tc3->trigger();
00218 return result;
00219 }
00220
00225 virtual String describeTo( String &buffer ) const
00226 {
00227 String fmt;
00228 {
00229 String tcfmt;
00230 tc1->describeTo(tcfmt);
00231 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00232 fmt << tcfmt;
00233 }
00234
00235 {
00236 String tcfmt;
00237 tc2->describeTo(tcfmt);
00238 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00239 fmt << tcfmt;
00240 }
00241
00242 {
00243 String tcfmt;
00244 tc3->describeTo(tcfmt);
00245 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00246 fmt << tcfmt;
00247 }
00248
00249 fmt += MOCKPP_PCHAR("returns <%1>");
00250 fmt << result;
00251 buffer += fmt;
00252
00253 return buffer;
00254 }
00255
00256 private:
00257
00258 R result;
00259 TriggeredConstraint<T1> *tc1;
00260 TriggeredConstraint<T2> *tc2;
00261 TriggeredConstraint<T3> *tc3;
00262 };
00263
00264
00269 template < typename R
00270 , typename T1
00271 , typename T2
00272 , typename T3
00273 , typename T4
00274 >
00275 class ReturnAndTriggerStub4 : public TypelessStub<R>
00276 {
00277 public:
00278
00286 ReturnAndTriggerStub4( const R &in_result
00287 , TriggeredConstraint<T1> *in_tc1
00288 , TriggeredConstraint<T2> *in_tc2
00289 , TriggeredConstraint<T3> *in_tc3
00290 , TriggeredConstraint<T4> *in_tc4
00291 )
00292 : result(in_result)
00293 , tc1(in_tc1)
00294 , tc2(in_tc2)
00295 , tc3(in_tc3)
00296 , tc4(in_tc4)
00297 {}
00298
00303 virtual R typelessInvoke()
00304 {
00305 tc1->trigger();
00306 tc2->trigger();
00307 tc3->trigger();
00308 tc4->trigger();
00309 return result;
00310 }
00311
00316 virtual String describeTo( String &buffer ) const
00317 {
00318 String fmt;
00319 {
00320 String tcfmt;
00321 tc1->describeTo(tcfmt);
00322 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00323 fmt << tcfmt;
00324 }
00325
00326 {
00327 String tcfmt;
00328 tc2->describeTo(tcfmt);
00329 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00330 fmt << tcfmt;
00331 }
00332
00333 {
00334 String tcfmt;
00335 tc3->describeTo(tcfmt);
00336 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00337 fmt << tcfmt;
00338 }
00339
00340 {
00341 String tcfmt;
00342 tc4->describeTo(tcfmt);
00343 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00344 fmt << tcfmt;
00345 }
00346
00347 fmt += MOCKPP_PCHAR("returns <%1>");
00348 fmt << result;
00349 buffer += fmt;
00350
00351 return buffer;
00352 }
00353
00354 private:
00355
00356 R result;
00357 TriggeredConstraint<T1> *tc1;
00358 TriggeredConstraint<T2> *tc2;
00359 TriggeredConstraint<T3> *tc3;
00360 TriggeredConstraint<T4> *tc4;
00361 };
00362
00363
00368 template < typename R
00369 , typename T1
00370 , typename T2
00371 , typename T3
00372 , typename T4
00373 , typename T5
00374 >
00375 class ReturnAndTriggerStub5 : public TypelessStub<R>
00376 {
00377 public:
00378
00387 ReturnAndTriggerStub5( const R &in_result
00388 , TriggeredConstraint<T1> *in_tc1
00389 , TriggeredConstraint<T2> *in_tc2
00390 , TriggeredConstraint<T3> *in_tc3
00391 , TriggeredConstraint<T4> *in_tc4
00392 , TriggeredConstraint<T5> *in_tc5
00393 )
00394 : result(in_result)
00395 , tc1(in_tc1)
00396 , tc2(in_tc2)
00397 , tc3(in_tc3)
00398 , tc4(in_tc4)
00399 , tc5(in_tc5)
00400 {}
00401
00406 virtual R typelessInvoke()
00407 {
00408 tc1->trigger();
00409 tc2->trigger();
00410 tc3->trigger();
00411 tc4->trigger();
00412 tc5->trigger();
00413 return result;
00414 }
00415
00420 virtual String describeTo( String &buffer ) const
00421 {
00422 String fmt;
00423 {
00424 String tcfmt;
00425 tc1->describeTo(tcfmt);
00426 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00427 fmt << tcfmt;
00428 }
00429
00430 {
00431 String tcfmt;
00432 tc2->describeTo(tcfmt);
00433 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00434 fmt << tcfmt;
00435 }
00436
00437 {
00438 String tcfmt;
00439 tc3->describeTo(tcfmt);
00440 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00441 fmt << tcfmt;
00442 }
00443
00444 {
00445 String tcfmt;
00446 tc4->describeTo(tcfmt);
00447 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00448 fmt << tcfmt;
00449 }
00450
00451 {
00452 String tcfmt;
00453 tc5->describeTo(tcfmt);
00454 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00455 fmt << tcfmt;
00456 }
00457
00458 fmt += MOCKPP_PCHAR("returns <%1>");
00459 fmt << result;
00460 buffer += fmt;
00461
00462 return buffer;
00463 }
00464
00465 private:
00466
00467 R result;
00468 TriggeredConstraint<T1> *tc1;
00469 TriggeredConstraint<T2> *tc2;
00470 TriggeredConstraint<T3> *tc3;
00471 TriggeredConstraint<T4> *tc4;
00472 TriggeredConstraint<T5> *tc5;
00473 };
00474
00475
00480 template < typename R
00481 , typename T1
00482 , typename T2
00483 , typename T3
00484 , typename T4
00485 , typename T5
00486 , typename T6
00487 >
00488 class ReturnAndTriggerStub6 : public TypelessStub<R>
00489 {
00490 public:
00491
00501 ReturnAndTriggerStub6( const R &in_result
00502 , TriggeredConstraint<T1> *in_tc1
00503 , TriggeredConstraint<T2> *in_tc2
00504 , TriggeredConstraint<T3> *in_tc3
00505 , TriggeredConstraint<T4> *in_tc4
00506 , TriggeredConstraint<T5> *in_tc5
00507 , TriggeredConstraint<T6> *in_tc6
00508 )
00509 : result(in_result)
00510 , tc1(in_tc1)
00511 , tc2(in_tc2)
00512 , tc3(in_tc3)
00513 , tc4(in_tc4)
00514 , tc5(in_tc5)
00515 , tc6(in_tc6)
00516 {}
00517
00522 virtual R typelessInvoke()
00523 {
00524 tc1->trigger();
00525 tc2->trigger();
00526 tc3->trigger();
00527 tc4->trigger();
00528 tc5->trigger();
00529 tc6->trigger();
00530 return result;
00531 }
00532
00537 virtual String describeTo( String &buffer ) const
00538 {
00539 String fmt;
00540 {
00541 String tcfmt;
00542 tc1->describeTo(tcfmt);
00543 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00544 fmt << tcfmt;
00545 }
00546
00547 {
00548 String tcfmt;
00549 tc2->describeTo(tcfmt);
00550 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00551 fmt << tcfmt;
00552 }
00553
00554 {
00555 String tcfmt;
00556 tc3->describeTo(tcfmt);
00557 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00558 fmt << tcfmt;
00559 }
00560
00561 {
00562 String tcfmt;
00563 tc4->describeTo(tcfmt);
00564 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00565 fmt << tcfmt;
00566 }
00567
00568 {
00569 String tcfmt;
00570 tc5->describeTo(tcfmt);
00571 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00572 fmt << tcfmt;
00573 }
00574
00575 {
00576 String tcfmt;
00577 tc6->describeTo(tcfmt);
00578 fmt += MOCKPP_PCHAR("triggers [%1]\n");
00579 fmt << tcfmt;
00580 }
00581
00582 fmt += MOCKPP_PCHAR("returns <%1>");
00583 fmt << result;
00584 buffer += fmt;
00585
00586 return buffer;
00587 }
00588
00589 private:
00590
00591 R result;
00592 TriggeredConstraint<T1> *tc1;
00593 TriggeredConstraint<T2> *tc2;
00594 TriggeredConstraint<T3> *tc3;
00595 TriggeredConstraint<T4> *tc4;
00596 TriggeredConstraint<T5> *tc5;
00597 TriggeredConstraint<T6> *tc6;
00598 };
00599
00600
00601 MOCKPP_NS_END
00602
00603
00604 #endif // MOCKPP_ReturnAndTriggerStub_H
00605