00001 00009 /************************************************************************** 00010 00011 begin : Sam Feb 8 2003 00012 copyright : (C) 2002-2010 by Ewald Arnold 00013 email : mockpp at ewald-arnold dot de 00014 00015 This program is free software; you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as 00017 published by the Free Software Foundation; either version 2 of the License, 00018 or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 00029 **/ 00030 00031 #define MOCKPP_NEED_EXPORTS 00032 #include <mockpp/mockpp.h> // always first 00033 00034 #include <mockpp/compat/Asserter.h> 00035 00036 #include <mockpp/Throwable.h> 00037 00038 #include <iosfwd> 00039 00040 00041 MOCKPP_NS_START 00042 00043 00044 MOCKPP_API_IMPL0 ThrowableItem::ThrowableItem(Throwable *it) 00045 : item(0) 00046 { 00047 take(it); 00048 } 00049 00050 00051 MOCKPP_API_IMPL0 ThrowableItem::ThrowableItem(const ThrowableItem &it) 00052 : item(const_cast<ThrowableItem&>(it).release()) 00053 { 00054 } 00055 00056 00057 MOCKPP_API_IMPL(ThrowableItem &) ThrowableItem::operator = (const ThrowableItem &it) 00058 { 00059 take(const_cast<ThrowableItem&>(it).release()); 00060 return *this; 00061 } 00062 00063 00064 MOCKPP_API_IMPL0 ThrowableItem::~ThrowableItem() throw() 00065 { 00066 take((Throwable*)0); 00067 } 00068 00069 00070 MOCKPP_API_IMPL(void) ThrowableItem::take(Throwable *it) 00071 { 00072 delete item; 00073 item = it; 00074 } 00075 00076 00077 MOCKPP_API_IMPL(Throwable *) ThrowableItem::release() 00078 { 00079 Throwable *tmp = item; 00080 item = 0; 00081 return tmp; 00082 } 00083 00084 00085 MOCKPP_API_IMPL(Throwable *) ThrowableItem::get() const 00086 { 00087 return item; 00088 } 00089 00090 00091 MOCKPP_API_IMPL(void) ThrowableItem::reset() 00092 { 00093 take((Throwable*)0); 00094 } 00095 00096 00097 MOCKPP_NS_END 00098