Thread: [Mockpp-commits] mockpp/mockpp/chaining Invocation.cpp,1.4,1.5 Invocation.h,1.15,1.16
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-02 23:10:39
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31987/mockpp/chaining Modified Files: Invocation.cpp Invocation.h Log Message: removed superfluous InvocationX::equals Index: Invocation.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/Invocation.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Invocation.h 24 Jul 2005 16:11:14 -0000 1.15 +++ Invocation.h 1 Oct 2005 16:24:08 -0000 1.16 @@ -47,6 +47,25 @@ namespace mockpp { +#ifdef MOCKPP_USE_INVOCATION_EQUALS + +/** Default comparison function for the various \c Invocation classes. + * The default implementation compares the values of the two + * objects. + * @see mockpp::Invocation + * @param left left operand + * @param right right operand + * @return true if both values are equal + */ +template <class T> +bool invocationComparison(const T &left, const T &right) +{ + return left == right; +} + +#endif // MOCKPP_USE_INVOCATION_EQUALS + + /** Base class for objects holding invocations * @internal */ @@ -114,6 +133,8 @@ */ Invocation0( const String &name); +#ifdef MOCKPP_USE_INVOCATION_EQUALS + /** Check if the object equals another invocation * @param other the other invocation * @return true: objects are equal @@ -126,6 +147,8 @@ */ bool equals( const InvocationBase &other ) const; +#endif // MOCKPP_USE_INVOCATION_EQUALS + /** Returns a description of the parameters * @return the description */ @@ -160,13 +183,15 @@ { } +#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 param1 == other.param1; + return invocationComparison(param1, other.param1); } /** Check if the object equals another invocation @@ -179,6 +204,8 @@ return false; } +#endif // MOCKPP_USE_INVOCATION_EQUALS + /** Returns an invocation parameter * @return the invocation parameter */ @@ -234,14 +261,16 @@ { } +#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 param1 == other.param1 - && param2 == other.param2; + return invocationComparison(param1, other.param1) + && invocationComparison(param2, other.param2); } /** Check if the object equals another invocation @@ -254,6 +283,8 @@ return false; } +#endif // MOCKPP_USE_INVOCATION_EQUALS + /** Returns an invocation parameter * @return the invocation parameter */ @@ -322,15 +353,17 @@ { } +#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 param1 == other.param1 - && param2 == other.param2 - && param3 == other.param3; + return invocationComparison(param1, other.param1) + && invocationComparison(param2, other.param2) + && invocationComparison(param3, other.param3); } /** Check if the object equals another invocation @@ -343,6 +376,8 @@ return false; } +#endif // MOCKPP_USE_INVOCATION_EQUALS + /** Returns an invocation parameter * @return the invocation parameter */ @@ -424,16 +459,18 @@ { } +#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 param1 == other.param1 - && param2 == other.param2 - && param3 == other.param3 - && param4 == other.param4; + return invocationComparison(param1, other.param1) + && invocationComparison(param2, other.param2) + && invocationComparison(param3, other.param3) + && invocationComparison(param4, other.param4); } /** Check if the object equals another invocation @@ -446,6 +483,8 @@ return false; } +#endif // MOCKPP_USE_INVOCATION_EQUALS + /** Returns an invocation parameter * @return the invocation parameter */ @@ -540,17 +579,19 @@ { } +#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 param1 == other.param1 - && param2 == other.param2 - && param3 == other.param3 - && param4 == other.param4 - && param5 == other.param5; + 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 @@ -563,6 +604,8 @@ return false; } +#endif // MOCKPP_USE_INVOCATION_EQUALS + /** Returns an invocation parameter * @return the invocation parameter */ Index: Invocation.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/Invocation.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Invocation.cpp 4 Mar 2005 23:35:55 -0000 1.4 +++ Invocation.cpp 1 Oct 2005 16:24:08 -0000 1.5 @@ -27,6 +27,8 @@ **/ +#define MOCKPP_USE_INVOCATION_EQUALS + #include <mockpp/mockpp.h> // always first #include <mockpp/chaining/Invocation.h> @@ -72,6 +74,8 @@ } +#ifdef MOCKPP_USE_INVOCATION_EQUALS + bool MOCKPP_EXPORT Invocation0::equals( const Invocation0 &/*other*/ ) const { return true; @@ -83,6 +87,7 @@ return false; } +#endif // MOCKPP_USE_INVOCATION_EQUALS String MOCKPP_EXPORT Invocation0::describeParameters() const { |