* va-sh.h (__va_arg_sh1): Define.
[official-gcc.git] / libstdc++ / stdexcept
blob96be4d283b3d119f0948f6a544b6ab6685e05757
1 // Methods for Exception Support for -*- C++ -*-
2 // Copyright (C) 1994, 1995, 1997 Free Software Foundation
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.
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.
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.
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.
25 // Written by Mike Stump based upon the specification in the 20 September 1994
26 // C++ working paper, ANSI document X3J16/94-0158.
28 #ifndef __STDEXCEPT__
29 #define __STDEXCEPT__
31 #ifdef __GNUG__
32 #pragma interface "stdexcept"
33 #endif
35 #include <exception>
36 #include <string>
38 extern "C++" {
40 class logic_error : public exception {
41   string _what;
42 public:
43   logic_error(const string& what_arg): _what (what_arg) { }
44   virtual const char* what () const { return _what.c_str (); }
47 class domain_error : public logic_error {
48 public:
49   domain_error (const string& what_arg): logic_error (what_arg) { }
52 class invalid_argument : public logic_error {
53 public:
54   invalid_argument (const string& what_arg): logic_error (what_arg) { }
57 class length_error : public logic_error {
58 public:
59   length_error (const string& what_arg): logic_error (what_arg) { }
62 class out_of_range : public logic_error {
63 public:
64   out_of_range (const string& what_arg): logic_error (what_arg) { }
67 class runtime_error : public exception {
68   string _what;
69 public:
70   runtime_error(const string& what_arg): _what (what_arg) { }
71   virtual const char* what () const { return _what.c_str (); }
72 protected:
73   runtime_error(): exception () { }
76 class range_error : public runtime_error {
77 public:
78   range_error (const string& what_arg): runtime_error (what_arg) { }
81 class overflow_error : public runtime_error {
82 public:
83   overflow_error (const string& what_arg): runtime_error (what_arg) { }
86 class underflow_error : public runtime_error {
87 public:
88   underflow_error (const string& what_arg): runtime_error (what_arg) { }
91 } // extern "C++"
93 #endif