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