00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef MOCKPP_ChainableMockMethod6_H
00032 #define MOCKPP_ChainableMockMethod6_H
00033
00034 #include <mockpp/mockpp.h>
00035
00036 #include <mockpp/chaining/ChainableMockObject.h>
00037 #include <mockpp/chaining/ChainableMockMethod.h>
00038
00039
00040 MOCKPP_NS_START
00041
00042
00047 template <typename RT, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
00048 class ChainableMockMethod6Common
00049 : public ChainableMockMethodCommon
00050 , public ChainingMockBuilder <ArgumentsMatchBuilder6<RT, Invocation6<P1, P2, P3, P4, P5, P6> > >
00051 {
00052 public:
00053
00054 typedef Invocation6<P1, P2, P3, P4, P5, P6> InvocationType;
00055
00056 typedef CoreMock<RT, InvocationType> CoreMockType;
00057 typedef RT ReturnType;
00058
00059 typedef ChainingMockBuilder <ArgumentsMatchBuilder6<ReturnType, InvocationType> > Builder;
00060
00065 ChainableMockMethod6Common(const String &name, ChainableMockObject *parent )
00066 : ChainableMockMethodCommon(name, parent)
00067 , Builder(&coremock, this->getChainableMockObject(), this->getMethodName())
00068 , coremock(name + MOCKPP_PCHAR("/coreMock"), this)
00069 {
00070 }
00071
00072 virtual void reset()
00073 {
00074 MockObject::reset();
00075 }
00076
00077 virtual void verify()
00078 {
00079 MockObject::verify();
00080 }
00081
00082 protected:
00083
00087 CoreMockType & getCoreMock() const
00088 {
00089 return coremock;
00090 }
00091
00092 private:
00093
00094 mutable CoreMockType coremock;
00095 };
00096
00097
00101 template <typename RT, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
00102 class ChainableMockMethod6
00103 : public ChainableMockMethod6Common<RT, P1, P2, P3, P4, P5, P6>
00104 {
00105 public:
00106
00107 typedef typename ChainableMockMethod6Common<RT, P1, P2, P3, P4, P5, P6>::InvocationType InvocationType;
00108
00113 ChainableMockMethod6(const String &name, ChainableMockObject *parent )
00114 : ChainableMockMethod6Common<RT, P1, P2, P3, P4, P5, P6>(name, parent)
00115 {
00116 }
00117
00128 RT forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) const
00129 {
00130 InvocationType inv(this->getMethodName(), p1, p2, p3, p4, p5, p6);
00131 return this->getCoreMock().invoke(inv);
00132 }
00133 };
00134
00135
00140 template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
00141 class ChainableMockMethod6<void, P1, P2, P3, P4, P5, P6>
00142 : public ChainableMockMethod6Common<void, P1, P2, P3, P4, P5, P6>
00143 {
00144 public:
00145
00146 typedef typename ChainableMockMethod6Common<void, P1, P2, P3, P4, P5, P6>::InvocationType InvocationType;
00147
00152 ChainableMockMethod6(const String &name, ChainableMockObject *parent )
00153 : ChainableMockMethod6Common<void, P1, P2, P3, P4, P5, P6>(name, parent)
00154 {
00155 }
00156
00166 void forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) const
00167 {
00168 InvocationType inv(this->getMethodName(), p1, p2, p3, p4, p5, p6);
00169 this->getCoreMock().invoke(inv);
00170 }
00171 };
00172
00173
00174 MOCKPP_NS_END
00175
00176
00177 #endif // MOCKPP_ChainableMockMethod6_H
00178