epoc32/include/tools/stlport/stl/_stdexcept_base.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
williamr@4
    19
#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
williamr@4
    20
#define _STLP_INTERNAL_STDEXCEPT_BASE
williamr@4
    21
williamr@4
    22
#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
williamr@4
    23
williamr@4
    24
#  ifndef _STLP_INTERNAL_EXCEPTION
williamr@4
    25
#    include <stl/_exception.h>
williamr@4
    26
#  endif
williamr@4
    27
williamr@4
    28
#  if defined(_STLP_USE_EXCEPTIONS) || \
williamr@4
    29
    !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
williamr@4
    30
williamr@4
    31
#    ifndef _STLP_INTERNAL_CSTRING
williamr@4
    32
#      include <stl/_cstring.h>
williamr@4
    33
#    endif
williamr@4
    34
williamr@4
    35
#    ifndef _STLP_STRING_FWD_H
williamr@4
    36
#      include <stl/_string_fwd.h>
williamr@4
    37
#    endif
williamr@4
    38
williamr@4
    39
#    ifndef _STLP_USE_NO_IOSTREAMS
williamr@4
    40
#      define _STLP_OWN_STDEXCEPT 1
williamr@4
    41
#    endif
williamr@4
    42
williamr@4
    43
_STLP_BEGIN_NAMESPACE
williamr@4
    44
williamr@4
    45
/* We disable the 4275 warning for
williamr@4
    46
 *  - WinCE where there are only static version of the native C++ runtime.
williamr@4
    47
 *  - The MSVC compilers when the STLport user wants to make an STLport dll linked to
williamr@4
    48
 *    the static C++ native runtime. In this case the std::exception base class is no more
williamr@4
    49
 *    exported from native dll but is used as a base class for the exported __Named_exception
williamr@4
    50
 *    class.
williamr@4
    51
 */
williamr@4
    52
#    if defined (_STLP_WCE_NET) || \
williamr@4
    53
        defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
williamr@4
    54
#      define _STLP_DO_WARNING_POP
williamr@4
    55
#      pragma warning (push)
williamr@4
    56
#      pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
williamr@4
    57
                                      // for dll-interface class '__Named_exception'
williamr@4
    58
#    endif
williamr@4
    59
williamr@4
    60
#    if !defined (_STLP_NO_EXCEPTION_HEADER)
williamr@4
    61
#      if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
williamr@4
    62
           defined (_STLP_USE_NAMESPACES) &&  defined (_STLP_USE_OWN_NAMESPACE)
williamr@4
    63
using _STLP_VENDOR_EXCEPT_STD::exception;
williamr@4
    64
#      endif
williamr@4
    65
#    endif
williamr@4
    66
#    define _STLP_EXCEPTION_BASE exception
williamr@4
    67
williamr@4
    68
class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
williamr@4
    69
public:
williamr@4
    70
  __Named_exception(const string& __str)
williamr@4
    71
#    ifndef _STLP_USE_NO_IOSTREAMS
williamr@4
    72
    ;
williamr@4
    73
  const char* what() const _STLP_NOTHROW_INHERENTLY;
williamr@4
    74
  ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
williamr@4
    75
#    else
williamr@4
    76
  {
williamr@4
    77
#      if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
williamr@4
    78
    strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
williamr@4
    79
#      else
williamr@4
    80
    strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _S_bufsize);
williamr@4
    81
#      endif
williamr@4
    82
    _M_name[_S_bufsize - 1] = '\0';
williamr@4
    83
  }
williamr@4
    84
  const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
williamr@4
    85
#    endif
williamr@4
    86
williamr@4
    87
private:
williamr@4
    88
  enum { _S_bufsize = 256 };
williamr@4
    89
  char _M_name[_S_bufsize];
williamr@4
    90
};
williamr@4
    91
williamr@4
    92
#    if defined (_STLP_DO_WARNING_POP)
williamr@4
    93
#      pragma warning (pop)
williamr@4
    94
#      undef _STLP_DO_WARNING_POP
williamr@4
    95
#    endif
williamr@4
    96
williamr@4
    97
_STLP_END_NAMESPACE
williamr@4
    98
williamr@4
    99
#  endif /* Not o32, and no exceptions */
williamr@4
   100
#endif /* _STLP_STDEXCEPT_SEEN */
williamr@4
   101
williamr@4
   102
#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */