2 * © Portions copyright (c) 2006-2007 Nokia Corporation. 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.
22 # if !defined (_STLP_OUTERMOST_HEADER_ID)
23 # define _STLP_OUTERMOST_HEADER_ID 0x63
24 # include <stl/_prolog.h>
25 # elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && ! defined (_STLP_DONT_POP_0x63)
26 # define _STLP_DONT_POP_0x63
29 #ifndef _STLP_STDEXCEPT
30 #define _STLP_STDEXCEPT 1
32 # ifdef _STLP_PRAGMA_ONCE
36 #if defined (_STLP_USE_TRAP_LEAVE)
39 STDEX_bad_alloc = -10000,
40 STDEX_logic_error = -10001,
41 STDEX_runtime_error = -10002,
42 STDEX_domain_error = -10003,
43 STDEX_invalid_argument = -10004,
44 STDEX_length_error = -10005,
45 STDEX_out_of_range = -10006,
46 STDEX_range_error = -10007,
47 STDEX_overflow_error = -10008,
48 STDEX_underflow_error = -10009
51 // User may override this
52 #ifndef STDEX_REPORT_EXCEPTION
53 # define STDEX_REPORT_EXCEPTION(x)
58 # if !defined(_STLP_STDEXCEPT_SEEN) && \
59 (!defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE))
61 # define _STLP_STDEXCEPT_SEEN 1
65 #if defined(_STLP_USE_EXCEPTIONS) || \
66 !(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32)
70 #ifndef _STLP_INTERNAL_ALLOC_H
71 # include <stl/_alloc.h>
74 #ifndef _STLP_STRING_FWD_H
75 # include <stl/_string_fwd.h>
78 # define _STLP_OWN_STDEXCEPT 1
82 # if ! defined (_STLP_NO_EXCEPTION_HEADER)
83 # if !defined(_STLP_EXCEPTION_BASE) && !defined(_STLP_BROKEN_EXCEPTION_CLASS) && defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
84 using _STLP_VENDOR_EXCEPT_STD::exception;
87 # define _STLP_EXCEPTION_BASE exception
90 class __Named_exception : public _STLP_EXCEPTION_BASE {
92 class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
93 #endif //__SYMBIAN32__
95 _STLP_DECLSPEC __Named_exception(const string& __str)
96 # ifdef _STLP_OWN_IOSTREAMS
98 _STLP_DECLSPEC const char* what() const _STLP_NOTHROW_INHERENTLY;
99 _STLP_DECLSPEC ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
102 strncpy(_M_name, __get_c_string(__str), _S_bufsize);
103 _M_name[_S_bufsize - 1] = '\0';
105 const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
109 enum { _S_bufsize = 256 };
110 char _M_name[_S_bufsize];
114 class logic_error : public __Named_exception {
116 class _STLP_CLASS_DECLSPEC logic_error : public __Named_exception {
119 _STLP_DECLSPEC logic_error(const string& __s)
123 : __Named_exception(__s) {}
125 # ifdef _STLP_OWN_IOSTREAMS
126 _STLP_DECLSPEC ~logic_error() _STLP_NOTHROW_INHERENTLY;
131 class runtime_error : public __Named_exception {
133 class _STLP_CLASS_DECLSPEC runtime_error : public __Named_exception {
136 _STLP_DECLSPEC runtime_error(const string& __s)
140 : __Named_exception(__s) {}
142 # ifdef _STLP_OWN_IOSTREAMS
143 _STLP_DECLSPEC ~runtime_error() _STLP_NOTHROW_INHERENTLY;
148 class domain_error : public logic_error {
150 class _STLP_CLASS_DECLSPEC domain_error : public logic_error {
153 _STLP_DECLSPEC domain_error(const string& __arg)
157 : logic_error(__arg) {}
159 # ifdef _STLP_OWN_IOSTREAMS
160 _STLP_DECLSPEC ~domain_error() _STLP_NOTHROW_INHERENTLY;
165 class invalid_argument : public logic_error {
167 class _STLP_CLASS_DECLSPEC invalid_argument : public logic_error {
170 _STLP_DECLSPEC invalid_argument(const string& __arg)
174 : logic_error(__arg) {}
176 # ifdef _STLP_OWN_IOSTREAMS
177 _STLP_DECLSPEC ~invalid_argument() _STLP_NOTHROW_INHERENTLY;
182 class length_error : public logic_error {
184 class _STLP_CLASS_DECLSPEC length_error : public logic_error {
187 _STLP_DECLSPEC length_error(const string& __arg)
191 : logic_error(__arg) {}
193 # ifdef _STLP_OWN_IOSTREAMS
194 _STLP_DECLSPEC ~length_error() _STLP_NOTHROW_INHERENTLY;
199 class out_of_range : public logic_error {
201 class _STLP_CLASS_DECLSPEC out_of_range : public logic_error {
204 _STLP_DECLSPEC out_of_range(const string& __arg)
208 : logic_error(__arg) {}
210 # ifdef _STLP_OWN_IOSTREAMS
211 _STLP_DECLSPEC ~out_of_range() _STLP_NOTHROW_INHERENTLY;
216 class range_error : public runtime_error {
218 class _STLP_CLASS_DECLSPEC range_error : public runtime_error {
221 _STLP_DECLSPEC range_error(const string& __arg)
225 : runtime_error(__arg) {}
227 # ifdef _STLP_OWN_IOSTREAMS
228 _STLP_DECLSPEC ~range_error() _STLP_NOTHROW_INHERENTLY;
233 class overflow_error : public runtime_error {
235 class _STLP_CLASS_DECLSPEC overflow_error : public runtime_error {
238 _STLP_DECLSPEC overflow_error(const string& __arg)
242 : runtime_error(__arg) {}
244 # ifdef _STLP_OWN_IOSTREAMS
245 _STLP_DECLSPEC ~overflow_error() _STLP_NOTHROW_INHERENTLY;
250 class underflow_error : public runtime_error {
252 class _STLP_CLASS_DECLSPEC underflow_error : public runtime_error {
255 _STLP_DECLSPEC underflow_error(const string& __arg)
259 : runtime_error(__arg) {}
261 # ifdef _STLP_OWN_IOSTREAMS
262 _STLP_DECLSPEC ~underflow_error() _STLP_NOTHROW_INHERENTLY;
268 #endif /* Not o32, and no exceptions */
269 # endif /* _STLP_STDEXCEPT_SEEN */
272 #if defined (_STLP_USE_NATIVE_STDEXCEPT)
273 # include _STLP_NATIVE_HEADER(stdexcept)
276 #endif /* _STLP_STDEXCEPT */
278 # if (_STLP_OUTERMOST_HEADER_ID == 0x63)
279 # if ! defined (_STLP_DONT_POP_0x63)
280 # include <stl/_epilog.h>
281 # undef _STLP_OUTERMOST_HEADER_ID
283 # undef _STLP_DONT_POP_0x63