[Mockpp-commits] mockpp/mockpp CountedVisitableMethod.h,1.2,1.3 CountParameters.h,1.2,1.3 gen_countp
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-31 20:50:45
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24325/mockpp Modified Files: CountedVisitableMethod.h CountParameters.h gen_countparams_N.pl gen_countvisitable_N.pl Log Message: added docs Index: CountedVisitableMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/CountedVisitableMethod.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CountedVisitableMethod.h 31 Oct 2005 19:01:00 -0000 1.2 +++ CountedVisitableMethod.h 31 Oct 2005 20:50:37 -0000 1.3 @@ -44,19 +44,31 @@ namespace mockpp { + #ifndef MOCKPP_COUNTED_WEAKNESS + +/** Helper class to select the method mock with the correct number of parameters. + * Works with meta programming. + * @internal + */ template<unsigned params> class SwitchVisitable { }; +/** Helper class to select the method mock with 0 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<0> { public: + /** Helper class with an embeded type to the the method mock with 0 parameters. + */ template< typename R , typename P1 , typename P2 @@ -73,11 +85,17 @@ }; +/** Helper class to select the method mock with 1 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<1> { public: + /** Helper class with an embeded type to the the method mock with 1 parameters. + */ template< typename R , typename P1 , typename P2 @@ -94,11 +112,17 @@ }; +/** Helper class to select the method mock with 2 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<2> { public: + /** Helper class with an embeded type to the the method mock with 2 parameters. + */ template< typename R , typename P1 , typename P2 @@ -115,11 +139,17 @@ }; +/** Helper class to select the method mock with 3 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<3> { public: + /** Helper class with an embeded type to the the method mock with 3 parameters. + */ template< typename R , typename P1 , typename P2 @@ -136,11 +166,17 @@ }; +/** Helper class to select the method mock with 4 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<4> { public: + /** Helper class with an embeded type to the the method mock with 4 parameters. + */ template< typename R , typename P1 , typename P2 @@ -157,11 +193,17 @@ }; +/** Helper class to select the method mock with 5 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<5> { public: + /** Helper class with an embeded type to the the method mock with 5 parameters. + */ template< typename R , typename P1 , typename P2 @@ -178,11 +220,17 @@ }; +/** Helper class to select the method mock with 6 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchVisitable<6> { public: + /** Helper class with an embeded type to the the method mock with 6 parameters. + */ template< typename R , typename P1 , typename P2 @@ -199,6 +247,9 @@ }; +/** Method mock class to select the actual class with the desired number of parameters. + * Works with meta programming. + */ template< typename R , typename P1 = NoParameter , typename P2 = NoParameter @@ -213,6 +264,10 @@ { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ 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> @@ -225,6 +280,10 @@ #else // MOCKPP_COUNTED_WEAKNESS +/** Helper class to select the method mock with the correct number of parameters. + * Works with partial specialisation. + * @internal + */ template< typename R , typename P1 = NoParameter , typename P2 = NoParameter @@ -238,12 +297,19 @@ }; +/** Method mock class to select the actual class with 0 parameters. + * Works with partial specialisation. + */ template<typename R> class VisitableMockMethod<R, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> : public VisitableMockMethod0<R> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod0<R>(name, parent) @@ -252,12 +318,19 @@ }; +/** Method mock class to select the actual class with 1 parameters. + * Works with partial specialisation. + */ template<typename R, typename P1> class VisitableMockMethod<R, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> : public VisitableMockMethod1<R, P1> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod1<R, P1>(name, parent) @@ -266,12 +339,19 @@ }; +/** Method mock class to select the actual class with 2 parameters. + * Works with partial specialisation. + */ template<typename R, typename P1, typename P2> class VisitableMockMethod<R, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter> : public VisitableMockMethod2<R, P1, P2> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod2<R, P1, P2>(name, parent) @@ -280,12 +360,19 @@ }; +/** Method mock class to select the actual class with 3 parameters. + * Works with partial specialisation. + */ 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: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, P1, P2, P3, NoParameter, NoParameter, NoParameter> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod3<R, P1, P2, P3>(name, parent) @@ -294,12 +381,19 @@ }; +/** Method mock class to select the actual class with 4 parameters. + * Works with partial specialisation. + */ 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: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, P1, P2, P3, P4, NoParameter, NoParameter> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod4<R, P1, P2, P3, P4>(name, parent) @@ -308,12 +402,19 @@ }; +/** Method mock class to select the actual class with 5 parameters. + * Works with partial specialisation. + */ 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: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, P1, P2, P3, P4, P5, NoParameter> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod5<R, P1, P2, P3, P4, P5>(name, parent) @@ -322,12 +423,19 @@ }; +/** Method mock class to select the actual class with 6 parameters. + * Works with partial specialisation. + */ 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: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ VisitableMockMethod<R, P1, P2, P3, P4, P5, P6> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod6<R, P1, P2, P3, P4, P5, P6>(name, parent) Index: CountParameters.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/CountParameters.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CountParameters.h 31 Oct 2005 19:01:00 -0000 1.2 +++ CountParameters.h 31 Oct 2005 20:50:37 -0000 1.3 @@ -35,12 +35,18 @@ namespace mockpp { +/** Helper class to distinguish present from missing parameters. + * @internal + */ class NoParameter { NoParameter() {} }; +/** Helper class to count actual parameters. + * @internal + */ template<typename T> class CountIfUsed { @@ -50,6 +56,9 @@ }; +/** Helper class to disable counting of non-parameters. + * @internal + */ template<> class CountIfUsed<NoParameter> { @@ -59,6 +68,9 @@ }; +/** Helper class to sum actual parameters. + * @internal + */ template< typename T , typename P1 = NoParameter , typename P2 = NoParameter Index: gen_countparams_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_countparams_N.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gen_countparams_N.pl 30 Oct 2005 13:53:00 -0000 1.1 +++ gen_countparams_N.pl 31 Oct 2005 20:50:37 -0000 1.2 @@ -54,12 +54,18 @@ namespace mockpp { +/** Helper class to distinguish present from missing parameters. + * \@internal + */ class NoParameter { NoParameter() {} }; +/** Helper class to count actual parameters. + * \@internal + */ template<typename T> class CountIfUsed { @@ -69,6 +75,9 @@ }; +/** Helper class to disable counting of non-parameters. + * \@internal + */ template<> class CountIfUsed<NoParameter> { @@ -80,6 +89,9 @@ "; print OUT " +/** Helper class to sum actual parameters. + * \@internal + */ template< typename T , typename P1 = NoParameter"; Index: gen_countvisitable_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_countvisitable_N.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gen_countvisitable_N.pl 31 Oct 2005 19:01:00 -0000 1.2 +++ gen_countvisitable_N.pl 31 Oct 2005 20:50:37 -0000 1.3 @@ -67,8 +67,14 @@ namespace mockpp { + #ifndef MOCKPP_COUNTED_WEAKNESS + +/** Helper class to select the method mock with the correct number of parameters. + * Works with meta programming. + * \@internal + */ template<unsigned params> class SwitchVisitable { @@ -103,6 +109,10 @@ print OUT " +/** Helper class to select the method mock with " . $numArgs ." parameters. + * Works with meta programming. + * \@internal + */ template<> class SwitchVisitable<" . $numArgs ."> { @@ -110,6 +120,8 @@ "; print OUT " + /** Helper class with an embeded type to the the method mock with " . $numArgs ." parameters. + */ template< typename R"; for($p = 1; $p <= $totalNumArgs; ++$p) { print OUT " @@ -130,6 +142,9 @@ print OUT " +/** Method mock class to select the actual class with the desired number of parameters. + * Works with meta programming. + */ template< typename R , typename P1 = NoParameter"; @@ -144,6 +159,10 @@ { public: + /** Constructs the mock object. + * \@param name human readable description about the expectation + * \@param parent parent chainable mock object + */ VisitableMockMethod(const String &name, VisitableMockObject *parent ) : SwitchVisitable<CountParameters<R, " . $templateArgs . ">::value > ::template Method<R, " . $templateArgs . "> @@ -156,6 +175,10 @@ #else // MOCKPP_COUNTED_WEAKNESS +/** Helper class to select the method mock with the correct number of parameters. + * Works with partial specialisation. + * \@internal + */ template< typename R , typename P1 = NoParameter"; @@ -200,12 +223,19 @@ print OUT " +/** Method mock class to select the actual class with " . $numArgs . " parameters. + * Works with partial specialisation. + */ template<typename R" . $templateParms_colon . "> class VisitableMockMethod<R, " . $noParamArgs . "> : public VisitableMockMethod" . $numArgs . "<R" . $templateArgs_colon . "> { public: + /** Constructs the mock object. + * \@param name human readable description about the expectation + * \@param parent parent chainable mock object + */ VisitableMockMethod<R, " . $noParamArgs . "> (const String &name, VisitableMockObject *parent ) : VisitableMockMethod" . $numArgs . "<R" . $templateArgs_colon . ">(name, parent) |