00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef MOCKPP_VISITABLEMOCKOBJECT_MACRO_H
00033 #define MOCKPP_VISITABLEMOCKOBJECT_MACRO_H
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036
00037 #include <mockpp/mockpp.h>
00038
00039 #include <memory>
00040
00042
00043
00044 #define MOCKPP_THROWABLE_INLINE true
00045
00046
00047
00048
00049
00050
00051
00052 #define MOCKPP_IMPL_RESET_VOID_BASE(methname) \
00053 objptr->methname ## Throwables.reset(); \
00054 objptr->methname ## DefaultThrowable.reset(); \
00055 objptr->methname ## ThrowablesInline = MOCKPP_THROWABLE_INLINE; \
00056 objptr->methname ## ThrowableInsteadReturn.clear()
00057
00058 #define MOCKPP_IMPL_RESET_BASE(methname) \
00059 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00060 objptr->methname ## ReturnValues.reset(); \
00061 objptr->methname ## haveDefaultReturnValue = false; \
00062 objptr->methname ## DefaultReturnValueUsed = false
00063
00065
00066 #define MOCKPP_IMPL_RESET_P1(methname) \
00067 objptr->methname ## ResponseValues.reset(); \
00068 objptr->methname ## Parameter1.reset();
00069
00070 #define MOCKPP_IMPL_RESET_P2(methname) \
00071 MOCKPP_IMPL_RESET_P1(methname); \
00072 objptr->methname ## Parameter2.reset()
00073
00074 #define MOCKPP_IMPL_RESET_P3(methname) \
00075 MOCKPP_IMPL_RESET_P2(methname); \
00076 objptr->methname ## Parameter3.reset()
00077
00078 #define MOCKPP_IMPL_RESET_P4(methname) \
00079 MOCKPP_IMPL_RESET_P3(methname); \
00080 objptr->methname ## Parameter4.reset()
00081
00082 #define MOCKPP_IMPL_RESET_P5(methname) \
00083 MOCKPP_IMPL_RESET_P4(methname); \
00084 objptr->methname ## Parameter5.reset()
00085
00087
00088 #define MOCKPP_CONTROLLER_IMPL_RESET_0(methname) \
00089 void reset() \
00090 { \
00091 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00092 MOCKPP_IMPL_RESET_BASE(methname); \
00093 }
00094
00095 #define MOCKPP_CONTROLLER_IMPL_RESET_1(methname) \
00096 void reset() \
00097 { \
00098 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00099 MOCKPP_IMPL_RESET_BASE(methname); \
00100 MOCKPP_IMPL_RESET_P1(methname); \
00101 }
00102
00103 #define MOCKPP_CONTROLLER_IMPL_RESET_2(methname) \
00104 void reset() \
00105 { \
00106 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00107 MOCKPP_IMPL_RESET_BASE(methname); \
00108 MOCKPP_IMPL_RESET_P2(methname); \
00109 }
00110
00111 #define MOCKPP_CONTROLLER_IMPL_RESET_3(methname) \
00112 void reset() \
00113 { \
00114 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00115 MOCKPP_IMPL_RESET_BASE(methname); \
00116 MOCKPP_IMPL_RESET_P3(methname); \
00117 }
00118
00119 #define MOCKPP_CONTROLLER_IMPL_RESET_4(methname) \
00120 void reset() \
00121 { \
00122 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00123 MOCKPP_IMPL_RESET_BASE(methname); \
00124 MOCKPP_IMPL_RESET_P4(methname); \
00125 }
00126
00127 #define MOCKPP_CONTROLLER_IMPL_RESET_5(methname) \
00128 void reset() \
00129 { \
00130 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00131 MOCKPP_IMPL_RESET_BASE(methname); \
00132 MOCKPP_IMPL_RESET_P5(methname); \
00133 }
00134
00136
00137 #define MOCKPP_CONTROLLER_IMPL_VOID_RESET_0(methname) \
00138 void reset() \
00139 { \
00140 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00141 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00142 }
00143
00144 #define MOCKPP_CONTROLLER_IMPL_VOID_RESET_1(methname) \
00145 void reset() \
00146 { \
00147 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00148 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00149 MOCKPP_IMPL_RESET_P1(methname); \
00150 }
00151
00152 #define MOCKPP_CONTROLLER_IMPL_VOID_RESET_2(methname) \
00153 void reset() \
00154 { \
00155 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00156 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00157 MOCKPP_IMPL_RESET_P2(methname); \
00158 }
00159
00160 #define MOCKPP_CONTROLLER_IMPL_VOID_RESET_3(methname) \
00161 void reset() \
00162 { \
00163 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00164 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00165 MOCKPP_IMPL_RESET_P3(methname); \
00166 }
00167
00168 #define MOCKPP_CONTROLLER_IMPL_VOID_RESET_4(methname) \
00169 void reset() \
00170 { \
00171 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00172 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00173 MOCKPP_IMPL_RESET_P4(methname); \
00174 }
00175
00176 #define MOCKPP_CONTROLLER_IMPL_VOID_RESET_5(methname) \
00177 void reset() \
00178 { \
00179 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00180 MOCKPP_IMPL_RESET_VOID_BASE(methname); \
00181 MOCKPP_IMPL_RESET_P5(methname); \
00182 }
00183
00184
00186
00187
00188 #define MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00189 virtual void unsetThrowablesInline() \
00190 { \
00191 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00192 objptr->methname ## ThrowablesInline = false; \
00193 }
00194
00195 #define MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00196 void addThrowable(MOCKPP_NS::Throwable *t_) \
00197 { \
00198 MOCKPP_STD_NS::auto_ptr<MOCKPP_NS::Throwable> at (t_); \
00199 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00200 objptr->methname ## Throwables.push_back(at.release()); \
00201 objptr->methname ## ThrowableInsteadReturn.push_back(true); \
00202 } \
00203 \
00204 template <class T> \
00205 void addThrowable(const T &w, unsigned count = 1) \
00206 { \
00207 for ( ; count > 0; --count) \
00208 addThrowable(MOCKPP_NS::make_throwable(w)); \
00209 } \
00210 \
00211 void setDefaultThrowable(MOCKPP_NS::Throwable *t_) \
00212 { \
00213 MOCKPP_STD_NS::auto_ptr<MOCKPP_NS::Throwable> at (t_); \
00214 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00215 objptr->methname ## DefaultThrowable.take(at.release()); \
00216 }
00217
00219
00220
00221 #define MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00222 virtual void verify() \
00223 { \
00224 if (objptr->methname ## haveDefaultReturnValue) \
00225 { \
00226 MOCKPP_NS::String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); \
00227 fmt << MOCKPP_PCHAR(#methname) MOCKPP_PCHAR("DefaultReturnValueUsed"); \
00228 MOCKPP_ASSERT_TRUE_MESSAGE(fmt, objptr->methname ## DefaultReturnValueUsed); \
00229 } \
00230 \
00231 MOCKPP_NS::Throwable *dt = objptr->methname ## DefaultThrowable.get(); \
00232 if (dt != 0) \
00233 { \
00234 MOCKPP_NS::String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); \
00235 fmt << MOCKPP_PCHAR(#methname) MOCKPP_PCHAR("DefaultThrowable"); \
00236 MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); \
00237 } \
00238 }
00239
00240
00242
00243
00244 #define MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00245 virtual void verify() \
00246 { \
00247 MOCKPP_NS::Throwable *dt = objptr->methname ## DefaultThrowable.get(); \
00248 if (dt != 0) \
00249 { \
00250 MOCKPP_NS::String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); \
00251 fmt << MOCKPP_PCHAR(#methname) MOCKPP_PCHAR("DefaultThrowable"); \
00252 MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); \
00253 } \
00254 }
00255
00256
00258
00259
00260 #define MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00261 void addReturnValue(const ret_type &rv, unsigned count = 1) \
00262 { \
00263 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00264 for ( ; count > 0; --count) \
00265 { \
00266 objptr->methname ## ReturnValues.addObjectToReturn(rv); \
00267 objptr->methname ## ThrowableInsteadReturn.push_back(false); \
00268 } \
00269 } \
00270 \
00271 void setDefaultReturnValue(const ret_type &rv) \
00272 { \
00273 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00274 objptr->methname ## haveDefaultReturnValue = true; \
00275 objptr->methname ## DefaultReturnValue = rv; \
00276 }
00277
00278
00280
00281
00282 #define MOCKPP_CONTROLLER_IMPL_RESP_VAL1(ret_type, methname, type1) \
00283 void addResponseValue(const ret_type &rv, const type1 &p1, unsigned count = MOCKPP_UNLIMITED) \
00284 { \
00285 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00286 objptr->methname ## ResponseValues.add(rv, (type1&)p1, count); \
00287 } \
00288 \
00289 void addResponseValue(const ret_type &rv, const MOCKPP_NS::ConstraintHolder< type1 > &p1, unsigned count = MOCKPP_UNLIMITED) \
00290 { \
00291 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00292 objptr->methname ## ResponseValues.add(rv, p1, count); \
00293 }
00294
00295 #define MOCKPP_CONTROLLER_IMPL_RESP_VAL2(ret_type, methname, type1, type2) \
00296 void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, unsigned count = MOCKPP_UNLIMITED) \
00297 { \
00298 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00299 objptr->methname ## ResponseValues.add(rv, (type1&)p1, (type2&)p2, count); \
00300 } \
00301 \
00302 void addResponseValue(const ret_type &rv, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00303 const MOCKPP_NS::ConstraintHolder< type2 > &p2, unsigned count = MOCKPP_UNLIMITED) \
00304 { \
00305 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00306 objptr->methname ## ResponseValues.add(rv, p1, p2, count); \
00307 }
00308
00309 #define MOCKPP_CONTROLLER_IMPL_RESP_VAL3(ret_type, methname, type1, type2, type3) \
00310 void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, const type3 &p3, unsigned count = MOCKPP_UNLIMITED) \
00311 { \
00312 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00313 objptr->methname ## ResponseValues.add(rv, (type1&)p1, (type2&)p2, (type3&)p3, count); \
00314 } \
00315 \
00316 void addResponseValue(const ret_type &rv, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00317 const MOCKPP_NS::ConstraintHolder< type2 > &p2, \
00318 const MOCKPP_NS::ConstraintHolder< type3 > &p3, unsigned count = MOCKPP_UNLIMITED) \
00319 { \
00320 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00321 objptr->methname ## ResponseValues.add(rv, p1, p2, p3, count); \
00322 }
00323
00324 #define MOCKPP_CONTROLLER_IMPL_RESP_VAL4(ret_type, methname, type1, type2, type3, type4) \
00325 void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, unsigned count = MOCKPP_UNLIMITED) \
00326 { \
00327 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00328 objptr->methname ## ResponseValues.add(rv, (type1 &)p1, (type2 &)p2, (type3 &)p3, (type4 &)p4, count); \
00329 } \
00330 \
00331 void addResponseValue(const ret_type &rv, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00332 const MOCKPP_NS::ConstraintHolder< type2 > &p2, \
00333 const MOCKPP_NS::ConstraintHolder< type3 > &p3, \
00334 const MOCKPP_NS::ConstraintHolder< type4 > &p4, unsigned count = MOCKPP_UNLIMITED) \
00335 { \
00336 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00337 objptr->methname ## ResponseValues.add(rv, p1, p2, p3, p4, count); \
00338 }
00339
00340 #define MOCKPP_CONTROLLER_IMPL_RESP_VAL5(ret_type, methname, type1, type2, type3, type4, type5) \
00341 void addResponseValue(const ret_type &rv, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, const type5 &p5, unsigned count = MOCKPP_UNLIMITED) \
00342 { \
00343 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00344 objptr->methname ## ResponseValues.add(rv, (type1)p1, (type2)p2, (type3)p3, (type4)p4, (type5)p5, count); \
00345 } \
00346 \
00347 void addResponseValue(const ret_type &rv, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00348 const MOCKPP_NS::ConstraintHolder< type2 > &p2, \
00349 const MOCKPP_NS::ConstraintHolder< type3 > &p3, \
00350 const MOCKPP_NS::ConstraintHolder< type4 > &p4, \
00351 const MOCKPP_NS::ConstraintHolder< type5 > &p5, unsigned count = MOCKPP_UNLIMITED) \
00352 { \
00353 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00354 objptr->methname ## ResponseValues.add(rv, p1, p2, p3, p4, p5, count); \
00355 }
00356
00357
00359
00360
00361 #define MOCKPP_CONTROLLER_IMPL_RESP_THROW1(methname, type1) \
00362 void addResponseThrowable(MOCKPP_NS::Throwable *t, const type1 &p1, unsigned count = MOCKPP_UNLIMITED) \
00363 { \
00364 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00365 objptr->methname ## ResponseValues.add(t, (type1&)p1, count); \
00366 } \
00367 \
00368 void addResponseThrowable(MOCKPP_NS::Throwable *t, const MOCKPP_NS::ConstraintHolder< type1 > &p1, unsigned count = MOCKPP_UNLIMITED) \
00369 { \
00370 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00371 objptr->methname ## ResponseValues.add(t, p1, count); \
00372 }
00373
00374 #define MOCKPP_CONTROLLER_IMPL_RESP_THROW2(methname, type1, type2) \
00375 void addResponseThrowable(MOCKPP_NS::Throwable *t, const type1 &p1, const type2 &p2, unsigned count = MOCKPP_UNLIMITED) \
00376 { \
00377 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00378 objptr->methname ## ResponseValues.add(t, (type1&)p1, (type2&)p2, count); \
00379 } \
00380 \
00381 void addResponseThrowable(MOCKPP_NS::Throwable *t, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00382 const MOCKPP_NS::ConstraintHolder< type2 > &p2, unsigned count = MOCKPP_UNLIMITED) \
00383 { \
00384 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00385 objptr->methname ## ResponseValues.add(t, p1, p2, count); \
00386 }
00387
00388 #define MOCKPP_CONTROLLER_IMPL_RESP_THROW3(methname, type1, type2, type3) \
00389 void addResponseThrowable(MOCKPP_NS::Throwable *t, const type1 &p1, const type2 &p2, const type3 &p3, unsigned count = MOCKPP_UNLIMITED) \
00390 { \
00391 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00392 objptr->methname ## ResponseValues.add(t, (type1 &)p1, (type2&)p2, (type3&)p3, count); \
00393 } \
00394 \
00395 void addResponseThrowable(MOCKPP_NS::Throwable *t, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00396 const MOCKPP_NS::ConstraintHolder< type2 > &p2, \
00397 const MOCKPP_NS::ConstraintHolder< type3 > &p3, unsigned count = MOCKPP_UNLIMITED) \
00398 { \
00399 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00400 objptr->methname ## ResponseValues.add(t, p1, p2, p3, count); \
00401 }
00402
00403 #define MOCKPP_CONTROLLER_IMPL_RESP_THROW4(methname, type1, type2, type3, type4) \
00404 void addResponseThrowable(MOCKPP_NS::Throwable *t, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, unsigned count = MOCKPP_UNLIMITED) \
00405 { \
00406 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00407 objptr->methname ## ResponseValues.add(t, (type1 &)p1, (type2 &)p2, (type3 &)p3, (type4 &)p4, count); \
00408 } \
00409 \
00410 void addResponseThrowable(MOCKPP_NS::Throwable *t, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00411 const MOCKPP_NS::ConstraintHolder< type2 > &p2, \
00412 const MOCKPP_NS::ConstraintHolder< type3 > &p3, \
00413 const MOCKPP_NS::ConstraintHolder< type4 > &p4, unsigned count = MOCKPP_UNLIMITED) \
00414 { \
00415 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00416 objptr->methname ## ResponseValues.add(t, p1, p2, p3, p4, count); \
00417 }
00418
00419 #define MOCKPP_CONTROLLER_IMPL_RESP_THROW5(methname, type1, type2, type3, type4, type5) \
00420 void addResponseThrowable(MOCKPP_NS::Throwable *t, const type1 &p1, const type2 &p2, const type3 &p3, const type4 &p4, const type5 &p5, unsigned count = MOCKPP_UNLIMITED) \
00421 { \
00422 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00423 objptr->methname ## ResponseValues.add(t, (type1)p1, (type2)p2, (type3)p3, (type4)p4, (type5)p5, count); \
00424 } \
00425 \
00426 void addResponseThrowable(MOCKPP_NS::Throwable *t, const MOCKPP_NS::ConstraintHolder< type1 > &p1, \
00427 const MOCKPP_NS::ConstraintHolder< type2 > &p2, \
00428 const MOCKPP_NS::ConstraintHolder< type3 > &p3, \
00429 const MOCKPP_NS::ConstraintHolder< type4 > &p4, \
00430 const MOCKPP_NS::ConstraintHolder< type5 > &p5, unsigned count = MOCKPP_UNLIMITED) \
00431 { \
00432 MOCKPP_ASSERT_FALSE(objptr->isActivated()); \
00433 objptr->methname ## ResponseValues.add(t, p1, p2, p3, p4, p5, count); \
00434 }
00435
00436
00438
00439
00440 #define MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00441 friend class ControllerFor ## methname; \
00442 public: \
00443 class ControllerFor ## methname : public MOCKPP_NS::VisitableMockObject::Controller \
00444 { \
00445 classname *objptr; \
00446 public: \
00447 ControllerFor ## methname(classname *cls) \
00448 : objptr(cls) \
00449 { \
00450 objptr->addController(this); \
00451 } \
00452 \
00453 virtual ~ControllerFor ## methname() \
00454 { \
00455 objptr->removeController(this); \
00456 }
00457
00458
00459 #define MOCKPP_CONTROLLER_DECL_END }
00460
00461
00462 #define MOCKPP_VOID_CONTROLLER_DECL0(classname, methname) \
00463 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00464 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00465 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00466 MOCKPP_CONTROLLER_IMPL_VOID_RESET_0(methname) \
00467 MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00468 MOCKPP_CONTROLLER_DECL_END
00469
00470 #define MOCKPP_VOID_CONTROLLER_DECL1(classname, methname, type1) \
00471 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00472 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00473 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00474 MOCKPP_CONTROLLER_IMPL_VOID_RESET_1(methname) \
00475 MOCKPP_CONTROLLER_IMPL_RESP_THROW1(methname, type1) \
00476 MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00477 MOCKPP_CONTROLLER_DECL_END
00478
00479 #define MOCKPP_VOID_CONTROLLER_DECL2(classname, methname, type1, type2) \
00480 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00481 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00482 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00483 MOCKPP_CONTROLLER_IMPL_VOID_RESET_2(methname) \
00484 MOCKPP_CONTROLLER_IMPL_RESP_THROW2(methname, type1, type2) \
00485 MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00486 MOCKPP_CONTROLLER_DECL_END
00487
00488 #define MOCKPP_VOID_CONTROLLER_DECL3(classname, methname, type1, type2, type3) \
00489 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00490 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00491 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00492 MOCKPP_CONTROLLER_IMPL_VOID_RESET_3(methname) \
00493 MOCKPP_CONTROLLER_IMPL_RESP_THROW3(methname, type1, type2, type3) \
00494 MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00495 MOCKPP_CONTROLLER_DECL_END
00496
00497 #define MOCKPP_VOID_CONTROLLER_DECL4(classname, methname, type1, type2, type3, type4) \
00498 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00499 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00500 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00501 MOCKPP_CONTROLLER_IMPL_VOID_RESET_4(methname) \
00502 MOCKPP_CONTROLLER_IMPL_RESP_THROW4(methname, type1, type2, type3, type4) \
00503 MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00504 MOCKPP_CONTROLLER_DECL_END
00505
00506 #define MOCKPP_VOID_CONTROLLER_DECL5(classname, methname, type1, type2, type3, type4, type5) \
00507 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00508 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00509 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00510 MOCKPP_CONTROLLER_IMPL_VOID_RESET_5(methname) \
00511 MOCKPP_CONTROLLER_IMPL_RESP_THROW5(methname, type1, type2, type3, type4, type5) \
00512 MOCKPP_CONTROLLER_IMPL_VOID_VERIFY(methname) \
00513 MOCKPP_CONTROLLER_DECL_END
00514
00515
00517
00518
00519 #define MOCKPP_CONTROLLER_DECL0(classname, ret_type, methname) \
00520 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00521 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00522 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00523 MOCKPP_CONTROLLER_IMPL_RESET_0(methname) \
00524 MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00525 MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00526 MOCKPP_CONTROLLER_DECL_END
00527
00528 #define MOCKPP_CONTROLLER_DECL1(classname, ret_type, methname, type1) \
00529 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00530 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00531 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00532 MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00533 MOCKPP_CONTROLLER_IMPL_RESET_1(methname) \
00534 MOCKPP_CONTROLLER_IMPL_RESP_VAL1(ret_type, methname, type1) \
00535 MOCKPP_CONTROLLER_IMPL_RESP_THROW1(methname, type1) \
00536 MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00537 MOCKPP_CONTROLLER_DECL_END
00538
00539 #define MOCKPP_CONTROLLER_DECL2(classname, ret_type, methname, type1, type2) \
00540 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00541 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00542 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00543 MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00544 MOCKPP_CONTROLLER_IMPL_RESET_2(methname) \
00545 MOCKPP_CONTROLLER_IMPL_RESP_VAL2(ret_type, methname, type1, type2) \
00546 MOCKPP_CONTROLLER_IMPL_RESP_THROW2(methname, type1, type2) \
00547 MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00548 MOCKPP_CONTROLLER_DECL_END
00549
00550 #define MOCKPP_CONTROLLER_DECL3(classname, ret_type, methname, type1, type2, type3) \
00551 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00552 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00553 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00554 MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00555 MOCKPP_CONTROLLER_IMPL_RESET_3(methname) \
00556 MOCKPP_CONTROLLER_IMPL_RESP_VAL3(ret_type, methname, type1, type2, type3) \
00557 MOCKPP_CONTROLLER_IMPL_RESP_THROW3(methname, type1, type2, type3) \
00558 MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00559 MOCKPP_CONTROLLER_DECL_END
00560
00561 #define MOCKPP_CONTROLLER_DECL4(classname, ret_type, methname, type1, type2, type3, type4) \
00562 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00563 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00564 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00565 MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00566 MOCKPP_CONTROLLER_IMPL_RESET_4(methname) \
00567 MOCKPP_CONTROLLER_IMPL_RESP_VAL4(ret_type, methname, type1, type2, type3, type4) \
00568 MOCKPP_CONTROLLER_IMPL_RESP_THROW4(methname, type1, type2, type3, type4) \
00569 MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00570 MOCKPP_CONTROLLER_DECL_END
00571
00572 #define MOCKPP_CONTROLLER_DECL5(classname, ret_type, methname, type1, type2, type3, type4, type5) \
00573 MOCKPP_CONTROLLER_DECL_START(classname, methname) \
00574 MOCKPP_CONTROLLER_IMPL_HELPER(methname) \
00575 MOCKPP_CONTROLLER_IMPL_THROW(methname) \
00576 MOCKPP_CONTROLLER_IMPL_RETURN(ret_type, methname) \
00577 MOCKPP_CONTROLLER_IMPL_RESET_5(methname) \
00578 MOCKPP_CONTROLLER_IMPL_RESP_VAL5(ret_type, methname, type1, type2, type3, type4, type5) \
00579 MOCKPP_CONTROLLER_IMPL_RESP_THROW5(methname, type1, type2, type3, type4, type5) \
00580 MOCKPP_CONTROLLER_IMPL_VERIFY(methname) \
00581 MOCKPP_CONTROLLER_DECL_END
00582
00583
00585
00586
00587 #define MOCKPP_DECLARE_DEFAULT_VARS(name) \
00588 MOCKPP_NS::ThrowableItem name ## DefaultThrowable; \
00589 mutable MOCKPP_NS::ThrowableList name ## Throwables; \
00590 bool name ## ThrowablesInline; \
00591 mutable MOCKPP_STL::vector<bool> name ## ThrowableInsteadReturn
00592
00593 #define MOCKPP_DECLARE_RETURN_VARS(ret_type, name) \
00594 mutable MOCKPP_NS::ReturnObjectList< ret_type > name ## ReturnValues; \
00595 bool name ## haveDefaultReturnValue; \
00596 mutable bool name ## DefaultReturnValueUsed; \
00597 ret_type name ## DefaultReturnValue
00598
00599
00601
00602
00603 #define MOCKPP_DECLARE_PARAMETER_VARS1(name, type1) \
00604 mutable MOCKPP_NS::ConstraintList< type1 > name ## Parameter1
00605
00606 #define MOCKPP_DECLARE_PARAMETER_VARS2(name, type1, type2) \
00607 MOCKPP_DECLARE_PARAMETER_VARS1(name, type1); \
00608 mutable MOCKPP_NS::ConstraintList< type2 > name ## Parameter2
00609
00610 #define MOCKPP_DECLARE_PARAMETER_VARS3(name, type1, type2, type3) \
00611 MOCKPP_DECLARE_PARAMETER_VARS2(name, type1, type2); \
00612 mutable MOCKPP_NS::ConstraintList< type3 > name ## Parameter3
00613
00614 #define MOCKPP_DECLARE_PARAMETER_VARS4(name, type1, type2, type3, type4) \
00615 MOCKPP_DECLARE_PARAMETER_VARS3(name, type1, type2, type3); \
00616 mutable MOCKPP_NS::ConstraintList< type4 > name ## Parameter4
00617
00618 #define MOCKPP_DECLARE_PARAMETER_VARS5(name, type1, type2, type3, type4, type5) \
00619 MOCKPP_DECLARE_PARAMETER_VARS4(name, type1, type2, type3, type4); \
00620 mutable MOCKPP_NS::ConstraintList< type5 > name ## Parameter5
00621
00623
00624
00625 #define MOCKPP_CONSTRUCT_BASE_VISITABLE_MEMBERS(name) \
00626 name ## Throwables(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("Throwables"), this), \
00627 name ## ThrowablesInline(MOCKPP_THROWABLE_INLINE)
00628
00629 #define MOCKPP_CONSTRUCT_RETURN_VISITABLE_MEMBERS(name) \
00630 name ## ReturnValues(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("/ReturnValues"), this), \
00631 name ## haveDefaultReturnValue(false), \
00632 name ## DefaultReturnValueUsed(false)
00633
00634
00636
00637
00638 #define MOCKPP_CONSTRUCT_PARAMETER1_VISITABLE_MEMBERS(name) \
00639 name ## ResponseValues(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("ResponseValues"), this), \
00640 name ## Parameter1(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("Parameter1"), this)
00641
00642 #define MOCKPP_CONSTRUCT_PARAMETER2_VISITABLE_MEMBERS(name) \
00643 MOCKPP_CONSTRUCT_PARAMETER1_VISITABLE_MEMBERS(name), \
00644 name ## Parameter2(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("Parameter2"), this)
00645
00646 #define MOCKPP_CONSTRUCT_PARAMETER3_VISITABLE_MEMBERS(name) \
00647 MOCKPP_CONSTRUCT_PARAMETER2_VISITABLE_MEMBERS(name), \
00648 name ## Parameter3(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("Parameter3"), this)
00649
00650 #define MOCKPP_CONSTRUCT_PARAMETER4_VISITABLE_MEMBERS(name) \
00651 MOCKPP_CONSTRUCT_PARAMETER3_VISITABLE_MEMBERS(name), \
00652 name ## Parameter4(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("Parameter4"), this)
00653
00654 #define MOCKPP_CONSTRUCT_PARAMETER5_VISITABLE_MEMBERS(name) \
00655 MOCKPP_CONSTRUCT_PARAMETER4_VISITABLE_MEMBERS(name), \
00656 name ## Parameter5(MOCKPP_PCHAR(#name) MOCKPP_PCHAR("Parameter5"), this)
00657
00658
00660
00661
00662 #define MOCKPP_THROWER_IMPL(name) \
00663 bool do_throw = true; \
00664 if (name ## ThrowablesInline) \
00665 { \
00666 if (name ## ThrowableInsteadReturn.size() != 0) \
00667 { \
00668 do_throw = name ## ThrowableInsteadReturn[0]; \
00669 name ## ThrowableInsteadReturn.erase(name ## ThrowableInsteadReturn.begin()); \
00670 } \
00671 } \
00672 if (do_throw && name ## Throwables.hasMoreObjects() != 0) \
00673 { \
00674 MOCKPP_NS::Throwable *thr = name ## Throwables.nextThrowableObject(); \
00675 if (thr != 0) \
00676 thr->throw_me(); \
00677 } \
00678 \
00679 if (name ## DefaultThrowable.get() != 0) \
00680 name ## DefaultThrowable.get()->throw_me()
00681
00683
00684
00689 #define MOCKPP_VOID_VISITABLE0_IMPL(classname, m_name) \
00690 { \
00691 MOCKPP_STL::string func_name (#m_name); \
00692 if (!isActivated() ) \
00693 { \
00694 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00695 return;\
00696 } \
00697 else \
00698 { \
00699 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00700 MOCKPP_THROWER_IMPL(m_name ); \
00701 return;\
00702 } \
00703 } \
00704 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
00705 MOCKPP_DECLARE_DEFAULT_VARS(m_name ); \
00706 MOCKPP_VOID_CONTROLLER_DECL0(classname, m_name)
00707
00708
00718 #define MOCKPP_VOID_VISITABLE1_IMPL(classname, m_name, m_type1, \
00719 a_name, v_type1) \
00720 { \
00721 MOCKPP_STL::string func_name (#m_name); \
00722 if (!isActivated() ) \
00723 { \
00724 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00725 m_name ## Parameter1.addExpected((v_type1)param1); \
00726 return; \
00727 } \
00728 else \
00729 { \
00730 MOCKPP_TRY { \
00731 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00732 MOCKPP_NS::Throwable *t; \
00733 if (m_name ## ResponseValues.find(t, (v_type1)param1)) \
00734 t->throw_me(); \
00735 MOCKPP_THROWER_IMPL(m_name); \
00736 } MOCKPP_CATCH_ALL { \
00737 m_name ## Parameter1.balanceActual(); \
00738 MOCKPP_RETHROW; \
00739 } \
00740 m_name ## Parameter1.addActual((v_type1&)param1); \
00741 return; \
00742 } \
00743 } \
00744 \
00745 void a_name (const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1) \
00746 { \
00747 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
00748 m_name ## Parameter1.addExpected(param1); \
00749 } \
00750 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
00751 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
00752 mutable MOCKPP_NS::ResponseThrowableVector1< v_type1 > m_name ## ResponseValues; \
00753 MOCKPP_DECLARE_PARAMETER_VARS1(m_name, v_type1); \
00754 MOCKPP_VOID_CONTROLLER_DECL1(classname, m_name, v_type1)
00755
00756
00768 #define MOCKPP_VOID_VISITABLE2_IMPL(classname, m_name, m_type1, m_type2, \
00769 a_name, v_type1, v_type2) \
00770 { \
00771 MOCKPP_STL::string func_name (#m_name); \
00772 if (!isActivated() ) \
00773 { \
00774 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00775 m_name ## Parameter1.addExpected((v_type1)param1); \
00776 m_name ## Parameter2.addExpected((v_type2)param2); \
00777 return; \
00778 } \
00779 else \
00780 { \
00781 MOCKPP_TRY { \
00782 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00783 MOCKPP_NS::Throwable *t; \
00784 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2)) \
00785 t->throw_me(); \
00786 MOCKPP_THROWER_IMPL(m_name); \
00787 } MOCKPP_CATCH_ALL { \
00788 m_name ## Parameter1.balanceActual(); \
00789 m_name ## Parameter2.balanceActual(); \
00790 MOCKPP_RETHROW; \
00791 } \
00792 m_name ## Parameter1.addActual((v_type1&)param1); \
00793 m_name ## Parameter2.addActual((v_type2&)param2); \
00794 return; \
00795 } \
00796 } \
00797 \
00798 void a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
00799 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2) \
00800 { \
00801 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
00802 m_name ## Parameter1.addExpected(param1); \
00803 m_name ## Parameter2.addExpected(param2); \
00804 } \
00805 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
00806 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
00807 mutable MOCKPP_NS::ResponseThrowableVector2< v_type1, v_type2 > m_name ## ResponseValues; \
00808 MOCKPP_DECLARE_PARAMETER_VARS2(m_name, v_type1, v_type2); \
00809 MOCKPP_VOID_CONTROLLER_DECL2(classname, m_name, v_type1, v_type2)
00810
00811
00825 #define MOCKPP_VOID_VISITABLE3_IMPL(classname, m_name, m_type1, m_type2, m_type3, \
00826 a_name, v_type1, v_type2, v_type3) \
00827 { \
00828 MOCKPP_STL::string func_name (#m_name); \
00829 if (!isActivated() ) \
00830 { \
00831 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00832 m_name ## Parameter1.addExpected((v_type1)param1); \
00833 m_name ## Parameter2.addExpected((v_type2)param2); \
00834 m_name ## Parameter3.addExpected((v_type3)param3); \
00835 return; \
00836 } \
00837 else \
00838 { \
00839 MOCKPP_TRY { \
00840 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00841 MOCKPP_NS::Throwable *t; \
00842 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3)) \
00843 t->throw_me(); \
00844 MOCKPP_THROWER_IMPL(m_name); \
00845 } MOCKPP_CATCH_ALL { \
00846 m_name ## Parameter1.balanceActual(); \
00847 m_name ## Parameter2.balanceActual(); \
00848 m_name ## Parameter3.balanceActual(); \
00849 MOCKPP_RETHROW; \
00850 } \
00851 m_name ## Parameter1.addActual((v_type1&)param1); \
00852 m_name ## Parameter2.addActual((v_type2&)param2); \
00853 m_name ## Parameter3.addActual((v_type3&)param3); \
00854 return; \
00855 } \
00856 } \
00857 \
00858 void a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
00859 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2, \
00860 const MOCKPP_NS::ConstraintHolder< v_type3 > ¶m3) \
00861 { \
00862 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
00863 m_name ## Parameter1.addExpected(param1); \
00864 m_name ## Parameter2.addExpected(param2); \
00865 m_name ## Parameter3.addExpected(param3); \
00866 } \
00867 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
00868 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
00869 mutable MOCKPP_NS::ResponseThrowableVector3< v_type1, v_type2, v_type3 > m_name ## ResponseValues; \
00870 MOCKPP_DECLARE_PARAMETER_VARS3(m_name, v_type1, v_type2, v_type3); \
00871 MOCKPP_VOID_CONTROLLER_DECL3(classname, m_name, v_type1, v_type2, v_type3)
00872
00873
00889 #define MOCKPP_VOID_VISITABLE4_IMPL(classname, m_name, m_type1, m_type2, m_type3, m_type4, \
00890 a_name, v_type1, v_type2, v_type3, v_type4) \
00891 { \
00892 MOCKPP_STL::string func_name (#m_name); \
00893 if (!isActivated() ) \
00894 { \
00895 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00896 m_name ## Parameter1.addExpected((v_type1)param1); \
00897 m_name ## Parameter2.addExpected((v_type2)param2); \
00898 m_name ## Parameter3.addExpected((v_type3)param3); \
00899 m_name ## Parameter4.addExpected((v_type4)param4); \
00900 return; \
00901 } \
00902 else \
00903 { \
00904 MOCKPP_TRY { \
00905 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00906 MOCKPP_NS::Throwable *t; \
00907 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4)) \
00908 t->throw_me(); \
00909 MOCKPP_THROWER_IMPL(m_name); \
00910 } MOCKPP_CATCH_ALL { \
00911 m_name ## Parameter1.balanceActual(); \
00912 m_name ## Parameter2.balanceActual(); \
00913 m_name ## Parameter3.balanceActual(); \
00914 m_name ## Parameter4.balanceActual(); \
00915 MOCKPP_RETHROW; \
00916 } \
00917 m_name ## Parameter1.addActual((v_type1&)param1); \
00918 m_name ## Parameter2.addActual((v_type2&)param2); \
00919 m_name ## Parameter3.addActual((v_type3&)param3); \
00920 m_name ## Parameter4.addActual((v_type4&)param4); \
00921 return; \
00922 } \
00923 } \
00924 \
00925 void a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
00926 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2, \
00927 const MOCKPP_NS::ConstraintHolder< v_type3 > ¶m3, \
00928 const MOCKPP_NS::ConstraintHolder< v_type4 > ¶m4) \
00929 { \
00930 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
00931 m_name ## Parameter1.addExpected(param1); \
00932 m_name ## Parameter2.addExpected(param2); \
00933 m_name ## Parameter3.addExpected(param3); \
00934 m_name ## Parameter4.addExpected(param4); \
00935 } \
00936 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
00937 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
00938 mutable MOCKPP_NS::ResponseThrowableVector4< v_type1, v_type2, v_type3, v_type4 > m_name ## ResponseValues; \
00939 MOCKPP_DECLARE_PARAMETER_VARS4(m_name, v_type1, v_type2, v_type3, v_type4); \
00940 MOCKPP_VOID_CONTROLLER_DECL4(classname, m_name, v_type1, v_type2, v_type3, v_type4)
00941
00942
00960 #define MOCKPP_VOID_VISITABLE5_IMPL(classname, m_name, m_type1, m_type2, m_type3, m_type4, m_type5, \
00961 a_name, v_type1, v_type2, v_type3, v_type4, v_type5) \
00962 { \
00963 MOCKPP_STL::string func_name (#m_name); \
00964 if (!isActivated() ) \
00965 { \
00966 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00967 m_name ## Parameter1.addExpected((v_type1)param1); \
00968 m_name ## Parameter2.addExpected((v_type2)param2); \
00969 m_name ## Parameter3.addExpected((v_type3)param3); \
00970 m_name ## Parameter4.addExpected((v_type4)param4); \
00971 m_name ## Parameter5.addExpected((v_type5)param5); \
00972 return; \
00973 } \
00974 else \
00975 { \
00976 MOCKPP_TRY { \
00977 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
00978 MOCKPP_NS::Throwable *t; \
00979 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4, (v_type5)param5)) \
00980 t->throw_me(); \
00981 MOCKPP_THROWER_IMPL(m_name); \
00982 } MOCKPP_CATCH_ALL { \
00983 m_name ## Parameter1.balanceActual(); \
00984 m_name ## Parameter2.balanceActual(); \
00985 m_name ## Parameter3.balanceActual(); \
00986 m_name ## Parameter4.balanceActual(); \
00987 m_name ## Parameter5.balanceActual(); \
00988 MOCKPP_RETHROW; \
00989 } \
00990 m_name ## Parameter1.addActual((v_type1&)param1); \
00991 m_name ## Parameter2.addActual((v_type2&)param2); \
00992 m_name ## Parameter3.addActual((v_type3&)param3); \
00993 m_name ## Parameter4.addActual((v_type4&)param4); \
00994 m_name ## Parameter5.addActual((v_type5&)param5); \
00995 return; \
00996 } \
00997 } \
00998 \
00999 void a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
01000 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2, \
01001 const MOCKPP_NS::ConstraintHolder< v_type3 > ¶m3, \
01002 const MOCKPP_NS::ConstraintHolder< v_type4 > ¶m4, \
01003 const MOCKPP_NS::ConstraintHolder< v_type5 > ¶m5) \
01004 { \
01005 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
01006 m_name ## Parameter1.addExpected(param1); \
01007 m_name ## Parameter2.addExpected(param2); \
01008 m_name ## Parameter3.addExpected(param3); \
01009 m_name ## Parameter4.addExpected(param4); \
01010 m_name ## Parameter5.addExpected(param5); \
01011 } \
01012 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01013 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01014 mutable MOCKPP_NS::ResponseThrowableVector5< v_type1, v_type2, v_type3, v_type4, v_type5 > m_name ## ResponseValues; \
01015 MOCKPP_DECLARE_PARAMETER_VARS5(m_name, v_type1, v_type2, v_type3, v_type4, v_type5); \
01016 MOCKPP_VOID_CONTROLLER_DECL5(classname, m_name, v_type1, v_type2, v_type3, v_type4, v_type5)
01017
01018
01027 #define MOCKPP_VISITABLE0_IMPL(classname, m_ret_type, m_name, \
01028 v_ret_type) \
01029 { \
01030 MOCKPP_STL::string func_name = #m_name; \
01031 if (!isActivated() ) \
01032 { \
01033 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01034 v_ret_type ret_val = v_ret_type(); \
01035 return ret_val; \
01036 } \
01037 else \
01038 { \
01039 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01040 MOCKPP_THROWER_IMPL(m_name); \
01041 \
01042 if (m_name ## ReturnValues.hasMoreObjects()) \
01043 return m_name ## ReturnValues.nextReturnObject(); \
01044 \
01045 MOCKPP_ASSERT_TRUE(m_name ## haveDefaultReturnValue == true); \
01046 m_name ## DefaultReturnValueUsed = true; \
01047 return m_name ## DefaultReturnValue; \
01048 } \
01049 } \
01050 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01051 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01052 MOCKPP_DECLARE_RETURN_VARS(v_ret_type, m_name); \
01053 MOCKPP_CONTROLLER_DECL0(classname, v_ret_type, m_name)
01054
01055
01067 #define MOCKPP_VISITABLE1_IMPL(classname, m_ret_type, m_name, m_type1, \
01068 v_ret_type, a_name, v_type1) \
01069 { \
01070 MOCKPP_STL::string func_name = #m_name; \
01071 if (!isActivated() ) \
01072 { \
01073 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01074 m_name ## Parameter1.addExpected((v_type1)param1); \
01075 v_ret_type ret_val = v_ret_type(); \
01076 return ret_val; \
01077 } \
01078 else \
01079 { \
01080 MOCKPP_TRY { \
01081 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01082 MOCKPP_NS::Throwable *t; \
01083 if (m_name ## ResponseValues.find(t, (v_type1)param1)) \
01084 t->throw_me(); \
01085 MOCKPP_THROWER_IMPL(m_name); \
01086 } MOCKPP_CATCH_ALL { \
01087 m_name ## Parameter1.balanceActual(); \
01088 MOCKPP_RETHROW; \
01089 } \
01090 m_name ## Parameter1.addActual((v_type1&)param1); \
01091 \
01092 v_ret_type ret_val; \
01093 if (m_name ## ResponseValues.find(ret_val, (v_type1)param1)) \
01094 return ret_val; \
01095 if (m_name ## ReturnValues.hasMoreObjects()) \
01096 return m_name ## ReturnValues.nextReturnObject(); \
01097 MOCKPP_ASSERT_TRUE(m_name ## haveDefaultReturnValue == true); \
01098 m_name ## DefaultReturnValueUsed = true; \
01099 return m_name ## DefaultReturnValue; \
01100 } \
01101 } \
01102 \
01103 m_ret_type a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1) \
01104 { \
01105 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
01106 m_name ## Parameter1.addExpected(param1); \
01107 return v_ret_type(); \
01108 } \
01109 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01110 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01111 MOCKPP_DECLARE_RETURN_VARS(v_ret_type, m_name); \
01112 mutable MOCKPP_NS::ResponseVector1< v_ret_type, v_type1 > m_name ## ResponseValues; \
01113 MOCKPP_DECLARE_PARAMETER_VARS1(m_name, v_type1); \
01114 MOCKPP_CONTROLLER_DECL1(classname, v_ret_type, m_name, v_type1)
01115
01116
01130 #define MOCKPP_VISITABLE2_IMPL(classname, m_ret_type, m_name, m_type1, m_type2, \
01131 v_ret_type, a_name, v_type1, v_type2) \
01132 { \
01133 MOCKPP_STL::string func_name = #m_name; \
01134 if (!isActivated() ) \
01135 { \
01136 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01137 m_name ## Parameter1.addExpected((v_type1)param1); \
01138 m_name ## Parameter2.addExpected((v_type2)param2); \
01139 v_ret_type ret_val = v_ret_type(); \
01140 return ret_val; \
01141 } \
01142 else \
01143 { \
01144 MOCKPP_TRY { \
01145 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01146 MOCKPP_NS::Throwable *t; \
01147 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2)) \
01148 t->throw_me(); \
01149 MOCKPP_THROWER_IMPL(m_name); \
01150 } MOCKPP_CATCH_ALL { \
01151 m_name ## Parameter1.balanceActual(); \
01152 m_name ## Parameter2.balanceActual(); \
01153 MOCKPP_RETHROW; \
01154 } \
01155 \
01156 m_name ## Parameter1.addActual((v_type1&)param1); \
01157 m_name ## Parameter2.addActual((v_type2&)param2); \
01158 v_ret_type ret_val; \
01159 if (m_name ## ResponseValues.find(ret_val, (v_type1)param1, (v_type2)param2)) \
01160 return ret_val; \
01161 if (m_name ## ReturnValues.hasMoreObjects()) \
01162 return m_name ## ReturnValues.nextReturnObject(); \
01163 MOCKPP_ASSERT_TRUE(m_name ## haveDefaultReturnValue == true); \
01164 m_name ## DefaultReturnValueUsed = true; \
01165 return m_name ## DefaultReturnValue; \
01166 } \
01167 } \
01168 \
01169 m_ret_type a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
01170 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2) \
01171 { \
01172 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
01173 m_name ## Parameter1.addExpected(param1); \
01174 m_name ## Parameter2.addExpected(param2); \
01175 return v_ret_type(); \
01176 } \
01177 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01178 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01179 MOCKPP_DECLARE_RETURN_VARS(v_ret_type, m_name); \
01180 mutable MOCKPP_NS::ResponseVector2< v_ret_type, v_type1, v_type2 > m_name ## ResponseValues; \
01181 MOCKPP_DECLARE_PARAMETER_VARS2(m_name, v_type1, v_type2); \
01182 MOCKPP_CONTROLLER_DECL2(classname, v_ret_type, m_name, v_type1, v_type2)
01183
01184
01200 #define MOCKPP_VISITABLE3_IMPL(classname, m_ret_type, m_name, m_type1, m_type2, m_type3, \
01201 v_ret_type, a_name, v_type1, v_type2, v_type3) \
01202 { \
01203 MOCKPP_STL::string func_name = #m_name; \
01204 if (!isActivated() ) \
01205 { \
01206 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01207 m_name ## Parameter1.addExpected((v_type1)param1); \
01208 m_name ## Parameter2.addExpected((v_type2)param2); \
01209 m_name ## Parameter3.addExpected((v_type3)param3); \
01210 v_ret_type ret_val = v_ret_type(); \
01211 return ret_val; \
01212 } \
01213 else \
01214 { \
01215 MOCKPP_TRY { \
01216 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01217 MOCKPP_NS::Throwable *t; \
01218 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3)) \
01219 t->throw_me(); \
01220 MOCKPP_THROWER_IMPL(m_name); \
01221 } MOCKPP_CATCH_ALL { \
01222 m_name ## Parameter1.balanceActual(); \
01223 m_name ## Parameter2.balanceActual(); \
01224 m_name ## Parameter3.balanceActual(); \
01225 MOCKPP_RETHROW; \
01226 } \
01227 \
01228 m_name ## Parameter1.addActual((v_type1&)param1); \
01229 m_name ## Parameter2.addActual((v_type2&)param2); \
01230 m_name ## Parameter3.addActual((v_type3&)param3); \
01231 v_ret_type ret_val; \
01232 if (m_name ## ResponseValues.find(ret_val, (v_type1)param1, (v_type2)param2, (v_type3)param3)) \
01233 return ret_val; \
01234 if (m_name ## ReturnValues.hasMoreObjects()) \
01235 return m_name ## ReturnValues.nextReturnObject(); \
01236 MOCKPP_ASSERT_TRUE(m_name ## haveDefaultReturnValue == true); \
01237 m_name ## DefaultReturnValueUsed = true; \
01238 return m_name ## DefaultReturnValue; \
01239 } \
01240 } \
01241 \
01242 m_ret_type a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
01243 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2, \
01244 const MOCKPP_NS::ConstraintHolder< v_type3 > ¶m3) \
01245 { \
01246 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
01247 m_name ## Parameter1.addExpected(param1); \
01248 m_name ## Parameter2.addExpected(param2); \
01249 m_name ## Parameter3.addExpected(param3); \
01250 return v_ret_type(); \
01251 } \
01252 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01253 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01254 MOCKPP_DECLARE_RETURN_VARS(v_ret_type, m_name); \
01255 mutable MOCKPP_NS::ResponseVector3< v_ret_type, v_type1, v_type2, v_type3 > m_name ## ResponseValues; \
01256 MOCKPP_DECLARE_PARAMETER_VARS3(m_name, v_type1, v_type2, v_type3); \
01257 MOCKPP_CONTROLLER_DECL3(classname, v_ret_type, m_name, v_type1, v_type2, v_type3)
01258
01276 #define MOCKPP_VISITABLE4_IMPL(classname, m_ret_type, m_name, m_type1, m_type2, m_type3, m_type4, \
01277 v_ret_type, a_name, v_type1, v_type2, v_type3, v_type4) \
01278 { \
01279 MOCKPP_STL::string func_name = #m_name; \
01280 if (!isActivated() ) \
01281 { \
01282 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01283 m_name ## Parameter1.addExpected((v_type1)param1); \
01284 m_name ## Parameter2.addExpected((v_type2)param2); \
01285 m_name ## Parameter3.addExpected((v_type3)param3); \
01286 m_name ## Parameter4.addExpected((v_type4)param4); \
01287 v_ret_type ret_val = v_ret_type(); \
01288 return ret_val; \
01289 } \
01290 else \
01291 { \
01292 MOCKPP_TRY { \
01293 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01294 MOCKPP_NS::Throwable *t; \
01295 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4)) \
01296 t->throw_me(); \
01297 MOCKPP_THROWER_IMPL(m_name); \
01298 } MOCKPP_CATCH_ALL { \
01299 m_name ## Parameter1.balanceActual(); \
01300 m_name ## Parameter2.balanceActual(); \
01301 m_name ## Parameter3.balanceActual(); \
01302 m_name ## Parameter4.balanceActual(); \
01303 MOCKPP_RETHROW; \
01304 } \
01305 \
01306 m_name ## Parameter1.addActual((v_type1&)param1); \
01307 m_name ## Parameter2.addActual((v_type2&)param2); \
01308 m_name ## Parameter3.addActual((v_type3&)param3); \
01309 m_name ## Parameter4.addActual((v_type4&)param4); \
01310 v_ret_type ret_val; \
01311 if (m_name ## ResponseValues.find(ret_val, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4)) \
01312 return ret_val; \
01313 if (m_name ## ReturnValues.hasMoreObjects()) \
01314 return m_name ## ReturnValues.nextReturnObject(); \
01315 MOCKPP_ASSERT_TRUE(m_name ## haveDefaultReturnValue == true); \
01316 m_name ## DefaultReturnValueUsed = true; \
01317 return m_name ## DefaultReturnValue; \
01318 } \
01319 } \
01320 \
01321 m_ret_type a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
01322 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2, \
01323 const MOCKPP_NS::ConstraintHolder< v_type3 > ¶m3, \
01324 const MOCKPP_NS::ConstraintHolder< v_type4 > ¶m4) \
01325 { \
01326 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
01327 m_name ## Parameter1.addExpected(param1); \
01328 m_name ## Parameter2.addExpected(param2); \
01329 m_name ## Parameter3.addExpected(param3); \
01330 m_name ## Parameter4.addExpected(param4); \
01331 return v_ret_type(); \
01332 } \
01333 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01334 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01335 MOCKPP_DECLARE_RETURN_VARS(v_ret_type, m_name); \
01336 mutable MOCKPP_NS::ResponseVector4< v_ret_type, v_type1, v_type2, v_type3, v_type4 > m_name ## ResponseValues; \
01337 MOCKPP_DECLARE_PARAMETER_VARS4(m_name, v_type1, v_type2, v_type3, v_type4); \
01338 MOCKPP_CONTROLLER_DECL4(classname, v_ret_type, m_name, v_type1, v_type2, v_type3, v_type4)
01339
01359 #define MOCKPP_VISITABLE5_IMPL(classname, m_ret_type, m_name, m_type1, m_type2, m_type3, m_type4, m_type5, \
01360 v_ret_type, a_name, v_type1, v_type2, v_type3, v_type4, v_type5) \
01361 { \
01362 MOCKPP_STL::string func_name = #m_name; \
01363 if (!isActivated() ) \
01364 { \
01365 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01366 m_name ## Parameter1.addExpected((v_type1)param1); \
01367 m_name ## Parameter2.addExpected((v_type2)param2); \
01368 m_name ## Parameter3.addExpected((v_type3)param3); \
01369 m_name ## Parameter4.addExpected((v_type4)param4); \
01370 m_name ## Parameter5.addExpected((v_type5)param5); \
01371 v_ret_type ret_val = v_ret_type(); \
01372 return ret_val; \
01373 } \
01374 else \
01375 { \
01376 MOCKPP_TRY { \
01377 addActualMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + func_name); \
01378 MOCKPP_NS::Throwable *t; \
01379 if (m_name ## ResponseValues.find(t, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4, (v_type5)param5)) \
01380 t->throw_me(); \
01381 MOCKPP_THROWER_IMPL(m_name); \
01382 } MOCKPP_CATCH_ALL { \
01383 m_name ## Parameter1.balanceActual(); \
01384 m_name ## Parameter2.balanceActual(); \
01385 m_name ## Parameter3.balanceActual(); \
01386 m_name ## Parameter4.balanceActual(); \
01387 m_name ## Parameter5.balanceActual(); \
01388 MOCKPP_RETHROW; \
01389 } \
01390 \
01391 m_name ## Parameter1.addActual((v_type1&)param1); \
01392 m_name ## Parameter2.addActual((v_type2&)param2); \
01393 m_name ## Parameter3.addActual((v_type3&)param3); \
01394 m_name ## Parameter4.addActual((v_type4&)param4); \
01395 m_name ## Parameter5.addActual((v_type5&)param5); \
01396 v_ret_type ret_val; \
01397 if (m_name ## ResponseValues.find(ret_val, (v_type1)param1, (v_type2)param2, (v_type3)param3, (v_type4)param4, (v_type5)param5)) \
01398 return ret_val; \
01399 if (m_name ## ReturnValues.hasMoreObjects()) \
01400 return m_name ## ReturnValues.nextReturnObject(); \
01401 MOCKPP_ASSERT_TRUE(m_name ## haveDefaultReturnValue == true); \
01402 m_name ## DefaultReturnValueUsed = true; \
01403 return m_name ## DefaultReturnValue; \
01404 } \
01405 } \
01406 \
01407 m_ret_type a_name(const MOCKPP_NS::ConstraintHolder< v_type1 > ¶m1, \
01408 const MOCKPP_NS::ConstraintHolder< v_type2 > ¶m2, \
01409 const MOCKPP_NS::ConstraintHolder< v_type3 > ¶m3, \
01410 const MOCKPP_NS::ConstraintHolder< v_type4 > ¶m4, \
01411 const MOCKPP_NS::ConstraintHolder< v_type5 > ¶m5) \
01412 { \
01413 addExpectedMethod(MOCKPP_NS::getLatin1(getVerifiableName()) + "." + #m_name); \
01414 m_name ## Parameter1.addExpected(param1); \
01415 m_name ## Parameter2.addExpected(param2); \
01416 m_name ## Parameter3.addExpected(param3); \
01417 m_name ## Parameter4.addExpected(param4); \
01418 m_name ## Parameter5.addExpected(param5); \
01419 return v_ret_type(); \
01420 } \
01421 MOCKPP_MEMBER_RESTRICTOR_PRIVATE: \
01422 MOCKPP_DECLARE_DEFAULT_VARS(m_name); \
01423 MOCKPP_DECLARE_RETURN_VARS(v_ret_type, m_name); \
01424 mutable MOCKPP_NS::ResponseVector5< v_ret_type, v_type1, v_type2, v_type3, v_type4, v_type5 > m_name ## ResponseValues; \
01425 MOCKPP_DECLARE_PARAMETER_VARS5(m_name, v_type1, v_type2, v_type3, v_type4, v_type5); \
01426 MOCKPP_CONTROLLER_DECL5(classname, v_ret_type, m_name, v_type1, v_type2, v_type3, v_type4, v_type5)
01427
01428
01429 #endif // DOXYGEN_SHOULD_SKIP_THIS
01430
01431
01432 #endif // MOCKPP_VISITABLEMOCKOBJECT_MACRO_H