00001 00009 /************************************************************************** 00010 00011 begin : Thu Aug 24 2004 00012 copyright : (C) 2002-2010 by Ewald Arnold 00013 email : mockpp at ewald-arnold dot de 00014 00015 This program is free software; you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as 00017 published by the Free Software Foundation; either version 2 of the License, 00018 or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 00029 * 00030 * Original Java Sources: Copyright (c) 2000-2004, jMock.org 00031 * 00032 00033 **/ 00034 00035 #ifndef MOCKPP_INVOKATION_H 00036 #define MOCKPP_INVOKATION_H 00037 00038 #include <mockpp/mockpp.h> // always first 00039 00040 #include <mockpp/SelfDescribing.h> 00041 00042 #include <mockpp/constraint/ConstraintSet.h> 00043 00044 #include <mockpp/compat/Formatter.h> 00045 00046 00047 MOCKPP_NS_START 00048 00049 00050 #ifdef MOCKPP_USE_INVOCATION_EQUALS 00051 00060 template <class T> 00061 bool invocationComparison(const T &left, const T &right) 00062 { 00063 return left == right; 00064 } 00065 00066 #endif // MOCKPP_USE_INVOCATION_EQUALS 00067 00068 00072 class MOCKPP_API_DECL0 InvocationBase : public SelfDescribing 00073 { 00074 public: 00075 00078 virtual ~InvocationBase(); 00079 }; 00080 00081 00086 class MOCKPP_API_DECL0 Invocation : public InvocationBase 00087 { 00088 public: 00089 00093 Invocation( const String &in_name); 00094 00099 virtual String describeTo( String &buffer ) const; 00100 00104 String getMethodName() const; 00105 00109 virtual String describeParameters() const = 0; 00110 00111 private: 00112 00113 String name; 00114 }; 00115 00116 00118 00119 00123 class MOCKPP_API_DECL0 Invocation0 : public Invocation 00124 { 00125 public: 00126 00127 enum { numParams = 0 }; 00128 00129 typedef ConstraintSet0 ConstraintSetType; 00130 00134 Invocation0(const String &name); 00135 00136 #ifdef MOCKPP_USE_INVOCATION_EQUALS 00137 00142 bool equals( const Invocation0 &other ) const; 00143 00148 bool equals( const InvocationBase &other ) const; 00149 00150 #endif // MOCKPP_USE_INVOCATION_EQUALS 00151 00155 virtual String describeParameters() const; 00156 }; 00157 00158 00159 MOCKPP_NS_END 00160 00161 00162 #endif // MOCKPP_INVOKATION_H 00163 00164 #include "InvocationN.h" 00165