A throwable object. More...
Public Member Functions | |
ThrowableItem (Throwable *it=0) | |
Construct the item. | |
ThrowableItem (const ThrowableItem &it) | |
Construct the item from another. | |
ThrowableItem & | operator= (const ThrowableItem &it) |
Copy the item from another. | |
virtual | ~ThrowableItem () throw () |
Destruct the item. | |
void | take (Throwable *it) |
Set the throwable item. | |
template<class T > | |
void | take (const T &w) |
Set the throwable item. | |
Throwable * | release () |
Releases the internal pointer. | |
Throwable * | get () const |
Gets the throwable item. | |
void | reset () |
Sets the object into a clean and unused state. | |
bool | wasUsed () const |
Queries if the throwable object was taken via get(). |
A throwable object.
The object is completely managed which also includes the destruction of the object by the destructor of this container. The behaviour when copying is similar to std::auto_ptr<T>: the ownership changes.
Definition at line 136 of file Throwable.h.
mockpp::ThrowableItem::ThrowableItem | ( | Throwable * | it = 0 |
) |
Construct the item.
it | pointer to the throwable object |
Definition at line 44 of file Throwable.cpp.
mockpp::ThrowableItem::ThrowableItem | ( | const ThrowableItem & | it | ) |
Construct the item from another.
it | Another object. The internal pointers ownership is moved and the other object loses the object. |
Definition at line 51 of file Throwable.cpp.
Throwable * mockpp::ThrowableItem::get | ( | ) | const |
Gets the throwable item.
Definition at line 85 of file Throwable.cpp.
ThrowableItem & mockpp::ThrowableItem::operator= | ( | const ThrowableItem & | it | ) |
Copy the item from another.
it | Another object. The internal pointers ownership is moved and the other object loses the object. |
Definition at line 57 of file Throwable.cpp.
Throwable * mockpp::ThrowableItem::release | ( | ) |
Releases the internal pointer.
Definition at line 77 of file Throwable.cpp.
void mockpp::ThrowableItem::take | ( | const T & | w | ) | [inline] |
Set the throwable item.
w | the object to throw |
Definition at line 178 of file Throwable.h.
void mockpp::ThrowableItem::take | ( | Throwable * | it | ) |
Set the throwable item.
Attention: In case you pass "0" to clear the object, don't forget to cast it to "Throwable", otherwise the template method will be taken!
it | pointer to the throwable object |
Definition at line 70 of file Throwable.cpp.
bool mockpp::ThrowableItem::wasUsed | ( | ) | const |
Queries if the throwable object was taken via get().
There must also be an object set for this being true.