| 0 |      1 | /*
 | 
|  |      2 | * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
|  |      3 | * All rights reserved.
 | 
|  |      4 | * This component and the accompanying materials are made available
 | 
|  |      5 | * under the terms of the License "Eclipse Public License v1.0"
 | 
|  |      6 | * which accompanies this distribution, and is available
 | 
|  |      7 | * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 | 
|  |      8 | *
 | 
|  |      9 | * Initial Contributors:
 | 
|  |     10 | * Nokia Corporation - initial contribution.
 | 
|  |     11 | *
 | 
|  |     12 | * Contributors:
 | 
|  |     13 | *
 | 
|  |     14 | * Description:
 | 
|  |     15 | *
 | 
|  |     16 | */
 | 
|  |     17 | #include "second_excp.h"
 | 
|  |     18 | 
 | 
|  |     19 | EXPORT_C int thrower2 (int x) {
 | 
|  |     20 | #ifdef __SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     21 |   if (x != 0) throw MySecondException(x);
 | 
|  |     22 | #else //!__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     23 |   if (x != 0)
 | 
|  |     24 | 	  return x;
 | 
|  |     25 |   else
 | 
|  |     26 | #endif //__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     27 |   return -1;
 | 
|  |     28 | }
 | 
|  |     29 | 
 | 
|  |     30 | EXPORT_C int thrower3 (int x) {
 | 
|  |     31 | #ifdef __SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     32 |   if (x != 0) throw MyThirdException(x);
 | 
|  |     33 | #else //!__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     34 |   if (x != 0)
 | 
|  |     35 | 	  return x;
 | 
|  |     36 |   else
 | 
|  |     37 | #endif //__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     38 |   return -1;
 | 
|  |     39 | }
 | 
|  |     40 | 
 | 
|  |     41 | #pragma warning( disable : 4673 )	/* throwing 'class MyFourthException' the following types will not be considered at the catch site */
 | 
|  |     42 | 
 | 
|  |     43 | EXPORT_C int thrower4 (int x) {
 | 
|  |     44 | #ifdef __SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     45 |   if (x != 0) throw MyFourthException(x);
 | 
|  |     46 | #else //!__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     47 |   if (x != 0)
 | 
|  |     48 | 	  return x;
 | 
|  |     49 |   else
 | 
|  |     50 | #endif //__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     51 |   return -1;
 | 
|  |     52 | }
 | 
|  |     53 | 
 | 
|  |     54 | EXPORT_C int thrower5 (int x) {
 | 
|  |     55 | #ifdef __SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     56 |   if (x != 0) throw MyFifthException(x);
 | 
|  |     57 | #else //!__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     58 |   if (x != 0)
 | 
|  |     59 | 	  return x;
 | 
|  |     60 |   else
 | 
|  |     61 | #endif //__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     62 |   return -1;
 | 
|  |     63 | }
 | 
|  |     64 | 
 | 
|  |     65 | 
 | 
|  |     66 | EXPORT_C UncaughtTester::UncaughtTester(TInt & x) : aInt(x){}
 | 
|  |     67 | 
 | 
|  |     68 | EXPORT_C UncaughtTester::~UncaughtTester(){
 | 
|  |     69 | #ifdef __SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     70 |   if (std::uncaught_exception()) {
 | 
|  |     71 |     aInt = 2;
 | 
|  |     72 |   } else {
 | 
|  |     73 | #endif //__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     74 |     aInt = 1;
 | 
|  |     75 | #ifdef __SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     76 |   }
 | 
|  |     77 | #endif //__SUPPORT_CPP_EXCEPTIONS__
 | 
|  |     78 | }
 | 
|  |     79 | 
 |