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