]> gcc.gnu.org Git - gcc.git/blame - libstdc++/stdexcept
Recognize _SOLTHREADS and define internal macros appropriately.
[gcc.git] / libstdc++ / stdexcept
CommitLineData
6599da04
JM
1// Methods for Exception Support for -*- C++ -*-
2// Copyright (C) 1994, 1995, 1997 Free Software Foundation
3
4// This file is part of the GNU ANSI C++ Library. This library is free
5// software; you can redistribute it and/or modify it under the
6// terms of the GNU General Public License as published by the
7// Free Software Foundation; either version 2, or (at your option)
8// any later version.
9
10// This library is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14
15// You should have received a copy of the GNU General Public License
16// along with this library; see the file COPYING. If not, write to the Free
17// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19// As a special exception, if you link this library with files
20// compiled with a GNU compiler to produce an executable, this does not cause
21// the resulting executable to be covered by the GNU General Public License.
22// This exception does not however invalidate any other reasons why
23// the executable file might be covered by the GNU General Public License.
24
25// Written by Mike Stump based upon the specification in the 20 September 1994
26// C++ working paper, ANSI document X3J16/94-0158.
27
28#ifndef __STDEXCEPT__
29#define __STDEXCEPT__
30
31#ifdef __GNUG__
32#pragma interface "stdexcept"
33#endif
34
35#include <exception>
36#include <string>
37
38extern "C++" {
39
ef109057 40namespace std {
ef109057 41
6599da04
JM
42class logic_error : public exception {
43 string _what;
44public:
45 logic_error(const string& what_arg): _what (what_arg) { }
46 virtual const char* what () const { return _what.c_str (); }
47};
48
49class domain_error : public logic_error {
50public:
51 domain_error (const string& what_arg): logic_error (what_arg) { }
52};
53
54class invalid_argument : public logic_error {
55public:
56 invalid_argument (const string& what_arg): logic_error (what_arg) { }
57};
58
59class length_error : public logic_error {
60public:
61 length_error (const string& what_arg): logic_error (what_arg) { }
62};
63
64class out_of_range : public logic_error {
65public:
66 out_of_range (const string& what_arg): logic_error (what_arg) { }
67};
68
69class runtime_error : public exception {
70 string _what;
71public:
72 runtime_error(const string& what_arg): _what (what_arg) { }
73 virtual const char* what () const { return _what.c_str (); }
74protected:
75 runtime_error(): exception () { }
76};
77
78class range_error : public runtime_error {
79public:
80 range_error (const string& what_arg): runtime_error (what_arg) { }
81};
82
83class overflow_error : public runtime_error {
84public:
85 overflow_error (const string& what_arg): runtime_error (what_arg) { }
86};
87
88class underflow_error : public runtime_error {
89public:
90 underflow_error (const string& what_arg): runtime_error (what_arg) { }
91};
92
ef109057 93} // namespace std
ef109057 94
6599da04
JM
95} // extern "C++"
96
97#endif
This page took 0.100119 seconds and 5 git commands to generate.