[Mockpp-commits] mockpp/mockpp/stub CustomStub.h,1.17,1.18 StubHolder.h,1.10,1.11 ThrowStub.h,1.30,1
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-04-03 18:33:21
|
Update of /cvsroot/mockpp/mockpp/mockpp/stub In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9425/mockpp/stub Modified Files: CustomStub.h StubHolder.h ThrowStub.h TypelessStub.h Log Message: more efforts to make msvc6 compile Index: StubHolder.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/StubHolder.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- StubHolder.h 2 Apr 2005 20:45:31 -0000 1.10 +++ StubHolder.h 3 Apr 2005 18:32:53 -0000 1.11 @@ -73,13 +73,17 @@ : stub(in_stub) {} - /** Creates the object. +#ifndef _MSC_VER + + /** Creates the object. * @param in_stub pointer to the stub */ StubHolder(const AutoPointer<Stub<R, I> > &in_stub) : stub(in_stub) {} +#endif + /** Returns the stub object. * @attention After this method is called this object becomes invalid. * @return the stub object Index: CustomStub.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/CustomStub.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- CustomStub.h 6 Jan 2005 13:09:23 -0000 1.17 +++ CustomStub.h 3 Apr 2005 18:32:53 -0000 1.18 @@ -64,12 +64,24 @@ */ virtual String describeTo( String &buffer ) const { - buffer += description; - return buffer; + return internalDescribeTo(buffer); } - private: - + protected: + + /** Appends the description of this object to the buffer. + * Needed for compilers that can't invoke \c CustumStub<>::describeTo() directly. + * @param buffer The buffer that the description is appended to. + * @return The current content of the buffer data + */ + String internalDescribeTo( String &buffer ) const // msvc6 hack + { + buffer += description; + return buffer; + } + + private: + const String description; }; Index: TypelessStub.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/TypelessStub.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- TypelessStub.h 2 Apr 2005 20:45:32 -0000 1.15 +++ TypelessStub.h 3 Apr 2005 18:32:53 -0000 1.16 @@ -176,31 +176,49 @@ }; +#define MOCKPP_TYPELESSSTUBADAPTER_PTI_IMPL(I) +#define MOCKPP_TYPELESSSTUBADAPTER_PTI_DECL(I) + + #else // MOCKPP_PTI_WEAKNESS Partial Template Instantiation Weakness + /** Declare specialized methods for mockpp::InvocationMocker. * Neccessary for compilers with weak template capabilities. */ #define MOCKPP_TYPELESSSTUBADAPTER_PTI_DECL(I) \ +namespace mockpp { \ template<> \ -void mockpp::TypelessStubAdapter<void, I >::invoke( const I &); +void mockpp::TypelessStubAdapter<void, I >; \ +} /** Implement specialized methods for mockpp::InvocationMocker. * Neccessary for compilers with weak template capabilities. */ #define MOCKPP_TYPELESSSTUBADAPTER_PTI_IMPL(I) \ +namespace mockpp { \ template<> \ -void mockpp::TypelessStubAdapter<void, I >::invoke( const I &invocation) \ -{ \ - this->stubber->typelessInvoke(); \ -} - +class TypelessStubAdapter<void, I > : public TypelessStubAdapterBase<void, I > \ +{ \ + public: \ + TypelessStubAdapter<void, I >(TypelessStub<void>::AP tm, bool in_delete) \ + : TypelessStubAdapterBase<void, I >(tm, in_delete) \ + {} \ + \ + void invoke( const I &invocation) \ + { \ + MOCKPP_UNUSED(invocation); \ + this->stubber->typelessInvoke(); \ + } \ +}; \ +} + #endif // MOCKPP_PTI_WEAKNESS - -} // namespace mockpp + +} // namespace mockpp #endif // MOCKPP_TypelessStub_H Index: ThrowStub.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/ThrowStub.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- ThrowStub.h 2 Apr 2005 20:45:32 -0000 1.30 +++ ThrowStub.h 3 Apr 2005 18:32:53 -0000 1.31 @@ -117,9 +117,7 @@ }; -#ifndef MOCKPP_PTI_WEAKNESS // Partial Template Instantiation Weakness - - + /** A stub throwing exceptions. */ template<> @@ -152,30 +150,6 @@ }; -#else // MOCKPP_PTI_WEAKNESS Partial Template Instantiation Weakness - - -/** Declare specialized methods for mockpp::InvocationMocker. - * Neccessary for compiler with weak template capabilities. - */ -#define MOCKPP_THROWSTUB_PTI_DECL \ -template<> \ -void mockpp::ThrowStub<void>::typelessInvoke(); \ - - -/** Implement specialized methods for mockpp::InvocationMocker. - * Neccessary for compiler with weak template capabilities. - */ -#define MOCKPP_THROWSTUB_PTI_IMPL \ -template<> \ -void mockpp::ThrowStub<void>::typelessInvoke() \ -{ \ - this->throwable.get()->throw_me(); \ -} - - -#endif // MOCKPP_PTI_WEAKNESS - } // namespace mockpp |