Update of /cvsroot/mockpp/mockpp/mockpp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1731/mockpp
Modified Files:
ReturnObjectList.h
Log Message:
make methods chainable
Index: ReturnObjectList.h
===================================================================
RCS file: /cvsroot/mockpp/mockpp/mockpp/ReturnObjectList.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- ReturnObjectList.h 22 Mar 2005 18:43:34 -0000 1.24
+++ ReturnObjectList.h 28 Mar 2005 09:39:05 -0000 1.25
@@ -84,33 +84,39 @@
/** Add a next object to the end of the list.
* @param anObjectToReturn object to be added to the list
+ * @return reference to itself for chaining
*/
- void addObjectToReturn(const T &anObjectToReturn)
+ ReturnObjectList& addObjectToReturn(const T &anObjectToReturn)
{
myObjects.push_back(anObjectToReturn);
+ return *this;
}
/** Adds a series of equal next objects to the end of the list.
* @param anObjectToReturn object to be added to the list
* @param count the count the object is added
+ * @return reference to itself for chaining
*/
- void addObjectToReturn(const T &anObjectToReturn, unsigned count)
+ ReturnObjectList& addObjectToReturn(const T &anObjectToReturn, unsigned count)
{
for (unsigned i = 0; i < count; ++i)
addObjectToReturn(anObjectToReturn);
+ return *this;
}
/** Add a sequence of next objects to the end of the list.
* @param items start iterator
* @param end terminating iterator (note: one element "behind" as always with STL)
+ * @return reference to itself for chaining
*/
template <class I>
- void addObjectToReturn(I items, I end)
+ ReturnObjectList& addObjectToReturn(I items, I end)
{
for ( /* -- */; items != end; ++items)
addObjectToReturn(*items);
+ return *this;
}
|