[Mockpp-commits] mockpp/mockpp CountParameters.h,1.1,1.2 CountedVisitableMethod.h,1.1,1.2 Makefile.a
Brought to you by:
ewald-arnold
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30977 Modified Files: CountParameters.h CountedVisitableMethod.h Makefile.am ResponseVector1.h ResponseVector2.h ResponseVector3.h ResponseVector4.h ResponseVector5.h ResponseVector6.h VisitableMockMethod.h VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h VisitableMockMethod6.h gen_countvisitable_N.pl Log Message: fixes bcb5 Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/Makefile.am,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- Makefile.am 30 Oct 2005 19:36:37 -0000 1.95 +++ Makefile.am 31 Oct 2005 19:01:00 -0000 1.96 @@ -136,6 +136,9 @@ echo "" >>$@ echo "#pragma warn -8030 // temporary variables" >>$@ echo "" >>$@ + echo "/* Define to use partial specialisation instead of meta programming. */" >>$@ + echo "#define MOCKPP_COUNTED_WEAKNESS" >>$@ + echo "" >>$@ echo "/* Define to turn debugging globally on. */" >>$@ echo "#undef DEBUG" >>$@ echo "" >>$@ Index: CountedVisitableMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/CountedVisitableMethod.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CountedVisitableMethod.h 30 Oct 2005 13:53:00 -0000 1.1 +++ CountedVisitableMethod.h 31 Oct 2005 19:01:00 -0000 1.2 @@ -32,6 +32,7 @@ #define MOCKPP_COUNTEDVISITABLEMETHOD_H #include <mockpp/CountParameters.h> + #include <mockpp/VisitableMockMethod0.h> #include <mockpp/VisitableMockMethod1.h> #include <mockpp/VisitableMockMethod2.h> @@ -43,6 +44,7 @@ namespace mockpp { +#ifndef MOCKPP_COUNTED_WEAKNESS template<unsigned params> class SwitchVisitable @@ -207,19 +209,136 @@ class VisitableMockMethod : public SwitchVisitable<CountParameters<R, P1, P2, P3, P4, P5, P6>::value> ::template Method<R, P1, P2, P3, P4, P5, P6> - ::VisitableMockMethodType + ::VisitableMockMethodType { public: - - VisitableMockMethod(const String &name, VisitableMockObject *parent ) + + VisitableMockMethod(const String &name, VisitableMockObject *parent ) : SwitchVisitable<CountParameters<R, P1, P2, P3, P4, P5, P6>::value > ::template Method<R, P1, P2, P3, P4, P5, P6> ::VisitableMockMethodType(name, parent) { - } + } +}; + + +#else // MOCKPP_COUNTED_WEAKNESS + + +template< typename R + , typename P1 = NoParameter + , typename P2 = NoParameter + , typename P3 = NoParameter + , typename P4 = NoParameter + , typename P5 = NoParameter + , typename P6 = NoParameter + , typename P7 = NoParameter> +class VisitableMockMethod +{ +}; + + +template<typename R> +class VisitableMockMethod<R, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> + : public VisitableMockMethod0<R> +{ + public: + + VisitableMockMethod<R, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod0<R>(name, parent) + { + } +}; + + +template<typename R, typename P1> +class VisitableMockMethod<R, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> + : public VisitableMockMethod1<R, P1> +{ + public: + + VisitableMockMethod<R, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod1<R, P1>(name, parent) + { + } }; +template<typename R, typename P1, typename P2> +class VisitableMockMethod<R, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter> + : public VisitableMockMethod2<R, P1, P2> +{ + public: + + VisitableMockMethod<R, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod2<R, P1, P2>(name, parent) + { + } +}; + + +template<typename R, typename P1, typename P2, typename P3> +class VisitableMockMethod<R, P1, P2, P3, NoParameter, NoParameter, NoParameter> + : public VisitableMockMethod3<R, P1, P2, P3> +{ + public: + + VisitableMockMethod<R, P1, P2, P3, NoParameter, NoParameter, NoParameter> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod3<R, P1, P2, P3>(name, parent) + { + } +}; + + +template<typename R, typename P1, typename P2, typename P3, typename P4> +class VisitableMockMethod<R, P1, P2, P3, P4, NoParameter, NoParameter> + : public VisitableMockMethod4<R, P1, P2, P3, P4> +{ + public: + + VisitableMockMethod<R, P1, P2, P3, P4, NoParameter, NoParameter> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod4<R, P1, P2, P3, P4>(name, parent) + { + } +}; + + +template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5> +class VisitableMockMethod<R, P1, P2, P3, P4, P5, NoParameter> + : public VisitableMockMethod5<R, P1, P2, P3, P4, P5> +{ + public: + + VisitableMockMethod<R, P1, P2, P3, P4, P5, NoParameter> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod5<R, P1, P2, P3, P4, P5>(name, parent) + { + } +}; + + +template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> +class VisitableMockMethod<R, P1, P2, P3, P4, P5, P6> + : public VisitableMockMethod6<R, P1, P2, P3, P4, P5, P6> +{ + public: + + VisitableMockMethod<R, P1, P2, P3, P4, P5, P6> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod6<R, P1, P2, P3, P4, P5, P6>(name, parent) + { + } +}; + + +#endif // MOCKPP_COUNTED_WEAKNESS + + } // ns mockpp Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- VisitableMockMethod.h 30 Oct 2005 21:10:39 -0000 1.13 +++ VisitableMockMethod.h 31 Oct 2005 19:01:00 -0000 1.14 @@ -177,7 +177,7 @@ if (dt != 0) { String fmt = mockpp_i18n(MOCKPP_PCHAR("%1 is unused.")); - fmt << this->method->getMethodName() + MOCKPP_PCHAR("/defaultThrowable"); + fmt << (this->method->getMethodName() + MOCKPP_PCHAR("/defaultThrowable")); MOCKPP_ASSERT_TRUE_MESSAGE(fmt, dt->hasThrown()); } } @@ -354,3 +354,4 @@ #endif // MOCKPP_VisitableMockMethod_H + Index: gen_countvisitable_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_countvisitable_N.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gen_countvisitable_N.pl 30 Oct 2005 13:53:00 -0000 1.1 +++ gen_countvisitable_N.pl 31 Oct 2005 19:01:00 -0000 1.2 @@ -56,7 +56,8 @@ #ifndef MOCKPP_COUNTEDVISITABLEMETHOD_H #define MOCKPP_COUNTEDVISITABLEMETHOD_H -#include <mockpp/CountParameters.h>"; +#include <mockpp/CountParameters.h> +"; for ($p = 0; $p <= $totalNumArgs; ++$p) { print OUT " #include <mockpp/VisitableMockMethod" . $p . ".h>";} @@ -66,6 +67,7 @@ namespace mockpp { +#ifndef MOCKPP_COUNTED_WEAKNESS template<unsigned params> class SwitchVisitable @@ -129,7 +131,7 @@ print OUT " template< typename R - , typename P1 = NoParameter"; + , typename P1 = NoParameter"; for($p = 2; $p <= $totalNumArgs; ++$p) { print OUT " , typename P" . $p . " = NoParameter"; }; @@ -138,21 +140,87 @@ class VisitableMockMethod : public SwitchVisitable<CountParameters<R, " . $templateArgs . ">::value> ::template Method<R, " . $templateArgs . "> - ::VisitableMockMethodType + ::VisitableMockMethodType { public: - - VisitableMockMethod(const String &name, VisitableMockObject *parent ) + + VisitableMockMethod(const String &name, VisitableMockObject *parent ) : SwitchVisitable<CountParameters<R, " . $templateArgs . ">::value > ::template Method<R, " . $templateArgs . "> ::VisitableMockMethodType(name, parent) { + } +}; + + +#else // MOCKPP_COUNTED_WEAKNESS + + +template< typename R + , typename P1 = NoParameter"; + +for($p = 2; $p <= $totalNumArgs+1; ++$p) { print OUT " + , typename P" . $p . " = NoParameter"; }; + +print OUT "> +class VisitableMockMethod +{ +}; + +"; + +for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) { + + $templateParms = ""; + $templateParms_colon = ""; + for ($i = 1; $i <= $numArgs; ++$i) { + if ($i > 1) { + $templateParms .= ", "; + } + $templateParms .= "typename P$i"; + } + if ($numArgs > 0) { + $templateParms_colon = ", " . $templateParms; } + + + $templateArgs_colon = ""; + $_ = $templateParms; + s/typename //g; + $templateArgs = $_; + if ($numArgs > 0) { + $templateArgs_colon = ", ". $templateArgs; } + + $noParamArgs = $templateArgs; + for ($i = $numArgs+1; $i <= $totalNumArgs; ++$i) { + if ($i > 1) { + $noParamArgs .= ", "; } + $noParamArgs .= "NoParameter"; + } + + +print OUT " +template<typename R" . $templateParms_colon . "> +class VisitableMockMethod<R, " . $noParamArgs . "> + : public VisitableMockMethod" . $numArgs . "<R" . $templateArgs_colon . "> +{ + public: + + VisitableMockMethod<R, " . $noParamArgs . "> + (const String &name, VisitableMockObject *parent ) + : VisitableMockMethod" . $numArgs . "<R" . $templateArgs_colon . ">(name, parent) + { + } }; "; +} + print OUT " +#endif // MOCKPP_COUNTED_WEAKNESS + + } // ns mockpp |