epoc32/include/stdapis/stlportv5/stl/_stdexcept_base.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
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@2
     1
/*
williamr@4
     2
 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
williamr@4
     3
 *
williamr@2
     4
 * Copyright (c) 1996,1997
williamr@2
     5
 * Silicon Graphics Computer Systems, Inc.
williamr@2
     6
 *
williamr@2
     7
 * Copyright (c) 1999
williamr@2
     8
 * Boris Fomitchev
williamr@2
     9
 *
williamr@2
    10
 * This material is provided "as is", with absolutely no warranty expressed
williamr@2
    11
 * or implied. Any use is at your own risk.
williamr@2
    12
 *
williamr@2
    13
 * Permission to use or copy this software for any purpose is hereby granted
williamr@2
    14
 * without fee, provided the above notices are retained on all copies.
williamr@2
    15
 * Permission to modify the code and to distribute modified code is granted,
williamr@2
    16
 * provided the above notices are retained, and a notice that the code was
williamr@2
    17
 * modified is included with the above copyright notice.
williamr@2
    18
 *
williamr@2
    19
 */
williamr@2
    20
williamr@2
    21
#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
williamr@2
    22
#define _STLP_INTERNAL_STDEXCEPT_BASE
williamr@2
    23
williamr@2
    24
#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
williamr@2
    25
williamr@2
    26
#  ifndef _STLP_INTERNAL_EXCEPTION
williamr@2
    27
#    include <stl/_exception.h>
williamr@2
    28
#  endif
williamr@2
    29
williamr@2
    30
#  if defined(_STLP_USE_EXCEPTIONS) || \
williamr@2
    31
    !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
williamr@2
    32
williamr@2
    33
#    ifndef _STLP_INTERNAL_CSTRING
williamr@2
    34
#      include <stl/_cstring.h>
williamr@2
    35
#    endif
williamr@2
    36
williamr@2
    37
#    ifndef _STLP_STRING_FWD_H
williamr@2
    38
#      include <stl/_string_fwd.h>
williamr@2
    39
#    endif
williamr@2
    40
williamr@2
    41
#    ifndef _STLP_USE_NO_IOSTREAMS
williamr@2
    42
#      define _STLP_OWN_STDEXCEPT 1
williamr@2
    43
#    endif
williamr@2
    44
williamr@2
    45
_STLP_BEGIN_NAMESPACE
williamr@2
    46
williamr@2
    47
/* We disable the 4275 warning for
williamr@2
    48
 *  - WinCE where there are only static version of the native C++ runtime.
williamr@2
    49
 *  - The MSVC compilers when the STLport user wants to make an STLport dll linked to
williamr@2
    50
 *    the static C++ native runtime. In this case the std::exception base class is no more
williamr@2
    51
 *    exported from native dll but is used as a base class for the exported __Named_exception
williamr@2
    52
 *    class.
williamr@2
    53
 */
williamr@2
    54
#    if defined (_STLP_WCE_NET) || \
williamr@2
    55
        defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
williamr@2
    56
#      define _STLP_DO_WARNING_POP
williamr@2
    57
#      pragma warning (push)
williamr@2
    58
#      pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
williamr@2
    59
                                      // for dll-interface class '__Named_exception'
williamr@2
    60
#    endif
williamr@2
    61
williamr@2
    62
#    if !defined (_STLP_NO_EXCEPTION_HEADER)
williamr@2
    63
#      if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
williamr@2
    64
           defined (_STLP_USE_NAMESPACES) &&  defined (_STLP_USE_OWN_NAMESPACE)
williamr@2
    65
using _STLP_VENDOR_EXCEPT_STD::exception;
williamr@2
    66
#      endif
williamr@2
    67
#    endif
williamr@2
    68
#    define _STLP_EXCEPTION_BASE exception
williamr@2
    69
williamr@2
    70
class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
williamr@2
    71
public:
williamr@4
    72
  _STLP_DECLSPEC __Named_exception(const string& __str)
williamr@2
    73
#    ifndef _STLP_USE_NO_IOSTREAMS
williamr@2
    74
    ;
williamr@4
    75
  _STLP_DECLSPEC const char* what() const _STLP_NOTHROW_INHERENTLY;
williamr@4
    76
  _STLP_DECLSPEC ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
williamr@2
    77
#    else
williamr@2
    78
  {
williamr@2
    79
#      if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
williamr@2
    80
    strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
williamr@4
    81
    _M_name[_S_bufsize - 1] = '\0';
williamr@2
    82
#      else
williamr@4
    83
    strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE);
williamr@2
    84
#      endif
williamr@2
    85
  }
williamr@2
    86
  const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
williamr@2
    87
#    endif
williamr@2
    88
williamr@2
    89
private:
williamr@2
    90
  enum { _S_bufsize = 256 };
williamr@2
    91
  char _M_name[_S_bufsize];
williamr@2
    92
};
williamr@2
    93
williamr@2
    94
#    if defined (_STLP_DO_WARNING_POP)
williamr@2
    95
#      pragma warning (pop)
williamr@2
    96
#      undef _STLP_DO_WARNING_POP
williamr@2
    97
#    endif
williamr@2
    98
williamr@2
    99
_STLP_END_NAMESPACE
williamr@2
   100
williamr@2
   101
#  endif /* Not o32, and no exceptions */
williamr@2
   102
#endif /* _STLP_STDEXCEPT_SEEN */
williamr@2
   103
williamr@2
   104
#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */