[Mockpp-commits] mockpp/mockpp/constraint OutBound.h,NONE,1.1 Makefile.am,1.9,1.10
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-07-23 13:32:14
|
Update of /cvsroot/mockpp/mockpp/mockpp/constraint In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28014/mockpp/constraint Modified Files: Makefile.am Added Files: OutBound.h Log Message: OutBound new Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/constraint/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.am 4 Mar 2005 23:35:56 -0000 1.9 +++ Makefile.am 23 Jul 2005 13:31:57 -0000 1.10 @@ -5,7 +5,7 @@ libconstraintinclude_HEADERS = IsAnything.h IsCloseTo.h IsEqual.h \ IsGreaterThan.h IsInstanceOf.h IsLessThan.h IsNot.h IsNothing.h IsSame.h Or.h \ StringContains.h StringStartsWith.h StringEndsWith.h And.h IsGreaterOrEqual.h \ - IsLessOrEqual.h Constraint.h ConstraintSet.h \ + IsLessOrEqual.h Constraint.h ConstraintSet.h OutBound.h \ TypelessConstraint.h ConstraintHolder.h ConstraintList.h CLEANFILES = *.~* *.~~* *~ *.old --- NEW FILE: OutBound.h --- /** @file @brief Passes a value back via a reference (outbound value). $Id: OutBound.h,v 1.1 2005/07/23 13:31:57 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sat Jul 22 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef MOCKPP_OutBound_H #define MOCKPP_OutBound_H #include <mockpp/mockpp.h> // always first #include <mockpp/constraint/Constraint.h> #include <mockpp/compat/Formatter.h> #include <mockpp/ReturnObjectList.h> namespace mockpp { /** Passes a value back via a reference (outbound value). * @ingroup grp_constraint */ template <typename T> class OutBound : public Constraint<T> { public: /** Constructs the object * @param retArg the first value to return */ OutBound( const T &retArg ) : returnObjects(MOCKPP_PCHAR("OutBound/returnObjects"), 0) { returnObjects.addObjectToReturn(retArg); } /** Adds another return value. * @param retArg the next value to return */ void addOutboundObject( const T &retArg ) { returnObjects.addObjectToReturn(retArg); } /** Destroys the object */ virtual ~OutBound() {} /** Evaluates the constraint. * The value is not actually evaluated but a value is returned. * @param arg the object which is passed the value. * @return true: at least one return object is avaliable * @return false: no more return objects are avaliable */ virtual bool eval( const T &arg ) const { if (returnObjects.hasMoreObjects()) { T &back_ref = const_cast<T&>(arg); back_ref = returnObjects.nextReturnObject(); return true; } return false; } /** Appends the description of this object to the buffer. * @param buffer The buffer that the description is appended to. * @return The current content of the buffer data */ virtual String describeTo( String &buffer ) const { String fmt = MOCKPP_PCHAR("returns %1"); fmt << returnObjects.toString(); buffer += fmt; return buffer; } private: mutable ReturnObjectList<T> returnObjects; }; } // namespace mockpp #endif // MOCKPP_OutBound_H |