2 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
4 * Copyright (c) 1996,1997
5 * Silicon Graphics Computer Systems, Inc.
10 * This material is provided "as is", with absolutely no warranty expressed
11 * or implied. Any use is at your own risk.
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.
21 #ifndef _STLP_INTERNAL_STDEXCEPT_BASE
22 #define _STLP_INTERNAL_STDEXCEPT_BASE
24 #if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
26 # ifndef _STLP_INTERNAL_EXCEPTION
27 # include <stl/_exception.h>
30 # if defined(_STLP_USE_EXCEPTIONS) || \
31 !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
33 # ifndef _STLP_INTERNAL_CSTRING
34 # include <stl/_cstring.h>
37 # ifndef _STLP_STRING_FWD_H
38 # include <stl/_string_fwd.h>
41 # ifndef _STLP_USE_NO_IOSTREAMS
42 # define _STLP_OWN_STDEXCEPT 1
47 /* We disable the 4275 warning for
48 * - WinCE where there are only static version of the native C++ runtime.
49 * - The MSVC compilers when the STLport user wants to make an STLport dll linked to
50 * the static C++ native runtime. In this case the std::exception base class is no more
51 * exported from native dll but is used as a base class for the exported __Named_exception
54 # if defined (_STLP_WCE_NET) || \
55 defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
56 # define _STLP_DO_WARNING_POP
57 # pragma warning (push)
58 # pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
59 // for dll-interface class '__Named_exception'
62 # if !defined (_STLP_NO_EXCEPTION_HEADER)
63 # if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
64 defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
65 using _STLP_VENDOR_EXCEPT_STD::exception;
68 # define _STLP_EXCEPTION_BASE exception
70 class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
72 _STLP_DECLSPEC __Named_exception(const string& __str)
73 # ifndef _STLP_USE_NO_IOSTREAMS
75 _STLP_DECLSPEC const char* what() const _STLP_NOTHROW_INHERENTLY;
76 _STLP_DECLSPEC ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
79 # if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
80 strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
81 _M_name[_S_bufsize - 1] = '\0';
83 strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE);
86 const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
90 enum { _S_bufsize = 256 };
91 char _M_name[_S_bufsize];
94 # if defined (_STLP_DO_WARNING_POP)
95 # pragma warning (pop)
96 # undef _STLP_DO_WARNING_POP
101 # endif /* Not o32, and no exceptions */
102 #endif /* _STLP_STDEXCEPT_SEEN */
104 #endif /* _STLP_INTERNAL_STDEXCEPT_BASE */