Thread: [Mockpp-commits] mockpp/mockpp/chaining CountedChainableMethod.h,1.2,1.3 gen_countchainable_N.pl,1.2
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-31 20:50:45
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24325/mockpp/chaining Modified Files: CountedChainableMethod.h gen_countchainable_N.pl Log Message: added docs Index: CountedChainableMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/CountedChainableMethod.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CountedChainableMethod.h 31 Oct 2005 19:01:00 -0000 1.2 +++ CountedChainableMethod.h 31 Oct 2005 20:50:37 -0000 1.3 @@ -47,17 +47,27 @@ #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 SwitchChainable { }; +/** Helper class to select the method mock with 0 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<0> { public: + /** Helper class with an embeded type to the the method mock with 0 parameters. + */ template< typename R , typename P1 , typename P2 @@ -74,11 +84,17 @@ }; +/** Helper class to select the method mock with 1 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<1> { public: + /** Helper class with an embeded type to the the method mock with 1 parameters. + */ template< typename R , typename P1 , typename P2 @@ -95,11 +111,17 @@ }; +/** Helper class to select the method mock with 2 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<2> { public: + /** Helper class with an embeded type to the the method mock with 2 parameters. + */ template< typename R , typename P1 , typename P2 @@ -116,11 +138,17 @@ }; +/** Helper class to select the method mock with 3 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<3> { public: + /** Helper class with an embeded type to the the method mock with 3 parameters. + */ template< typename R , typename P1 , typename P2 @@ -137,11 +165,17 @@ }; +/** Helper class to select the method mock with 4 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<4> { public: + /** Helper class with an embeded type to the the method mock with 4 parameters. + */ template< typename R , typename P1 , typename P2 @@ -158,11 +192,17 @@ }; +/** Helper class to select the method mock with 5 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<5> { public: + /** Helper class with an embeded type to the the method mock with 5 parameters. + */ template< typename R , typename P1 , typename P2 @@ -179,11 +219,17 @@ }; +/** Helper class to select the method mock with 6 parameters. + * Works with meta programming. + * @internal + */ template<> class SwitchChainable<6> { public: + /** Helper class with an embeded type to the the method mock with 6 parameters. + */ template< typename R , typename P1 , typename P2 @@ -200,6 +246,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 @@ -214,6 +263,10 @@ { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ ChainableMockMethod(const String &name, ChainableMockObject *parent ) : SwitchChainable<CountParameters<R, P1, P2, P3, P4, P5, P6>::value > ::template Method<R, P1, P2, P3, P4, P5, P6> @@ -226,6 +279,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 @@ -233,18 +290,25 @@ , typename P4 = NoParameter , typename P5 = NoParameter , typename P6 = NoParameter - , typename P7 = NoParameter> + , typename P7 = NoParameter> // one more parameter to enabled full specialisation class ChainableMockMethod { }; +/** Method mock class to select the actual class with 0 parameters. + * Works with partial specialisation. + */ template<typename R> class ChainableMockMethod<R, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> : public ChainableMockMethod0<R> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ ChainableMockMethod<R, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod0<R>(name, parent) @@ -253,12 +317,19 @@ }; +/** Method mock class to select the actual class with 1 parameters. + * Works with partial specialisation. + */ template<typename R, typename P1> class ChainableMockMethod<R, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> : public ChainableMockMethod1<R, P1> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ ChainableMockMethod<R, P1, NoParameter, NoParameter, NoParameter, NoParameter, NoParameter> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod1<R, P1>(name, parent) @@ -267,12 +338,19 @@ }; +/** Method mock class to select the actual class with 2 parameters. + * Works with partial specialisation. + */ template<typename R, typename P1, typename P2> class ChainableMockMethod<R, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter> : public ChainableMockMethod2<R, P1, P2> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ ChainableMockMethod<R, P1, P2, NoParameter, NoParameter, NoParameter, NoParameter> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod2<R, P1, P2>(name, parent) @@ -281,12 +359,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 ChainableMockMethod<R, P1, P2, P3, NoParameter, NoParameter, NoParameter> : public ChainableMockMethod3<R, P1, P2, P3> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ ChainableMockMethod<R, P1, P2, P3, NoParameter, NoParameter, NoParameter> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod3<R, P1, P2, P3>(name, parent) @@ -295,12 +380,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 ChainableMockMethod<R, P1, P2, P3, P4, NoParameter, NoParameter> : public ChainableMockMethod4<R, P1, P2, P3, P4> { public: + /** Constructs the mock object. + * @param name human readable description about the expectation + * @param parent parent chainable mock object + */ ChainableMockMethod<R, P1, P2, P3, P4, NoParameter, NoParameter> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod4<R, P1, P2, P3, P4>(name, parent) @@ -309,12 +401,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 ChainableMockMethod<R, P1, P2, P3, P4, P5, NoParameter> : public ChainableMockMethod5<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 + */ ChainableMockMethod<R, P1, P2, P3, P4, P5, NoParameter> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod5<R, P1, P2, P3, P4, P5>(name, parent) @@ -323,12 +422,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 ChainableMockMethod<R, P1, P2, P3, P4, P5, P6> : public ChainableMockMethod6<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 + */ ChainableMockMethod<R, P1, P2, P3, P4, P5, P6> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod6<R, P1, P2, P3, P4, P5, P6>(name, parent) Index: gen_countchainable_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/gen_countchainable_N.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gen_countchainable_N.pl 31 Oct 2005 19:01:00 -0000 1.2 +++ gen_countchainable_N.pl 31 Oct 2005 20:50:37 -0000 1.3 @@ -65,6 +65,11 @@ #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 SwitchChainable { @@ -98,6 +103,10 @@ print "Creating CountedChainableMethod" . $numArgs ."\n"; print OUT " +/** Helper class to select the method mock with " . $numArgs ." parameters. + * Works with meta programming. + * \@internal + */ template<> class SwitchChainable<" . $numArgs ."> { @@ -105,6 +114,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 " @@ -125,6 +136,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"; @@ -139,6 +153,10 @@ { public: + /** Constructs the mock object. + * \@param name human readable description about the expectation + * \@param parent parent chainable mock object + */ ChainableMockMethod(const String &name, ChainableMockObject *parent ) : SwitchChainable<CountParameters<R, " . $templateArgs . ">::value > ::template Method<R, " . $templateArgs . "> @@ -151,13 +169,17 @@ #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"; for($p = 2; $p <= $totalNumArgs+1; ++$p) { print OUT " , typename P" . $p . " = NoParameter"; }; -print OUT "> +print OUT "> // one more parameter to enabled full specialisation class ChainableMockMethod { }; @@ -195,12 +217,19 @@ print OUT " +/** Method mock class to select the actual class with " . $numArgs . " parameters. + * Works with partial specialisation. + */ template<typename R" . $templateParms_colon . "> class ChainableMockMethod<R, " . $noParamArgs . "> : public ChainableMockMethod" . $numArgs . "<R" . $templateArgs_colon . "> { public: + /** Constructs the mock object. + * \@param name human readable description about the expectation + * \@param parent parent chainable mock object + */ ChainableMockMethod<R, " . $noParamArgs . "> (const String &name, ChainableMockObject *parent ) : ChainableMockMethod" . $numArgs . "<R" . $templateArgs_colon . ">(name, parent) |