epoc32/include/stdapis/stlport/exception
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 exception
     1 /*
       
     2  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
       
     3  *
       
     4  * Copyright (c) 1996,1997
       
     5  * Silicon Graphics Computer Systems, Inc.
       
     6  *
       
     7  * Copyright (c) 1999 
       
     8  * Boris Fomitchev
       
     9  *
       
    10  * This material is provided "as is", with absolutely no warranty expressed
       
    11  * or implied. Any use is at your own risk.
       
    12  *
       
    13  * Permission to use or copy this software for any purpose is hereby granted 
       
    14  * without fee, provided the above notices are retained on all copies.
       
    15  * Permission to modify the code and to distribute modified code is granted,
       
    16  * provided the above notices are retained, and a notice that the code was
       
    17  * modified is included with the above copyright notice.
       
    18  *
       
    19  */
       
    20 
       
    21 // This header exists solely for portability.  Normally it just includes
       
    22 // the native header <exception>.
       
    23 
       
    24 // The header <exception> contains low-level functions that interact
       
    25 // with a compiler's exception-handling mechanism.  It is assumed to
       
    26 // be supplied with the compiler, rather than with the library, because
       
    27 // it is inherently tied very closely to the compiler itself.
       
    28 
       
    29 // On platforms where <exception> does not exist, this header defines
       
    30 // an exception base class.  This is *not* a substitute for everything
       
    31 // in <exception>, but it suffices to support a bare minimum of STL
       
    32 // functionality.
       
    33 
       
    34 
       
    35 # if !defined (_STLP_OUTERMOST_HEADER_ID)
       
    36 #  define _STLP_OUTERMOST_HEADER_ID 0x423
       
    37 #  include <stl/_prolog.h>
       
    38 # elif (_STLP_OUTERMOST_HEADER_ID == 0x423) && ! defined (_STLP_DONT_POP_0x423)
       
    39 #  define _STLP_DONT_POP_0x423
       
    40 # endif
       
    41 
       
    42 #ifndef _STLP_EXCEPTION
       
    43 #define _STLP_EXCEPTION
       
    44 
       
    45 # if   ! defined (_STLP_NO_EXCEPTION_HEADER)
       
    46 
       
    47 #  if defined ( _UNCAUGHT_EXCEPTION )
       
    48 #   undef _STLP_INCOMPLETE_EXCEPTION_HEADER
       
    49 #  endif
       
    50 
       
    51 # if defined(_STLP_BROKEN_EXCEPTION_CLASS)
       
    52 #  define exception     _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
       
    53 #  define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
       
    54 #  if defined (_STLP_NO_NEW_NEW_HEADER)
       
    55 #   include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
       
    56 #  else
       
    57 #   include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
       
    58 #  endif
       
    59 #  undef exception
       
    60 #  undef bad_exception
       
    61 # else
       
    62 
       
    63 #ifndef _STLP_NO_NEW_NEW_HEADER
       
    64 #define _STLP_NO_NEW_NEW_HEADER
       
    65 #endif
       
    66 
       
    67 # if defined (_STLP_NO_NEW_NEW_HEADER)
       
    68 #  include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
       
    69 # else
       
    70 #   include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
       
    71 # endif
       
    72 
       
    73 # endif
       
    74 
       
    75 #    if defined (_STLP_MSVC) || defined (__ICL)
       
    76 // dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
       
    77 // the header <yvals.h> which ships with vc6 and is included by its native <exception>
       
    78 // actually turns on warnings, so we have to turn them back off.
       
    79 #      include <config/_msvc_warnings_off.h>
       
    80 #    endif
       
    81 
       
    82 
       
    83 #  ifdef _STLP_USE_OWN_NAMESPACE
       
    84 
       
    85 _STLP_BEGIN_NAMESPACE
       
    86 
       
    87 #if !defined(_STLP_BROKEN_EXCEPTION_CLASS)
       
    88 using _STLP_VENDOR_EXCEPT_STD::exception;
       
    89 using _STLP_VENDOR_EXCEPT_STD::bad_exception;
       
    90 #endif
       
    91 
       
    92 # if ! defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
       
    93 
       
    94 // fbp : many platforms present strange mix of
       
    95 // those in various namespaces
       
    96 #  if !defined(_STLP_VENDOR_UNEXPECTED_STD)
       
    97 #   define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
       
    98 #  endif
       
    99 
       
   100 // weird errors
       
   101 # if (! defined (__BORLANDC__)) || (defined (__STD_EXCEPTION) && defined (__RWSTD_EXCEPTION_SEEN) && defined ( _STLP_DONT_POP_0x423))
       
   102 using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
       
   103 using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
       
   104 using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
       
   105 using _STLP_VENDOR_UNEXPECTED_STD::terminate;
       
   106 using _STLP_VENDOR_UNEXPECTED_STD::terminate_handler;
       
   107 using _STLP_VENDOR_UNEXPECTED_STD::set_terminate;
       
   108 # endif
       
   109 
       
   110 # if !defined (_STLP_INCOMPLETE_EXCEPTION_HEADER) 
       
   111 using _STLP_VENDOR_UNEXPECTED_STD::uncaught_exception;
       
   112 # endif
       
   113 
       
   114 #  endif
       
   115 
       
   116 _STLP_END_NAMESPACE
       
   117 
       
   118 #  endif /* _STLP_OWN_NAMESPACE */
       
   119 
       
   120 #else /* _STLP_NO_EXCEPTION_HEADER */
       
   121 
       
   122 // fbp : absence of <exception> usually means that those
       
   123 // functions are not going to be called by compiler.
       
   124 // Still, define them for the user.
       
   125 #ifdef __SYMBIAN32__
       
   126 _STLP_BEGIN_NAMESPACE
       
   127 #endif //__SYMBIAN32__
       
   128 typedef void (*unexpected_handler)();
       
   129 unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
       
   130 void unexpected();
       
   131 
       
   132 typedef void (*terminate_handler)();
       
   133 terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
       
   134 void terminate();
       
   135 
       
   136 bool uncaught_exception(); // not implemented under mpw as of Jan/1999
       
   137 
       
   138 #ifdef __SYMBIAN32__
       
   139 _STLP_END_NAMESPACE
       
   140 #endif //__SYMBIAN32__
       
   141 
       
   142 #endif  /* _STLP_NO_EXCEPTION_HEADER */	
       
   143 
       
   144 # if   defined (_STLP_NO_EXCEPTION_HEADER) || defined(_STLP_BROKEN_EXCEPTION_CLASS)
       
   145 # ifndef _STLP_EXCEPTION_H
       
   146 #  define _STLP_EXCEPTION_H
       
   147 
       
   148 _STLP_BEGIN_NAMESPACE
       
   149 
       
   150 // section 18.6.1
       
   151 #ifdef __SYMBIAN32__
       
   152 class exception
       
   153 #else
       
   154 class _STLP_CLASS_DECLSPEC exception 
       
   155 #endif
       
   156 	{
       
   157 	public:
       
   158 # ifdef _STLP_OWN_IOSTREAMS
       
   159         _STLP_DECLSPEC exception() _STLP_NOTHROW;
       
   160         _STLP_DECLSPEC virtual ~exception() _STLP_NOTHROW;
       
   161 	_STLP_DECLSPEC virtual const char* what() const _STLP_NOTHROW;
       
   162 # else
       
   163         exception() _STLP_NOTHROW {}
       
   164 		virtual ~exception() _STLP_NOTHROW {}
       
   165 		virtual const char* what() const _STLP_NOTHROW {return "class exception";}
       
   166 # endif
       
   167 	};
       
   168 	
       
   169 	
       
   170 
       
   171 // section 18.6.2.1
       
   172 #ifdef __SYMBIAN32__
       
   173 class bad_exception : public exception 
       
   174 #else
       
   175 class _STLP_CLASS_DECLSPEC bad_exception : public exception 
       
   176 #endif
       
   177 	{
       
   178 	public:
       
   179 # ifdef _STLP_OWN_IOSTREAMS
       
   180 	  _STLP_DECLSPEC bad_exception() _STLP_NOTHROW;
       
   181 	  _STLP_DECLSPEC ~bad_exception() _STLP_NOTHROW;
       
   182 	  _STLP_DECLSPEC const char* what() const _STLP_NOTHROW;
       
   183 # else
       
   184 	  bad_exception() _STLP_NOTHROW {}
       
   185 	  ~bad_exception() _STLP_NOTHROW {}
       
   186 	  const char* what() const _STLP_NOTHROW {return "class bad_exception";}
       
   187 # endif
       
   188 	};
       
   189 
       
   190 #ifdef __SYMBIAN32__
       
   191 // Give forward declaration, this should be supported by the stdard libraries from platform vendor.
       
   192 typedef void (*unexpected_handler)();
       
   193 _STLP_DECLSPEC unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
       
   194 _STLP_DECLSPEC void unexpected();
       
   195 
       
   196 typedef void (*terminate_handler)();
       
   197 _STLP_DECLSPEC terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
       
   198 _STLP_DECLSPEC void terminate();
       
   199 
       
   200 _STLP_DECLSPEC bool uncaught_exception(); // not implemented under mpw as of Jan/1999
       
   201 
       
   202 #endif
       
   203 _STLP_END_NAMESPACE
       
   204 
       
   205 #endif /* _STLP_NO_EXCEPTION_HEADER */
       
   206 
       
   207 _STLP_BEGIN_NAMESPACE
       
   208 // forward declaration
       
   209 class __Named_exception;
       
   210 _STLP_END_NAMESPACE
       
   211 #endif /* _STLP_EXCEPTION_H */
       
   212 
       
   213 #endif //_STLP_EXCEPTION
       
   214 
       
   215 # if (_STLP_OUTERMOST_HEADER_ID == 0x423)
       
   216 #  if ! defined (_STLP_DONT_POP_0x423)
       
   217 #   include <stl/_epilog.h>
       
   218 #   undef  _STLP_OUTERMOST_HEADER_ID
       
   219 #   endif
       
   220 #   undef  _STLP_DONT_POP_0x423
       
   221 # endif
       
   222 
       
   223 
       
   224 // Local Variables:
       
   225 // mode:C++
       
   226 // End:
       
   227 
       
   228 
       
   229