[Mockpp-commits] mockpp/mockpp/chaining CountedChainableMethod.h,NONE,1.1 gen_countchainable_N.pl,NO
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-30 13:51:51
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27211/mockpp/chaining Added Files: CountedChainableMethod.h gen_countchainable_N.pl Log Message: basic file set working --- NEW FILE: CountedChainableMethod.h --- /** @file @internal NOT INTENDED FOR PUBLIC INCLUSION @brief Generated with gen_countparameters_N.pl. $Id: CountedChainableMethod.h,v 1.1 2005/10/30 13:51:43 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sun Oct 30 2005 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_COUNTEDCHAINABLEMETHOD_H #define MOCKPP_COUNTEDCHAINABLEMETHOD_H #include <mockpp/CountParameters.h> #include <mockpp/chaining/ChainableMockMethod0.h> #include <mockpp/chaining/ChainableMockMethod1.h> #include <mockpp/chaining/ChainableMockMethod2.h> #include <mockpp/chaining/ChainableMockMethod3.h> #include <mockpp/chaining/ChainableMockMethod4.h> #include <mockpp/chaining/ChainableMockMethod5.h> #include <mockpp/chaining/ChainableMockMethod6.h> namespace mockpp { template<unsigned params> class SwitchChainable { }; template<> class SwitchChainable<0> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod0<R> ChainableMockMethodType; }; }; template<> class SwitchChainable<1> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod1<R, P1> ChainableMockMethodType; }; }; template<> class SwitchChainable<2> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod2<R, P1, P2> ChainableMockMethodType; }; }; template<> class SwitchChainable<3> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod3<R, P1, P2, P3> ChainableMockMethodType; }; }; template<> class SwitchChainable<4> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod4<R, P1, P2, P3, P4> ChainableMockMethodType; }; }; template<> class SwitchChainable<5> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod5<R, P1, P2, P3, P4, P5> ChainableMockMethodType; }; }; template<> class SwitchChainable<6> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef ChainableMockMethod6<R, P1, P2, P3, P4, P5, P6> ChainableMockMethodType; }; }; template< typename R , typename P1 = NoParameter , typename P2 = NoParameter , typename P3 = NoParameter , typename P4 = NoParameter , typename P5 = NoParameter , typename P6 = NoParameter> class ChainableMockMethod : public SwitchChainable<CountParameters<R, P1, P2, P3, P4, P5, P6>::value > ::template Method<R, P1, P2, P3, P4, P5, P6> ::ChainableMockMethodType { public: 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> ::ChainableMockMethodType(name, parent) { } }; } // ns mockpp #endif // MOCKPP_COUNTEDCHAINABLEMETHOD_H --- NEW FILE: gen_countchainable_N.pl --- #!/usr/bin/perl -w # # $Id: gen_countchainable_N.pl,v 1.1 2005/10/30 13:51:43 ewald-arnold Exp $ use English; if ($#ARGV < 0) { print "Usage: perl gen_countchainable_N <number of arguments>\n"; exit; } $totalNumArgs = $ARGV[0]; if ($totalNumArgs < 5) { $totalNumArgs = 5; } open OUT, ">CountedChainableMethod.h"; print OUT "/** \@file \@internal NOT INTENDED FOR PUBLIC INCLUSION \@brief Generated with gen_countparameters_N.pl. \$I" . "d: CountedChainableMethod.h,v 1.7 2005/10/19 20:53:09 ewald-arnold Exp \$ ***************************************************************************/ /************************************************************************** begin : Sun Oct 30 2005 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_COUNTEDCHAINABLEMETHOD_H #define MOCKPP_COUNTEDCHAINABLEMETHOD_H #include <mockpp/CountParameters.h>"; for ($p = 0; $p <= $totalNumArgs; ++$p) { print OUT " #include <mockpp/chaining/ChainableMockMethod" . $p . ".h>";} print OUT " namespace mockpp { template<unsigned params> class SwitchChainable { }; "; 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; } print "Creating CountedChainableMethod" . $numArgs ."\n"; print OUT " template<> class SwitchChainable<" . $numArgs ."> { public: "; print OUT " template< typename R"; for($p = 1; $p <= $totalNumArgs; ++$p) { print OUT " , typename P" . $p; } print OUT "> class Method { public: typedef ChainableMockMethod" . $numArgs ."<R" . $templateArgs_colon . "> ChainableMockMethodType; }; }; "; } print OUT " template< typename R , typename P1 = NoParameter"; for($p = 2; $p <= $totalNumArgs; ++$p) { print OUT " , typename P" . $p . " = NoParameter"; }; print OUT "> class ChainableMockMethod : public SwitchChainable<CountParameters<R, " . $templateArgs . ">::value > ::template Method<R, " . $templateArgs . "> ::ChainableMockMethodType { public: ChainableMockMethod(const String &name, ChainableMockObject *parent ) : SwitchChainable<CountParameters<R, " . $templateArgs . ">::value > ::template Method<R, " . $templateArgs . "> ::ChainableMockMethodType(name, parent) { } }; } // ns mockpp #endif // MOCKPP_COUNTEDCHAINABLEMETHOD_H "; close OUT; |