Thread: [Mockpp-commits] mockpp/mockpp/chaining InvocationN.h,NONE,1.1 gen_invocation_N.pl,NONE,1.1 Invocati
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-27 18:54:10
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8932/mockpp/chaining Modified Files: Invocation.h Makefile.am Added Files: InvocationN.h gen_invocation_N.pl Log Message: basic file set working --- NEW FILE: gen_invocation_N.pl --- #!/usr/bin/perl -w # # $Id: gen_invocation_N.pl,v 1.1 2005/10/27 18:54:01 ewald-arnold Exp $ use English; if ($#ARGV < 0) { print "Usage: perl gen_invocation_N <number of arguments>\n"; exit; } $totalNumArgs = $ARGV[0]; if ($totalNumArgs < 5) { $totalNumArgs = 5; } open OUT, ">InvocationN.h"; print OUT "/** \@file \@internal NOT INTENDED FOR PUBLIC INCLUSION \@brief Generated with gen_invocation_N.pl. \$I" . "d: InvocationN.h,v 1.7 2005/10/19 20:53:09 ewald-arnold Exp \$ ***************************************************************************/ /************************************************************************** begin : Thu Aug 24 2004 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_INVOCATION_N_H #define MOCKPP_INVOCATION_N_H //#include <mockpp/chaining/Invocation.h> namespace mockpp { "; for ($numArgs = 1; $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; } $parms = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $parms .= ", "; } $parms .= "const P$i &p$i"; } $percentParms = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $percentParms .= ", "; } $percentParms .= "%$i"; } $holderParms = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $holderParms .= ", "; } $holderParms .= "const ConstraintHolder<P$i> &p$i"; } $args = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $args .= ", "; } $args .= "p$i"; } $boundArgs = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $boundArgs .= ", "; } $boundArgs .= "args->a$i"; } $argsAsMembers = ""; for ($i = 1; $i <= $numArgs; ++$i) { $argsAsMembers .= "P$i p$i;"; } $copyParms = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $copyParms .= ", "; } $copyParms .= "P$i ia$i"; } $hArgs = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $hArgs .= ", "; } $hArgs .= "h$i"; } $initArgs = ""; if ($numArgs > 0) { $initArgs = ":"; } for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $initArgs .= ", "; } $initArgs .= "p$i(ip$i)"; } $argTypes = ""; for ($i = 1; $i <= $numArgs; ++$i) { $argTypes .= "typedef P$i p". ($i+1) . "_type; "; } print "Creating Invocation" . $numArgs ."\n"; print OUT " /** Hold invocations with " . $numArgs . " parameters * \@internal */ template <" . $templateParms . "> class Invocation" . $numArgs . " : public Invocation { public: enum { numParams = " . $numArgs . " }; typedef ConstraintSet" . $numArgs . "<" . $templateArgs . "> ConstraintSetType; "; for($p = 1; $p <= $numArgs; ++$p) { print OUT " typedef P" . $p . " T" . $p . "Type;"; } print OUT " /** Constructs the object * \@param name name of he object"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " * \@param in_param" . $p . " parameter " . $p ; } print OUT " */ Invocation" . $numArgs . "( const String &name"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " , const P" . $p . " &in_param" . $p; } print OUT ") : Invocation( name )"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " , param" . $p . "( in_param" . $p . " )"; } print OUT " { } #ifdef MOCKPP_USE_INVOCATION_EQUALS /** Check if the object equals another invocation * \@param other the other invocation * \@return true: objects are equal */ virtual bool equals( const Invocation" . $numArgs . "<" . $templateArgs . "> &other ) const { return invocationComparison(param1, other.param1)"; for($p = 2; $p <= $numArgs; ++$p) { print OUT " && invocationComparison(param" . $p . ", other.param" . $p . ")";} print OUT "; } /** Check if the object equals another invocation * \@param other the other invocation * \@return true: objects are equal */ bool equals( const InvocationBase &other ) const { MOCKPP_UNUSED(other); return false; } #endif // MOCKPP_USE_INVOCATION_EQUALS "; for($p = 1; $p <= $numArgs; ++$p) { print OUT " /** Returns an invocation parameter * \@return the invocation parameter " . $p . " */ const P" . $p . " & getParameter" . $p . "() const { return param" . $p . "; } "; } print OUT " /** Returns a description of the parameters * \@return the description */ virtual String describeParameters() const { String fmt = MOCKPP_PCHAR(\"" . $percentParms . "\"); fmt << param1"; for($p = 2; $p <= $numArgs; ++$p) { print OUT " << param" .$p; } print OUT "; return fmt; } private: "; for($p = 1; $p <= $numArgs; ++$p) { print OUT " const P" . $p . " & param" .$p . ";"; } print OUT " }; " } print OUT " } // ns mockpp #endif // MOCKPP_INVOCATION_N_H "; close OUT; Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/Makefile.am,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.am 25 Oct 2005 20:19:31 -0000 1.13 +++ Makefile.am 27 Oct 2005 18:54:01 -0000 1.14 @@ -14,10 +14,12 @@ ChainableMockMethod2.h \ ChainableMockMethod3.h \ ChainableMockMethod4.h \ - ChainableMockMethod5.h + ChainableMockMethod5.h \ + InvocationN.h EXTRA_DIST = \ - gen_chainablemethod_N.pl + gen_chainablemethod_N.pl \ + gen_invocation_N.pl libchainingincludedir = $(includedir)/mockpp/chaining Index: Invocation.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/Invocation.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Invocation.h 17 Oct 2005 19:11:47 -0000 1.17 +++ Invocation.h 27 Oct 2005 18:54:01 -0000 1.18 @@ -156,518 +156,10 @@ }; -///////////////////////////////////////////////////////////////////// - - -/** Hold invocations with 1 parameters - * @internal - */ -template <typename T1> -class Invocation1 : public Invocation -{ - public: - - enum { numParams = 1 }; - - typedef ConstraintSet1<T1> ConstraintSetType; - typedef T1 T1Type; - - /** Constructs the object - * @param name name of he object - * @param in_param1 parameter 1 - */ - Invocation1( const String &name, - const T1 &in_param1 ) - : Invocation( name) - , param1( in_param1 ) - { - } - -#ifdef MOCKPP_USE_INVOCATION_EQUALS - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - bool equals( const Invocation1<T1> &other ) const - { - return invocationComparison(param1, other.param1); - } - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - bool equals( const InvocationBase &other ) const - { - MOCKPP_UNUSED(other); - return false; - } - -#endif // MOCKPP_USE_INVOCATION_EQUALS - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T1 & getParameter1() const - { - return param1; - } - - /** Returns a description of the parameters - * @return the description - */ - virtual String describeParameters() const - { - String fmt = MOCKPP_PCHAR("%1"); - fmt << param1; - return fmt; - } - - private: - - const T1 & param1; -}; - - -///////////////////////////////////////////////////////////////////// - - -/** Hold invocations with 2 parameters - * @internal - */ -template <typename T1, typename T2> -class Invocation2 : public Invocation -{ - public: - - enum { numParams = 2 }; - - typedef ConstraintSet2<T1, T2> ConstraintSetType; - typedef T1 T1Type; - typedef T2 T2Type; - - /** Constructs the object - * @param name name of he object - * @param in_param1 parameter 1 - * @param in_param2 parameter 2 - */ - Invocation2( const String &name, - const T1 &in_param1, - const T2 &in_param2 ) - : Invocation( name ) - , param1( in_param1 ) - , param2( in_param2 ) - { - } - -#ifdef MOCKPP_USE_INVOCATION_EQUALS - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - virtual bool equals( const Invocation2<T1, T2> &other ) const - { - return invocationComparison(param1, other.param1) - && invocationComparison(param2, other.param2); - } - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - bool equals( const InvocationBase &other ) const - { - MOCKPP_UNUSED(other); - return false; - } - -#endif // MOCKPP_USE_INVOCATION_EQUALS - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T1 & getParameter1() const - { - return param1; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T2 & getParameter2() const - { - return param2; - } - - /** Returns a description of the parameters - * @return the description - */ - virtual String describeParameters() const - { - String fmt = MOCKPP_PCHAR("%1, %2"); - fmt << param1 << param2; - return fmt; - } - - private: - - const T1 & param1; - const T2 & param2; -}; - - -///////////////////////////////////////////////////////////////////// - - -/** Hold invocations with 3 parameters - * @internal - */ -template <typename T1, typename T2, typename T3> -class Invocation3 : public Invocation -{ - public: - - enum { numParams = 3 }; - - typedef ConstraintSet3<T1, T2, T3> ConstraintSetType; - typedef T1 T1Type; - typedef T2 T2Type; - typedef T3 T3Type; - - /** Constructs the object - * @param name name of he object - * @param in_param1 parameter 1 - * @param in_param2 parameter 2 - * @param in_param3 parameter 3 - */ - Invocation3( const String &name, - const T1 &in_param1, - const T2 &in_param2, - const T3 &in_param3) - : Invocation( name ) - , param1( in_param1 ) - , param2( in_param2 ) - , param3( in_param3 ) - { - } - -#ifdef MOCKPP_USE_INVOCATION_EQUALS - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - virtual bool equals( const Invocation3<T1, T2, T3> &other ) const - { - return invocationComparison(param1, other.param1) - && invocationComparison(param2, other.param2) - && invocationComparison(param3, other.param3); - } - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - bool equals( const InvocationBase &other ) const - { - MOCKPP_UNUSED(other); - return false; - } - -#endif // MOCKPP_USE_INVOCATION_EQUALS - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T1 & getParameter1() const - { - return param1; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T2 & getParameter2() const - { - return param2; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T3 & getParameter3() const - { - return param3; - } - - /** Returns a description of the parameters - * @return the description - */ - virtual String describeParameters() const - { - String fmt = MOCKPP_PCHAR("%1, %2, %3"); - fmt << param1 << param2 << param3; - return fmt; - } - - private: - - const T1 & param1; - const T2 & param2; - const T3 & param3; -}; - - -///////////////////////////////////////////////////////////////////// - - -/** Hold invocations with 4 parameters - * @internal - */ -template <typename T1, typename T2, typename T3, typename T4> -class Invocation4 : public Invocation -{ - public: - - enum { numParams = 4 }; - - typedef ConstraintSet4<T1, T2, T3, T4> ConstraintSetType; - typedef T1 T1Type; - typedef T2 T2Type; - typedef T3 T3Type; - typedef T4 T4Type; - - /** Constructs the object - * @param name name of he object - * @param in_param1 parameter 1 - * @param in_param2 parameter 2 - * @param in_param3 parameter 3 - * @param in_param4 parameter 4 - */ - Invocation4( const String &name, - const T1 &in_param1, - const T2 &in_param2, - const T3 &in_param3, - const T4 &in_param4) - : Invocation( name ) - , param1( in_param1 ) - , param2( in_param2 ) - , param3( in_param3 ) - , param4( in_param4 ) - { - } - -#ifdef MOCKPP_USE_INVOCATION_EQUALS - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - virtual bool equals( const Invocation4<T1, T2, T3, T4> &other ) const - { - return invocationComparison(param1, other.param1) - && invocationComparison(param2, other.param2) - && invocationComparison(param3, other.param3) - && invocationComparison(param4, other.param4); - } - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - bool equals( const InvocationBase &other ) const - { - MOCKPP_UNUSED(other); - return false; - } - -#endif // MOCKPP_USE_INVOCATION_EQUALS - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T1 & getParameter1() const - { - return param1; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T2 & getParameter2() const - { - return param2; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T3 & getParameter3() const - { - return param3; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T4 & getParameter4() const - { - return param4; - } - - /** Returns a description of the parameters - * @return the description - */ - virtual String describeParameters() const - { - String fmt = MOCKPP_PCHAR("%1, %2, %3, %4"); - fmt << param1 << param2 << param3 << param4; - return fmt; - } - - private: - - const T1 & param1; - const T2 & param2; - const T3 & param3; - const T4 & param4; -}; - - -///////////////////////////////////////////////////////////////////// - - -/** Hold invocations with 5 parameters - * @internal - */ -template <typename T1, typename T2, typename T3, typename T4, typename T5> -class Invocation5 : public Invocation -{ - public: - - enum { numParams = 5 }; - - typedef ConstraintSet5<T1, T2, T3, T4, T5> ConstraintSetType; - typedef T1 T1Type; - typedef T2 T2Type; - typedef T3 T3Type; - typedef T4 T4Type; - typedef T5 T5Type; - - /** Constructs the object - * @param name name of he object - * @param in_param1 parameter 1 - * @param in_param2 parameter 2 - * @param in_param3 parameter 3 - * @param in_param4 parameter 4 - * @param in_param5 parameter 5 - */ - Invocation5( const String &name, - const T1 &in_param1, - const T2 &in_param2, - const T3 &in_param3, - const T4 &in_param4, - const T5 &in_param5) - : Invocation( name ) - , param1( in_param1 ) - , param2( in_param2 ) - , param3( in_param3 ) - , param4( in_param4 ) - , param5( in_param5 ) - { - } - -#ifdef MOCKPP_USE_INVOCATION_EQUALS - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - virtual bool equals( const Invocation5<T1, T2, T3, T4, T5> &other ) const - { - return invocationComparison(param1, other.param1) - && invocationComparison(param2, other.param2) - && invocationComparison(param3, other.param3) - && invocationComparison(param4, other.param4) - && invocationComparison(param5, other.param5); - } - - /** Check if the object equals another invocation - * @param other the other invocation - * @return true: objects are equal - */ - bool equals( const InvocationBase &other ) const - { - MOCKPP_UNUSED(other); - return false; - } - -#endif // MOCKPP_USE_INVOCATION_EQUALS - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T1 & getParameter1() const - { - return param1; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T2 & getParameter2() const - { - return param2; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T3 & getParameter3() const - { - return param3; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T4 & getParameter4() const - { - return param4; - } - - /** Returns an invocation parameter - * @return the invocation parameter - */ - const T5 & getParameter5() const - { - return param5; - } - - /** Returns a description of the parameters - * @return the description - */ - virtual String describeParameters() const - { - String fmt = MOCKPP_PCHAR("%1, %2, %3, %4, %5"); - fmt << param1 << param2 << param3 << param4 << param5; - return fmt; - } - - private: - - const T1 & param1; - const T2 & param2; - const T3 & param3; - const T4 & param4; - const T5 & param5; -}; - - } // namespace mockpp #endif // MOCKPP_INVOKATION_H +#include "InvocationN.h" + --- NEW FILE: InvocationN.h --- /** @file @internal NOT INTENDED FOR PUBLIC INCLUSION @brief Generated with gen_invocation_N.pl. $Id: InvocationN.h,v 1.1 2005/10/27 18:54:01 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Thu Aug 24 2004 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_INVOCATION_N_H #define MOCKPP_INVOCATION_N_H //#include <mockpp/chaining/Invocation.h> namespace mockpp { /** Hold invocations with 1 parameters * @internal */ template <typename P1> class Invocation1 : public Invocation { public: enum { numParams = 1 }; typedef ConstraintSet1<P1> ConstraintSetType; typedef P1 T1Type; /** Constructs the object * @param name name of he object * @param in_param1 parameter 1 */ Invocation1( const String &name , const P1 &in_param1) : Invocation( name ) , param1( in_param1 ) { } #ifdef MOCKPP_USE_INVOCATION_EQUALS /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ virtual bool equals( const Invocation1<P1> &other ) const { return invocationComparison(param1, other.param1); } /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ bool equals( const InvocationBase &other ) const { MOCKPP_UNUSED(other); return false; } #endif // MOCKPP_USE_INVOCATION_EQUALS /** Returns an invocation parameter * @return the invocation parameter 1 */ const P1 & getParameter1() const { return param1; } /** Returns a description of the parameters * @return the description */ virtual String describeParameters() const { String fmt = MOCKPP_PCHAR("%1"); fmt << param1; return fmt; } private: const P1 & param1; }; /** Hold invocations with 2 parameters * @internal */ template <typename P1, typename P2> class Invocation2 : public Invocation { public: enum { numParams = 2 }; typedef ConstraintSet2<P1, P2> ConstraintSetType; typedef P1 T1Type; typedef P2 T2Type; /** Constructs the object * @param name name of he object * @param in_param1 parameter 1 * @param in_param2 parameter 2 */ Invocation2( const String &name , const P1 &in_param1 , const P2 &in_param2) : Invocation( name ) , param1( in_param1 ) , param2( in_param2 ) { } #ifdef MOCKPP_USE_INVOCATION_EQUALS /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ virtual bool equals( const Invocation2<P1, P2> &other ) const { return invocationComparison(param1, other.param1) && invocationComparison(param2, other.param2); } /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ bool equals( const InvocationBase &other ) const { MOCKPP_UNUSED(other); return false; } #endif // MOCKPP_USE_INVOCATION_EQUALS /** Returns an invocation parameter * @return the invocation parameter 1 */ const P1 & getParameter1() const { return param1; } /** Returns an invocation parameter * @return the invocation parameter 2 */ const P2 & getParameter2() const { return param2; } /** Returns a description of the parameters * @return the description */ virtual String describeParameters() const { String fmt = MOCKPP_PCHAR("%1, %2"); fmt << param1 << param2; return fmt; } private: const P1 & param1; const P2 & param2; }; /** Hold invocations with 3 parameters * @internal */ template <typename P1, typename P2, typename P3> class Invocation3 : public Invocation { public: enum { numParams = 3 }; typedef ConstraintSet3<P1, P2, P3> ConstraintSetType; typedef P1 T1Type; typedef P2 T2Type; typedef P3 T3Type; /** Constructs the object * @param name name of he object * @param in_param1 parameter 1 * @param in_param2 parameter 2 * @param in_param3 parameter 3 */ Invocation3( const String &name , const P1 &in_param1 , const P2 &in_param2 , const P3 &in_param3) : Invocation( name ) , param1( in_param1 ) , param2( in_param2 ) , param3( in_param3 ) { } #ifdef MOCKPP_USE_INVOCATION_EQUALS /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ virtual bool equals( const Invocation3<P1, P2, P3> &other ) const { return invocationComparison(param1, other.param1) && invocationComparison(param2, other.param2) && invocationComparison(param3, other.param3); } /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ bool equals( const InvocationBase &other ) const { MOCKPP_UNUSED(other); return false; } #endif // MOCKPP_USE_INVOCATION_EQUALS /** Returns an invocation parameter * @return the invocation parameter 1 */ const P1 & getParameter1() const { return param1; } /** Returns an invocation parameter * @return the invocation parameter 2 */ const P2 & getParameter2() const { return param2; } /** Returns an invocation parameter * @return the invocation parameter 3 */ const P3 & getParameter3() const { return param3; } /** Returns a description of the parameters * @return the description */ virtual String describeParameters() const { String fmt = MOCKPP_PCHAR("%1, %2, %3"); fmt << param1 << param2 << param3; return fmt; } private: const P1 & param1; const P2 & param2; const P3 & param3; }; /** Hold invocations with 4 parameters * @internal */ template <typename P1, typename P2, typename P3, typename P4> class Invocation4 : public Invocation { public: enum { numParams = 4 }; typedef ConstraintSet4<P1, P2, P3, P4> ConstraintSetType; typedef P1 T1Type; typedef P2 T2Type; typedef P3 T3Type; typedef P4 T4Type; /** Constructs the object * @param name name of he object * @param in_param1 parameter 1 * @param in_param2 parameter 2 * @param in_param3 parameter 3 * @param in_param4 parameter 4 */ Invocation4( const String &name , const P1 &in_param1 , const P2 &in_param2 , const P3 &in_param3 , const P4 &in_param4) : Invocation( name ) , param1( in_param1 ) , param2( in_param2 ) , param3( in_param3 ) , param4( in_param4 ) { } #ifdef MOCKPP_USE_INVOCATION_EQUALS /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ virtual bool equals( const Invocation4<P1, P2, P3, P4> &other ) const { return invocationComparison(param1, other.param1) && invocationComparison(param2, other.param2) && invocationComparison(param3, other.param3) && invocationComparison(param4, other.param4); } /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ bool equals( const InvocationBase &other ) const { MOCKPP_UNUSED(other); return false; } #endif // MOCKPP_USE_INVOCATION_EQUALS /** Returns an invocation parameter * @return the invocation parameter 1 */ const P1 & getParameter1() const { return param1; } /** Returns an invocation parameter * @return the invocation parameter 2 */ const P2 & getParameter2() const { return param2; } /** Returns an invocation parameter * @return the invocation parameter 3 */ const P3 & getParameter3() const { return param3; } /** Returns an invocation parameter * @return the invocation parameter 4 */ const P4 & getParameter4() const { return param4; } /** Returns a description of the parameters * @return the description */ virtual String describeParameters() const { String fmt = MOCKPP_PCHAR("%1, %2, %3, %4"); fmt << param1 << param2 << param3 << param4; return fmt; } private: const P1 & param1; const P2 & param2; const P3 & param3; const P4 & param4; }; /** Hold invocations with 5 parameters * @internal */ template <typename P1, typename P2, typename P3, typename P4, typename P5> class Invocation5 : public Invocation { public: enum { numParams = 5 }; typedef ConstraintSet5<P1, P2, P3, P4, P5> ConstraintSetType; typedef P1 T1Type; typedef P2 T2Type; typedef P3 T3Type; typedef P4 T4Type; typedef P5 T5Type; /** Constructs the object * @param name name of he object * @param in_param1 parameter 1 * @param in_param2 parameter 2 * @param in_param3 parameter 3 * @param in_param4 parameter 4 * @param in_param5 parameter 5 */ Invocation5( const String &name , const P1 &in_param1 , const P2 &in_param2 , const P3 &in_param3 , const P4 &in_param4 , const P5 &in_param5) : Invocation( name ) , param1( in_param1 ) , param2( in_param2 ) , param3( in_param3 ) , param4( in_param4 ) , param5( in_param5 ) { } #ifdef MOCKPP_USE_INVOCATION_EQUALS /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ virtual bool equals( const Invocation5<P1, P2, P3, P4, P5> &other ) const { return invocationComparison(param1, other.param1) && invocationComparison(param2, other.param2) && invocationComparison(param3, other.param3) && invocationComparison(param4, other.param4) && invocationComparison(param5, other.param5); } /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal */ bool equals( const InvocationBase &other ) const { MOCKPP_UNUSED(other); return false; } #endif // MOCKPP_USE_INVOCATION_EQUALS /** Returns an invocation parameter * @return the invocation parameter 1 */ const P1 & getParameter1() const { return param1; } /** Returns an invocation parameter * @return the invocation parameter 2 */ const P2 & getParameter2() const { return param2; } /** Returns an invocation parameter * @return the invocation parameter 3 */ const P3 & getParameter3() const { return param3; } /** Returns an invocation parameter * @return the invocation parameter 4 */ const P4 & getParameter4() const { return param4; } /** Returns an invocation parameter * @return the invocation parameter 5 */ const P5 & getParameter5() const { return param5; } /** Returns a description of the parameters * @return the description */ virtual String describeParameters() const { String fmt = MOCKPP_PCHAR("%1, %2, %3, %4, %5"); fmt << param1 << param2 << param3 << param4 << param5; return fmt; } private: const P1 & param1; const P2 & param2; const P3 & param3; const P4 & param4; const P5 & param5; }; } // ns mockpp #endif // MOCKPP_INVOCATION_N_H |