mockpp::ReturnObjectList< T > Class Template Reference
[Basic Mock Objects]

This class allows a list of objects to be setup which can be used whilst.The 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. More...

Inheritance diagram for mockpp::ReturnObjectList< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ReturnObjectList (const String &name, VerifiableList *parent)
 Construct a new empty list.
ReturnObjectListaddObjectToReturn (const T &anObjectToReturn)
 Add a next object to the end of the list.
ReturnObjectListaddObjectToReturn (const T &anObjectToReturn, unsigned count)
 Adds a series of equal next objects to the end of the list.
template<class I >
ReturnObjectListaddObjectToReturn (I items, I end)
 Add a sequence of next objects to the end of the list.
void setDefaultReturnValue (const T &defaultObj)
 Sets a default object which is returned when the list is empty.
nextReturnObject ()
 Returns the next object from the list.
void reset ()
 Removes all the objects from the list.
String toString () const
 Transform the object's state to a human readable string.
bool hasMoreObjects () const
 Returns true if there are more objects to be returned.
virtual void verify ()
 Verify that there are no objects left within the list.

Detailed Description

template<class T>
class mockpp::ReturnObjectList< T >

This class allows a list of objects to be setup which can be used whilst.The 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.

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 an assertion error will be thrown. If the verify method is called and there are objects still in the list an assertion error will also be thrown.

Definition at line 62 of file ReturnObjectList.h.


Constructor & Destructor Documentation

template<class T>
mockpp::ReturnObjectList< T >::ReturnObjectList ( const String name,
VerifiableList parent 
) [inline]

Construct a new empty list.

Parameters:
name Label used to identify list
parent parent verifiable

Definition at line 70 of file ReturnObjectList.h.


Member Function Documentation

template<class T>
template<class I >
ReturnObjectList& mockpp::ReturnObjectList< T >::addObjectToReturn ( items,
end 
) [inline]

Add a sequence of next objects to the end of the list.

Parameters:
items start iterator
end terminating iterator (note: one element "behind" as always with STL)
Returns:
reference to itself for chaining

Definition at line 107 of file ReturnObjectList.h.

template<class T>
ReturnObjectList& mockpp::ReturnObjectList< T >::addObjectToReturn ( const T &  anObjectToReturn,
unsigned  count 
) [inline]

Adds a series of equal next objects to the end of the list.

Parameters:
anObjectToReturn object to be added to the list
count the count the object is added
Returns:
reference to itself for chaining

Definition at line 93 of file ReturnObjectList.h.

template<class T>
ReturnObjectList& mockpp::ReturnObjectList< T >::addObjectToReturn ( const T &  anObjectToReturn  )  [inline]

Add a next object to the end of the list.

Parameters:
anObjectToReturn object to be added to the list
Returns:
reference to itself for chaining

Definition at line 81 of file ReturnObjectList.h.

template<class T>
bool mockpp::ReturnObjectList< T >::hasMoreObjects (  )  const [inline]

Returns true if there are more objects to be returned.

Returns:
true: there are more objects available

Definition at line 188 of file ReturnObjectList.h.

template<class T>
T mockpp::ReturnObjectList< T >::nextReturnObject (  )  [inline]

Returns the next object from the list.

Each object it returned in the order in which they where added.

Definition at line 129 of file ReturnObjectList.h.

template<class T>
void mockpp::ReturnObjectList< T >::setDefaultReturnValue ( const T &  defaultObj  )  [inline]

Sets a default object which is returned when the list is empty.

Using the default object does not affect the behaviour of verify().

Parameters:
defaultObj default object to return

Definition at line 119 of file ReturnObjectList.h.

template<class T>
String mockpp::ReturnObjectList< T >::toString (  )  const [inline]

Transform the object's state to a human readable string.

The string only contains the remaining objects.

Returns:
string representation

Definition at line 158 of file ReturnObjectList.h.

template<class T>
virtual void mockpp::ReturnObjectList< T >::verify (  )  [inline, virtual]

Verify that there are no objects left within the list.

If it fails, an AssertionFailedError is thrown

Implements mockpp::Verifiable.

Definition at line 197 of file ReturnObjectList.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines

Generated on Tue Jan 5 09:49:00 2010 for mockpp by  doxygen 1.6.1