epoc32/include/tools/stlport/stl/_exception.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
 * Copyright (c) 1996,1997
williamr@4
     3
 * Silicon Graphics Computer Systems, Inc.
williamr@4
     4
 *
williamr@4
     5
 * Copyright (c) 1999
williamr@4
     6
 * Boris Fomitchev
williamr@4
     7
 *
williamr@4
     8
 * This material is provided "as is", with absolutely no warranty expressed
williamr@4
     9
 * or implied. Any use is at your own risk.
williamr@4
    10
 *
williamr@4
    11
 * Permission to use or copy this software for any purpose is hereby granted
williamr@4
    12
 * without fee, provided the above notices are retained on all copies.
williamr@4
    13
 * Permission to modify the code and to distribute modified code is granted,
williamr@4
    14
 * provided the above notices are retained, and a notice that the code was
williamr@4
    15
 * modified is included with the above copyright notice.
williamr@4
    16
 */
williamr@4
    17
williamr@4
    18
// The header <exception> contains low-level functions that interact
williamr@4
    19
// with a compiler's exception-handling mechanism.  It is assumed to
williamr@4
    20
// be supplied with the compiler, rather than with the library, because
williamr@4
    21
// it is inherently tied very closely to the compiler itself.
williamr@4
    22
williamr@4
    23
// On platforms where <exception> does not exist, this header defines
williamr@4
    24
// an exception base class.  This is *not* a substitute for everything
williamr@4
    25
// in <exception>, but it suffices to support a bare minimum of STL
williamr@4
    26
// functionality.
williamr@4
    27
williamr@4
    28
#ifndef _STLP_INTERNAL_EXCEPTION
williamr@4
    29
#define _STLP_INTERNAL_EXCEPTION
williamr@4
    30
williamr@4
    31
#if !defined (_STLP_NO_EXCEPTION_HEADER)
williamr@4
    32
williamr@4
    33
#  if defined ( _UNCAUGHT_EXCEPTION )
williamr@4
    34
#    undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
williamr@4
    35
#  endif
williamr@4
    36
williamr@4
    37
#  if defined (_STLP_BROKEN_EXCEPTION_CLASS)
williamr@4
    38
#    define exception     _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
williamr@4
    39
#    define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
williamr@4
    40
#    if defined (_STLP_NO_NEW_NEW_HEADER)
williamr@4
    41
#      include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
williamr@4
    42
#    else
williamr@4
    43
#      include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
williamr@4
    44
#    endif
williamr@4
    45
#    undef exception
williamr@4
    46
#    undef bad_exception
williamr@4
    47
#  else
williamr@4
    48
#    if defined (_STLP_NO_NEW_NEW_HEADER)
williamr@4
    49
#      include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
williamr@4
    50
#    else
williamr@4
    51
#      include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
williamr@4
    52
#    endif
williamr@4
    53
#  endif
williamr@4
    54
williamr@4
    55
#  if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && (defined (_STLP_MSVC) || defined (__ICL))
williamr@4
    56
// dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
williamr@4
    57
// the header <yvals.h> which ships with vc6 and is included by its native <exception>
williamr@4
    58
// actually turns on warnings, so we have to turn them back off.
williamr@4
    59
#    include <stl/config/_warnings_off.h>
williamr@4
    60
#  endif
williamr@4
    61
williamr@4
    62
#  if defined (_STLP_USE_OWN_NAMESPACE)
williamr@4
    63
williamr@4
    64
_STLP_BEGIN_NAMESPACE
williamr@4
    65
#    if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
williamr@4
    66
#      if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
williamr@4
    67
using _STLP_VENDOR_EXCEPT_STD::exception;
williamr@4
    68
#      else
williamr@4
    69
using ::exception;
williamr@4
    70
#      endif
williamr@4
    71
using _STLP_VENDOR_EXCEPT_STD::bad_exception;
williamr@4
    72
#    endif
williamr@4
    73
williamr@4
    74
#    if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
williamr@4
    75
// fbp : many platforms present strange mix of
williamr@4
    76
// those in various namespaces
williamr@4
    77
#      if !defined (_STLP_VENDOR_UNEXPECTED_STD)
williamr@4
    78
#        define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
williamr@4
    79
#      else
williamr@4
    80
/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
williamr@4
    81
 * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
williamr@4
    82
 * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
williamr@4
    83
 */
williamr@4
    84
#        if !defined (_STLP_VENDOR_TERMINATE_STD)
williamr@4
    85
#          define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
williamr@4
    86
#        endif
williamr@4
    87
#        if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
williamr@4
    88
#          define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
williamr@4
    89
#        endif
williamr@4
    90
#      endif
williamr@4
    91
#      if !defined (_STLP_VENDOR_TERMINATE_STD)
williamr@4
    92
#        define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
williamr@4
    93
#      endif
williamr@4
    94
#      if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
williamr@4
    95
#        define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
williamr@4
    96
#      endif
williamr@4
    97
#      if !defined (_STLP_VENDOR_TERMINATE_STD)
williamr@4
    98
#        define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
williamr@4
    99
#      endif
williamr@4
   100
#      if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
williamr@4
   101
#        define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
williamr@4
   102
#      endif
williamr@4
   103
// weird errors
williamr@4
   104
#        if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
williamr@4
   105
#          if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
williamr@4
   106
//See config/_intel.h for reason about this workaround
williamr@4
   107
using std::unexpected;
williamr@4
   108
#          else
williamr@4
   109
using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
williamr@4
   110
#          endif
williamr@4
   111
using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
williamr@4
   112
using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
williamr@4
   113
#        endif
williamr@4
   114
using _STLP_VENDOR_TERMINATE_STD::terminate;
williamr@4
   115
using _STLP_VENDOR_TERMINATE_STD::terminate_handler;
williamr@4
   116
using _STLP_VENDOR_TERMINATE_STD::set_terminate;
williamr@4
   117
williamr@4
   118
#      if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
williamr@4
   119
using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception;
williamr@4
   120
#      endif
williamr@4
   121
#    endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
williamr@4
   122
_STLP_END_NAMESPACE
williamr@4
   123
#  endif /* _STLP_OWN_NAMESPACE */
williamr@4
   124
#else /* _STLP_NO_EXCEPTION_HEADER */
williamr@4
   125
williamr@4
   126
/* fbp : absence of <exception> usually means that those
williamr@4
   127
 * functions are not going to be called by compiler.
williamr@4
   128
 * Still, define them for the user.
williamr@4
   129
 * dums: Policy modification, if the function do not behave like the Standard
williamr@4
   130
 *       defined it we do not grant it in the STLport namespace. We will have
williamr@4
   131
 *       compile time error rather than runtime error.
williamr@4
   132
 */
williamr@4
   133
#if 0
williamr@4
   134
/*
williamr@4
   135
typedef void (*unexpected_handler)();
williamr@4
   136
unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
williamr@4
   137
void unexpected();
williamr@4
   138
williamr@4
   139
typedef void (*terminate_handler)();
williamr@4
   140
terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
williamr@4
   141
void terminate();
williamr@4
   142
williamr@4
   143
bool uncaught_exception(); // not implemented under mpw as of Jan/1999
williamr@4
   144
*/
williamr@4
   145
#endif
williamr@4
   146
williamr@4
   147
#endif /* _STLP_NO_EXCEPTION_HEADER */
williamr@4
   148
williamr@4
   149
#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
williamr@4
   150
_STLP_BEGIN_NAMESPACE
williamr@4
   151
williamr@4
   152
// section 18.6.1
williamr@4
   153
class _STLP_CLASS_DECLSPEC exception {
williamr@4
   154
public:
williamr@4
   155
#  ifndef _STLP_USE_NO_IOSTREAMS
williamr@4
   156
  exception() _STLP_NOTHROW;
williamr@4
   157
  virtual ~exception() _STLP_NOTHROW;
williamr@4
   158
  virtual const char* what() const _STLP_NOTHROW;
williamr@4
   159
#  else
williamr@4
   160
  exception() _STLP_NOTHROW {}
williamr@4
   161
  virtual ~exception() _STLP_NOTHROW {}
williamr@4
   162
  virtual const char* what() const _STLP_NOTHROW {return "class exception";}
williamr@4
   163
#  endif
williamr@4
   164
};
williamr@4
   165
williamr@4
   166
// section 18.6.2.1
williamr@4
   167
class _STLP_CLASS_DECLSPEC bad_exception : public exception {
williamr@4
   168
public:
williamr@4
   169
#  ifndef _STLP_USE_NO_IOSTREAMS
williamr@4
   170
  bad_exception() _STLP_NOTHROW;
williamr@4
   171
  ~bad_exception() _STLP_NOTHROW;
williamr@4
   172
  const char* what() const _STLP_NOTHROW;
williamr@4
   173
#  else
williamr@4
   174
  bad_exception() _STLP_NOTHROW {}
williamr@4
   175
  ~bad_exception() _STLP_NOTHROW {}
williamr@4
   176
  const char* what() const _STLP_NOTHROW {return "class bad_exception";}
williamr@4
   177
#  endif
williamr@4
   178
};
williamr@4
   179
williamr@4
   180
// forward declaration
williamr@4
   181
class __Named_exception;
williamr@4
   182
_STLP_END_NAMESPACE
williamr@4
   183
#endif
williamr@4
   184
williamr@4
   185
#endif /* _STLP_INTERNAL_EXCEPTION */