Thread: [Mockpp-commits] mockpp/mockpp VisitableMockMethod.cpp,1.2,1.3 VisitableMockMethod.h,1.8,1.9
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-25 19:06:22
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31562/mockpp Modified Files: VisitableMockMethod.cpp VisitableMockMethod.h Log Message: basic file set working Index: VisitableMockMethod.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod.cpp 17 Oct 2005 19:15:09 -0000 1.2 +++ VisitableMockMethod.cpp 25 Oct 2005 19:06:10 -0000 1.3 @@ -48,8 +48,15 @@ String MOCKPP_EXPORT VisitableMockMethodBase::getMethodName() const { -// static CppString method_name = getVerifiableName() + MOCKPP_PCHAR(".") + m_name; - return getVerifiableName(); + static String method_name = getVerifiableName(); // + MOCKPP_PCHAR(".") + m_name; + return method_name; +} + + +std::string MOCKPP_EXPORT VisitableMockMethodBase::getMethodIdentifier() const +{ + static std::string method_id = getLatin1(getMethodName()); + return method_id; } Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod.h 24 Oct 2005 19:08:44 -0000 1.8 +++ VisitableMockMethod.h 25 Oct 2005 19:06:10 -0000 1.9 @@ -51,10 +51,39 @@ String getMethodName() const; + std::string getMethodIdentifier() const; + VisitableMockObject *getVisitableMockObject() const; + protected: + + void throwAvailableException() const + { + bool do_throw = true; + if (throwablesInline) + { + if (throwableInsteadReturn.size() != 0) + { + do_throw = throwableInsteadReturn[0]; + throwableInsteadReturn.erase(throwableInsteadReturn.begin()); + } + } + + if (do_throw && throwables.hasMoreObjects() != 0) + { + Throwable *thr = throwables.nextThrowableObject(); + if (thr != 0) + thr->throw_me(); + } + + if (defaultThrowable.get() != 0) + defaultThrowable.get()->throw_me(); + } + //------------------------------------------------------------- + public: + template <class VMM> class ControllerFor : public VisitableMockObject::Controller { @@ -128,48 +157,22 @@ } } - protected: - - void throwAvailableException() - { - bool do_throw = true; - if (this->method->throwablesInline) - { - if (throwableInsteadReturn.size() != 0) - { - do_throw = this->method->throwableInsteadReturn[0]; - this->method->throwableInsteadReturn.erase(this->method->throwableInsteadReturn.begin()); - } - } - - if (do_throw && this->method->throwables.hasMoreObjects() != 0) - { - Throwable *thr = this->method->throwables.nextThrowableObject(); - if (thr != 0) - thr->throw_me(); - } - - if (this->method->defaultThrowable.get() != 0) - this->method->defaultThrowable.get()->throw_me(); - } - - - protected: + protected: - VMM *method; - VisitableMockObject *object; + VMM *method; + VisitableMockObject *object; }; template <class VMM> friend class ControllerFor; - private: + private: - VisitableMockObject *visitable; - ThrowableItem defaultThrowable; - mutable ThrowableList throwables; - bool throwablesInline; - mutable std::vector<bool> throwableInsteadReturn; + VisitableMockObject *visitable; + mutable ThrowableItem defaultThrowable; + mutable ThrowableList throwables; + mutable bool throwablesInline; + mutable std::vector<bool> throwableInsteadReturn; }; @@ -187,7 +190,7 @@ */ VisitableMockReturningMethodBase(const String &name, VisitableMockObject *parent) : VisitableMockMethodBase(name, parent) - , returnValues(getMethodName() + MOCKPP_PCHAR("/returnValues")) + , returnValues(getMethodName() + MOCKPP_PCHAR("/returnValues"), this) {} class ControllerFor : public VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase> @@ -203,14 +206,14 @@ void setDefaultReturnValue(const R &rv) { - MOCKPP_ASSERT_FALSE(this->method->isActivated()); + MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->haveDefaultReturnValue = true; this->method->defaultReturnValue = rv; } void addReturnValue(const R &rv, unsigned count = 1) { - MOCKPP_ASSERT_FALSE(this->method->isActivated()); + MOCKPP_ASSERT_FALSE(this->object->isActivated()); for ( ; count > 0; --count) { this->method->returnValues.addObjectToReturn(rv); |