Thread: [Mockpp-commits] mockpp/mockpp gen_visitablemethod_N.pl,1.9,1.10 VisitableMockMethod0.h,1.7,1.8 Visi
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-11-13 11:52:37
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27506/mockpp Modified Files: gen_visitablemethod_N.pl VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h VisitableMockMethod6.h VisitableMockMethod.cpp VisitableMockMethod.h Log Message: omit Controller class Index: VisitableMockMethod.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- VisitableMockMethod.cpp 29 Oct 2005 21:00:26 -0000 1.4 +++ VisitableMockMethod.cpp 13 Nov 2005 11:52:26 -0000 1.5 @@ -38,28 +38,26 @@ MOCKPP_EXPORT VisitableMockMethodBase::VisitableMockMethodBase(const String &name, - VisitableMockObject *parent) + VisitableMockObject *parent) : MockObject(name, parent) , visitable(parent) , throwables (name + MOCKPP_PCHAR("/throwables"), this) , throwablesInline (true) { - MOCKPP_PRE(parent != 0); - MOCKPP_PRE(name.length() != 0); + MOCKPP_PRE(parent != 0); + MOCKPP_PRE(name.length() != 0); } String MOCKPP_EXPORT VisitableMockMethodBase::getMethodName() const { - static String method_name = getVerifiableName(); // + MOCKPP_PCHAR(".") + m_name; - return method_name; + return getVerifiableName(); // + MOCKPP_PCHAR(".") + m_name; } std::string MOCKPP_EXPORT VisitableMockMethodBase::getMethodIdentifier() const { - static std::string method_id = getLatin1(getMethodName()); - return method_id; + return getLatin1(getMethodName()); } Index: VisitableMockMethod6.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod6.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- VisitableMockMethod6.h 3 Nov 2005 20:50:41 -0000 1.5 +++ VisitableMockMethod6.h 13 Nov 2005 11:52:26 -0000 1.6 @@ -115,7 +115,7 @@ this->getVisitableMockObject()->addActualMethod(this->getMethodIdentifier()); Throwable *t; - if (this->responseValues.find(t, p1, p2, p3, p4, p5, p6)) + if (this->responseThrowables.find(t, p1, p2, p3, p4, p5, p6)) t->throw_me(); this->throwAvailableException(); @@ -144,61 +144,42 @@ public: - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param p5 mock method parameter 5 + * @param p6 mock method parameter 6 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<R>::ControllerFor + void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param p5 mock method parameter 5 - * @param p6 mock method parameter 6 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, p3, p4, p5, p6, count); - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param p5 mock method parameter 5 - * @param p6 mock method parameter 6 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, p3, p4, p5, p6, count); - } - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, p3, p4, p5, p6, count); + } - friend class ControllerFor; + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param p5 mock method parameter 5 + * @param p6 mock method parameter 6 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, p3, p4, p5, p6, count); + } private: @@ -245,68 +226,47 @@ this->forward_param(p1, p2, p3, p4, p5, p6); R ret_val; - if (this->method->responseValues.find(ret_val, p1, p2, p3, p4, p5, p6)) + if (this->responseValues.find(ret_val, p1, p2, p3, p4, p5, p6)) return ret_val; return this->determineReturnValue(); } - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param p5 mock method parameter 5 + * @param p6 mock method parameter 6 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor + void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param p5 mock method parameter 5 - * @param p6 mock method parameter 6 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, p3, p4, p5, p6, count); - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param p5 mock method parameter 5 - * @param p6 mock method parameter 6 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, p3, p4, p5, p6, count); - } - - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, p3, p4, p5, p6, count); + } - friend class ControllerFor; + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param p5 mock method parameter 5 + * @param p6 mock method parameter 6 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, p3, p4, p5, p6, count); + } private: @@ -345,26 +305,6 @@ { this->forward_param(p1, p2, p3, p4, p5, p6); } - - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor - { - public: - - typedef VisitableMockReturningMethodBase<void>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<void> *meth) - : Inherited(meth) - { - } - }; - - friend class ControllerFor; }; Index: VisitableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod2.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VisitableMockMethod2.h 3 Nov 2005 20:50:41 -0000 1.7 +++ VisitableMockMethod2.h 13 Nov 2005 11:52:26 -0000 1.8 @@ -95,7 +95,7 @@ this->getVisitableMockObject()->addActualMethod(this->getMethodIdentifier()); Throwable *t; - if (this->responseValues.find(t, p1, p2)) + if (this->responseThrowables.find(t, p1, p2)) t->throw_me(); this->throwAvailableException(); @@ -116,53 +116,34 @@ public: - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<R>::ControllerFor + void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, count); - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, count); - } - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, count); + } - friend class ControllerFor; + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, count); + } private: @@ -201,60 +182,39 @@ this->forward_param(p1, p2); R ret_val; - if (this->method->responseValues.find(ret_val, p1, p2)) + if (this->responseValues.find(ret_val, p1, p2)) return ret_val; return this->determineReturnValue(); } - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor + void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, count); - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, count); - } - - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, count); + } - friend class ControllerFor; + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, count); + } private: @@ -289,26 +249,6 @@ { this->forward_param(p1, p2); } - - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor - { - public: - - typedef VisitableMockReturningMethodBase<void>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<void> *meth) - : Inherited(meth) - { - } - }; - - friend class ControllerFor; }; Index: gen_visitablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_visitablemethod_N.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- gen_visitablemethod_N.pl 6 Nov 2005 14:25:31 -0000 1.9 +++ gen_visitablemethod_N.pl 13 Nov 2005 11:52:26 -0000 1.10 @@ -246,7 +246,7 @@ this->getVisitableMockObject()->addActualMethod(this->getMethodIdentifier()); Throwable *t; - if (this->responseValues.find(t, " . $args . ")) + if (this->responseThrowables.find(t, " . $args . ")) t->throw_me(); this->throwAvailableException(); @@ -298,67 +298,47 @@ print OUT " public: - - /** Helper object to easily set up the visitable expectations. - * \@ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<R>::ControllerFor - { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * \@param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - }"; +"; if ($numArgs > 0) { print OUT " - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * \@param t the throwable object"; + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * \@param t the throwable object"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " - * \@param p" . $p . " mock method parameter " . $p; } + * \@param p" . $p . " mock method parameter " . $p; } print OUT " - * \@param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, " . $parms . ", unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, " . $args . ", count); - } + * \@param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(Throwable *t, " . $parms . ", unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, " . $args . ", count); + } - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * \@param t the throwable object"; + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * \@param t the throwable object"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " - * \@param p" . $p . " mock method parameter " . $p; } + * \@param p" . $p . " mock method parameter " . $p; } print OUT " - * \@param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, " . $holderParms . ", unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, " . $args . ", count); - }"; + * \@param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(Throwable *t, " . $holderParms . ", unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, " . $args . ", count); + }"; } -print OUT " - }; - - friend class ControllerFor;"; if ($numArgs > 0) { @@ -419,7 +399,7 @@ print OUT " R ret_val; - if (this->method->responseValues.find(ret_val, " . $args . ")) + if (this->responseValues.find(ret_val, " . $args . ")) return ret_val; "; } @@ -427,68 +407,46 @@ print OUT " return this->determineReturnValue(); } - - /** Helper object to easily set up the visitable expectations. - * \@ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor - { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * \@param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } "; if ($numArgs > 0) { print OUT " - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * \@param rv the return value"; + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * \@param rv the return value"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " - * \@param p" . $p . " mock method parameter " . $p; } + * \@param p" . $p . " mock method parameter " . $p; } print OUT " - * \@param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, " . $parms . ", unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, " . $args . ", count); - } + * \@param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const R &rv, " . $parms . ", unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, " . $args . ", count); + } - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * \@param rv the return value"; + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * \@param rv the return value"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " - * \@param p" . $p . " mock method parameter " . $p; } + * \@param p" . $p . " mock method parameter " . $p; } print OUT " - * \@param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, " . $holderParms . ", unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, " . $args . ", count); - }"; + * \@param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const R &rv, " . $holderParms . ", unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, " . $args . ", count); + }"; } -print OUT " - }; - - friend class ControllerFor;"; - if ($numArgs > 0) { print OUT " @@ -532,26 +490,6 @@ { this->forward_param(" . $args . "); } - - /** Helper object to easily set up the visitable expectations. - * \@ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor - { - public: - - typedef VisitableMockReturningMethodBase<void>::ControllerFor Inherited; - - /** Construct the controller object. - * \@param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<void> *meth) - : Inherited(meth) - { - } - }; - - friend class ControllerFor; }; Index: VisitableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod3.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VisitableMockMethod3.h 3 Nov 2005 20:50:41 -0000 1.7 +++ VisitableMockMethod3.h 13 Nov 2005 11:52:26 -0000 1.8 @@ -100,7 +100,7 @@ this->getVisitableMockObject()->addActualMethod(this->getMethodIdentifier()); Throwable *t; - if (this->responseValues.find(t, p1, p2, p3)) + if (this->responseThrowables.find(t, p1, p2, p3)) t->throw_me(); this->throwAvailableException(); @@ -123,55 +123,36 @@ public: - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<R>::ControllerFor + void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, p3, count); - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, p3, count); - } - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, p3, count); + } - friend class ControllerFor; + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, p3, count); + } private: @@ -212,62 +193,41 @@ this->forward_param(p1, p2, p3); R ret_val; - if (this->method->responseValues.find(ret_val, p1, p2, p3)) + if (this->responseValues.find(ret_val, p1, p2, p3)) return ret_val; return this->determineReturnValue(); } - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor + void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, p3, count); - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, p3, count); - } - - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, p3, count); + } - friend class ControllerFor; + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, p3, count); + } private: @@ -303,26 +263,6 @@ { this->forward_param(p1, p2, p3); } - - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor - { - public: - - typedef VisitableMockReturningMethodBase<void>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<void> *meth) - : Inherited(meth) - { - } - }; - - friend class ControllerFor; }; Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- VisitableMockMethod.h 8 Nov 2005 18:41:43 -0000 1.16 +++ VisitableMockMethod.h 13 Nov 2005 11:52:26 -0000 1.17 @@ -98,112 +98,79 @@ public: - /** A controller to set up the mock method. + /** Switches exception handling back to pre-1.2 behaviour. + * @see VisitableMockObject::Controller::unsetThrowablesInline() */ - template <class VMM> - class ControllerFor : public VisitableMockObject::Controller + void unsetThrowablesInline() { - public: - - /** Construct the item. - * @param meth pointer to the method mock - */ - ControllerFor (VMM *meth) - : method(meth) - , object(meth->getVisitableMockObject()) - { - this->object->addController(this); - } - - /** Destruct the item. - */ - virtual ~ControllerFor () - { - this->object->removeController(this); - } - - /** Switches exception handling back to pre-1.2 behaviour. - * @see VisitableMockObject::Controller::unsetThrowablesInline() - */ - void unsetThrowablesInline() - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->throwablesInline = false; - }; - - /** Adds another throwable to the method. - * The throwables are thrown one after the other when the method is - * called after activating until all of them are used. - * @param t a pointer to the throwable - */ - void addThrowable(Throwable *t) - { - std::auto_ptr<Throwable> at (t); - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->throwables.push_back(at.release()); - this->method->throwableInsteadReturn.push_back(true); - } - - /** Adds another throwable to the method. - * The throwables are thrown one after the other when the method is - * called after activating until all of them are used. - * @param w the value to throw - * @param count how often to throw the value - */ - template <class T> - void addThrowable(const T &w, unsigned count = 1) - { - for ( ; count > 0; --count) - addThrowable(make_throwable(w)); - } - - /** Sets the default throwable. - * Once the list of throwables is empty this one is thrown. This also - * means that your method never processes the parameters passed to it. - * @param t a pointer to the throwable - */ - void setDefaultThrowable(Throwable *t) - { - std::auto_ptr<Throwable> at (t); - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->defaultThrowable.take(at.release()); - } + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->throwablesInline = false; + }; - /** Clears all expectations and puts the object in record mode again. - */ - virtual void reset() - { - this->method->defaultThrowable.clear(); - this->method->throwables.clear(); - this->method->throwableInsteadReturn.clear(); - this->method->throwablesInline = true; - } + /** Adds another throwable to the method. + * The throwables are thrown one after the other when the method is + * called after activating until all of them are used. + * @param t a pointer to the throwable + */ + void addThrowable(Throwable *t) + { + std::auto_ptr<Throwable> at (t); + MOCKPP_ASSERT_FALSE(getVisitableMockObject()->isActivated()); + this->throwables.push_back(at.release()); + this->throwableInsteadReturn.push_back(true); + } - /** - * Verify the conditions which are not in the verify() chain of the - * visitable mock object. Located here instead of the method for traditional - * reasons. - * If it fails, an AssertionFailedError is thrown - */ - virtual void verify() - { - Throwable *dt = this->method->defaultThrowable.get(); - if (dt != 0) - { - String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); - fmt << (this->method->getMethodName() + MOCKPP_PCHAR("/defaultThrowable")); - MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); - } - } + /** Adds another throwable to the method. + * The throwables are thrown one after the other when the method is + * called after activating until all of them are used. + * @param w the value to throw + * @param count how often to throw the value + */ + template <class T> + void addThrowable(const T &w, unsigned count = 1) + { + for ( ; count > 0; --count) + addThrowable(make_throwable(w)); + } - protected: + /** Sets the default throwable. + * Once the list of throwables is empty this one is thrown. This also + * means that your method never processes the parameters passed to it. + * @param t a pointer to the throwable + */ + void setDefaultThrowable(Throwable *t) + { + std::auto_ptr<Throwable> at (t); + MOCKPP_ASSERT_FALSE(getVisitableMockObject()->isActivated()); + this->defaultThrowable.take(at.release()); + } - VMM *method; - VisitableMockObject *object; - }; + /** Clears all expectations and puts the object in record mode again. + */ + virtual void reset() + { + this->defaultThrowable.reset(); + this->throwables.reset(); + this->throwableInsteadReturn.clear(); + this->throwablesInline = true; + } - template <class VMM> - friend class ControllerFor; + /** + * Verify the conditions which are not in the verify() chain of the + * visitable mock object. Located here instead of the method for traditional + * reasons. + * If it fails, an AssertionFailedError is thrown + */ + virtual void verify() + { + Throwable *dt = this->defaultThrowable.get(); + if (dt != 0) + { + String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); + fmt << (this->getMethodName() + MOCKPP_PCHAR("/defaultThrowable")); + MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); + } + } protected: @@ -234,73 +201,56 @@ , returnValues(getMethodName() + MOCKPP_PCHAR("/returnValues"), this) {} - /** A controller to set up the mock method. + /** Sets the default return value. + * This value is returned if there are no throwables available and if there + * are no other possible return values in a list. + * @param rv the default return value */ - class ControllerFor : public VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase> + void setDefaultReturnValue(const R &rv) { - typedef VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase<R> > Inherited; - - public: - - /** Construct the item. - * @param meth pointer to the method mock - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Sets the default return value. - * This value is returned if there are no throwables available and if there - * are no other possible return values in a list. - * @param rv the default return value - */ - void setDefaultReturnValue(const R &rv) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->haveDefaultReturnValue = true; - this->method->defaultReturnValue = rv; - } + MOCKPP_ASSERT_FALSE(getVisitableMockObject()->isActivated()); + this->haveDefaultReturnValue = true; + this->defaultReturnValue = rv; + } - /** Adds another return value. - * The values from this list are return one after the other unless there - * are no other throwables or response values available. - * @param rv the next return value - * @param count the number of times this value shall be returned - */ - void addReturnValue(const R &rv, unsigned count = 1) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - for ( ; count > 0; --count) - { - this->method->returnValues.addObjectToReturn(rv); - this->method->throwableInsteadReturn.push_back(false); - } - } + /** Adds another return value. + * The values from this list are return one after the other unless there + * are no other throwables or response values available. + * @param rv the next return value + * @param count the number of times this value shall be returned + */ + void addReturnValue(const R &rv, unsigned count = 1) + { + MOCKPP_ASSERT_FALSE(getVisitableMockObject()->isActivated()); + for ( ; count > 0; --count) + { + this->returnValues.addObjectToReturn(rv); + this->throwableInsteadReturn.push_back(false); + } + } - /** Sets all internal objects to the state after construction. - */ - virtual void reset() - { - Inherited::reset(); - this->method->haveDefaultReturnValue = false; - this->method->defaultReturnValueUsed = false; - } + /** Sets all internal objects to the state after construction. + */ + virtual void reset() + { + VisitableMockMethodBase::reset(); + this->haveDefaultReturnValue = false; + this->defaultReturnValueUsed = false; + } - /** Verify that the expected and actual values are equal. - * If it fails, an AssertionFailedError is thrown - */ - virtual void verify() - { - Inherited::verify(); - if (this->method->haveDefaultReturnValue) - { - String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); - fmt << this->method->getMethodName() + MOCKPP_PCHAR("/defaultReturnValueUsed"); - MOCKPP_ASSERT_TRUE_MESSAGE(fmt, this->method->defaultReturnValueUsed); - } - } - }; + /** Verify that the expected and actual values are equal. + * If it fails, an AssertionFailedError is thrown + */ + virtual void verify() + { + VisitableMockMethodBase::verify(); + if (this->haveDefaultReturnValue) + { + String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); + fmt << this->getMethodName() + MOCKPP_PCHAR("/defaultReturnValueUsed"); + MOCKPP_ASSERT_TRUE_MESSAGE(fmt, this->defaultReturnValueUsed); + } + } protected: @@ -308,7 +258,7 @@ * The values from the default value or the list are returned one after * the other. */ - R determineReturnValue() + R determineReturnValue() const { throwableInsteadReturn.erase(throwableInsteadReturn.begin()); if (returnValues.hasMoreObjects()) @@ -319,12 +269,6 @@ return defaultReturnValue; } -#ifdef __BORLANDC__ - friend class ControllerFor; // BCB5 -#else - friend class VisitableMockReturningMethodBase::ControllerFor; -#endif - protected: mutable ReturnObjectList<R> returnValues; @@ -348,29 +292,6 @@ VisitableMockReturningMethodBase(const String &name, VisitableMockObject *parent) : VisitableMockMethodBase(name, parent) {} - - /** A controller to set up the mock method. - */ - class ControllerFor : public VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase<void> > - { - typedef VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase<void> > Inherited; - - public: - - /** Construct the item. - * @param meth pointer to the method mock - */ - ControllerFor (VisitableMockReturningMethodBase<void> *meth) - : Inherited(meth) - { - } - }; - -#ifdef __BORLANDC__ // BCB5 - friend class ControllerFor; -#else - friend class VisitableMockReturningMethodBase<void>::ControllerFor; -#endif }; Index: VisitableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod4.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VisitableMockMethod4.h 3 Nov 2005 20:50:41 -0000 1.7 +++ VisitableMockMethod4.h 13 Nov 2005 11:52:26 -0000 1.8 @@ -105,7 +105,7 @@ this->getVisitableMockObject()->addActualMethod(this->getMethodIdentifier()); Throwable *t; - if (this->responseValues.find(t, p1, p2, p3, p4)) + if (this->responseThrowables.find(t, p1, p2, p3, p4)) t->throw_me(); this->throwAvailableException(); @@ -130,57 +130,38 @@ public: - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<R>::ControllerFor + void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, p3, p4, count); - } - - /** Adds another response throwable. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param t the throwable object - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(t, p1, p2, p3, p4, count); - } - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, p3, p4, count); + } - friend class ControllerFor; + /** Adds another response throwable. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param t the throwable object + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseThrowables.add(t, p1, p2, p3, p4, count); + } private: @@ -223,64 +204,43 @@ this->forward_param(p1, p2, p3, p4); R ret_val; - if (this->method->responseValues.find(ret_val, p1, p2, p3, p4)) + if (this->responseValues.find(ret_val, p1, p2, p3, p4)) return ret_val; return this->determineReturnValue(); } - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param count the number of times this value shall be returned. Default is unlimited. */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor + void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, unsigned count = MOCKPP_UNLIMITED) { - public: - - typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<R> *meth) - : Inherited(meth) - { - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, p3, p4, count); - } - - /** Adds another response value. - * Response values are determined on the parameters you pass. This way the - * object returns a value that is totally based on the input. - * @param rv the return value - * @param p1 mock method parameter 1 - * @param p2 mock method parameter 2 - * @param p3 mock method parameter 3 - * @param p4 mock method parameter 4 - * @param count the number of times this value shall be returned. Default is unlimited. - */ - void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, unsigned count = MOCKPP_UNLIMITED) - { - MOCKPP_ASSERT_FALSE(this->object->isActivated()); - this->method->responseValues.add(rv, p1, p2, p3, p4, count); - } - - }; + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, p3, p4, count); + } - friend class ControllerFor; + /** Adds another response value. + * Response values are determined on the parameters you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 mock method parameter 1 + * @param p2 mock method parameter 2 + * @param p3 mock method parameter 3 + * @param p4 mock method parameter 4 + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, unsigned count = MOCKPP_UNLIMITED) + { + MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); + this->responseValues.add(rv, p1, p2, p3, p4, count); + } private: @@ -317,26 +277,6 @@ { this->forward_param(p1, p2, p3, p4); } - - /** Helper object to easily set up the visitable expectations. - * @ingroup grp_controller - */ - class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor - { - public: - - typedef VisitableMockReturningMethodBase<void>::ControllerFor Inherited; - - /** Construct the controller object. - * @param meth pointer to according method mock. - */ - ControllerFor (VisitableMockReturningMethodBase<void> *meth) - : Inherited(meth) - { - } - }; - - friend class ControllerFor; }; Index: VisitableMockMethod0.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod0.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VisitableMockMethod0.h 3 Nov 2005 20:50:41 -0000 1.7 +++ VisitableMockMethod0.h 13 Nov 2005 11:52:26 -0000 1.8 @@ -84,25 +84,6 @@ public: - /*... [truncated message content] |