sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: #include "second_excp.h" sl@0: sl@0: EXPORT_C int thrower2 (int x) { sl@0: #ifdef __SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) throw MySecondException(x); sl@0: #else //!__SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) sl@0: return x; sl@0: else sl@0: #endif //__SUPPORT_CPP_EXCEPTIONS__ sl@0: return -1; sl@0: } sl@0: sl@0: EXPORT_C int thrower3 (int x) { sl@0: #ifdef __SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) throw MyThirdException(x); sl@0: #else //!__SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) sl@0: return x; sl@0: else sl@0: #endif //__SUPPORT_CPP_EXCEPTIONS__ sl@0: return -1; sl@0: } sl@0: sl@0: #pragma warning( disable : 4673 ) /* throwing 'class MyFourthException' the following types will not be considered at the catch site */ sl@0: sl@0: EXPORT_C int thrower4 (int x) { sl@0: #ifdef __SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) throw MyFourthException(x); sl@0: #else //!__SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) sl@0: return x; sl@0: else sl@0: #endif //__SUPPORT_CPP_EXCEPTIONS__ sl@0: return -1; sl@0: } sl@0: sl@0: EXPORT_C int thrower5 (int x) { sl@0: #ifdef __SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) throw MyFifthException(x); sl@0: #else //!__SUPPORT_CPP_EXCEPTIONS__ sl@0: if (x != 0) sl@0: return x; sl@0: else sl@0: #endif //__SUPPORT_CPP_EXCEPTIONS__ sl@0: return -1; sl@0: } sl@0: sl@0: sl@0: EXPORT_C UncaughtTester::UncaughtTester(TInt & x) : aInt(x){} sl@0: sl@0: EXPORT_C UncaughtTester::~UncaughtTester(){ sl@0: #ifdef __SUPPORT_CPP_EXCEPTIONS__ sl@0: if (std::uncaught_exception()) { sl@0: aInt = 2; sl@0: } else { sl@0: #endif //__SUPPORT_CPP_EXCEPTIONS__ sl@0: aInt = 1; sl@0: #ifdef __SUPPORT_CPP_EXCEPTIONS__ sl@0: } sl@0: #endif //__SUPPORT_CPP_EXCEPTIONS__ sl@0: } sl@0: