[Mockpp-commits] mockpp/mockpp ReturnObjectList.h,1.26,1.27
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-07-23 13:32:11
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28014/mockpp Modified Files: ReturnObjectList.h Log Message: OutBound new Index: ReturnObjectList.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ReturnObjectList.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ReturnObjectList.h 7 May 2005 12:45:10 -0000 1.26 +++ ReturnObjectList.h 23 Jul 2005 13:31:57 -0000 1.27 @@ -50,7 +50,7 @@ * list is check to make sure that all the object in it are used and that none * are left over at the end of a test.</p> * - * For evehasMoreObjectsr sucessive call to nextReturnObject the next object in the list will + * For every sucessive call to nextReturnObject the next object in the list will * returned. * * If the nextReturnObject method is called and there are no objects in the list @@ -159,6 +159,37 @@ } + /** Transform the object's state to a human readable string. + * The string only contains the remaining objects. + * @return string representation + */ + virtual String toString() const + { + if (myObjects.size() == 0 && !haveDefault) + return MOCKPP_PCHAR("[]"); + + String ret; + ret += MOCKPP_PCHAR("\n[\n"); + + for(unsigned i = 0; i < myObjects.size(); ++i) + { + String fmt = MOCKPP_PCHAR(" - %1\n"); + fmt << myObjects[i]; + ret += fmt; + } + + if (haveDefault) + { + String fmt = MOCKPP_PCHAR(" * %1\n"); + fmt << defaultObject; + ret += fmt; + } + + ret += MOCKPP_PCHAR("]\n"); + return ret; + } + + /** Returns true if there are more objects to be returned. */ bool hasMoreObjects() const |