| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1 | // -*- C++ -*- | 
|  | 2 | //===--------------------------- stdexcept --------------------------------===// | 
|  | 3 | // | 
| Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 5 | // | 
|  | 6 | // This file is distributed under the University of Illinois Open Source | 
|  | 7 | // License. See LICENSE.TXT for details. | 
|  | 8 | // | 
|  | 9 | //===----------------------------------------------------------------------===// | 
|  | 10 |  | 
|  | 11 | #ifndef _LIBCPP_STDEXCEPT | 
|  | 12 | #define _LIBCPP_STDEXCEPT | 
|  | 13 |  | 
|  | 14 | /* | 
|  | 15 | stdexcept synopsis | 
|  | 16 |  | 
|  | 17 | namespace std | 
|  | 18 | { | 
|  | 19 |  | 
|  | 20 | class logic_error; | 
|  | 21 | class domain_error; | 
|  | 22 | class invalid_argument; | 
|  | 23 | class length_error; | 
|  | 24 | class out_of_range; | 
|  | 25 | class runtime_error; | 
|  | 26 | class range_error; | 
|  | 27 | class overflow_error; | 
|  | 28 | class underflow_error; | 
|  | 29 |  | 
|  | 30 | for each class xxx_error: | 
|  | 31 |  | 
|  | 32 | class xxx_error : public exception // at least indirectly | 
|  | 33 | { | 
|  | 34 | public: | 
|  | 35 | explicit xxx_error(const string& what_arg); | 
|  | 36 | explicit xxx_error(const char* what_arg); // extension | 
|  | 37 |  | 
|  | 38 | virtual const char* what() const // returns what_arg | 
|  | 39 | }; | 
|  | 40 |  | 
|  | 41 | } // std | 
|  | 42 |  | 
|  | 43 | */ | 
|  | 44 |  | 
|  | 45 | #include <__config> | 
|  | 46 | #include <exception> | 
|  | 47 | #include <iosfwd> // for string forward decl | 
|  | 48 |  | 
|  | 49 | #pragma GCC system_header | 
|  | 50 |  | 
|  | 51 | namespace std // purposefully not using versioning namespace | 
|  | 52 | { | 
|  | 53 |  | 
|  | 54 | class _LIBCPP_EXCEPTION_ABI logic_error | 
|  | 55 | : public exception | 
|  | 56 | { | 
|  | 57 | private: | 
|  | 58 | void* __imp_; | 
|  | 59 | public: | 
|  | 60 | explicit logic_error(const string&); | 
|  | 61 | explicit logic_error(const char*); | 
|  | 62 |  | 
|  | 63 | logic_error(const logic_error&) throw(); | 
|  | 64 | logic_error& operator=(const logic_error&) throw(); | 
|  | 65 |  | 
|  | 66 | virtual ~logic_error() throw(); | 
|  | 67 |  | 
|  | 68 | virtual const char* what() const throw(); | 
|  | 69 | }; | 
|  | 70 |  | 
|  | 71 | class _LIBCPP_EXCEPTION_ABI runtime_error | 
|  | 72 | : public exception | 
|  | 73 | { | 
|  | 74 | private: | 
|  | 75 | void* __imp_; | 
|  | 76 | public: | 
|  | 77 | explicit runtime_error(const string&); | 
|  | 78 | explicit runtime_error(const char*); | 
|  | 79 |  | 
|  | 80 | runtime_error(const runtime_error&) throw(); | 
|  | 81 | runtime_error& operator=(const runtime_error&) throw(); | 
|  | 82 |  | 
|  | 83 | virtual ~runtime_error() throw(); | 
|  | 84 |  | 
|  | 85 | virtual const char* what() const throw(); | 
|  | 86 | }; | 
|  | 87 |  | 
|  | 88 | class _LIBCPP_EXCEPTION_ABI domain_error | 
|  | 89 | : public logic_error | 
|  | 90 | { | 
|  | 91 | public: | 
|  | 92 | _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {} | 
|  | 93 | _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {} | 
|  | 94 |  | 
|  | 95 | virtual ~domain_error() throw(); | 
|  | 96 | }; | 
|  | 97 |  | 
|  | 98 | class _LIBCPP_EXCEPTION_ABI invalid_argument | 
|  | 99 | : public logic_error | 
|  | 100 | { | 
|  | 101 | public: | 
|  | 102 | _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {} | 
|  | 103 | _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {} | 
|  | 104 |  | 
|  | 105 | virtual ~invalid_argument() throw(); | 
|  | 106 | }; | 
|  | 107 |  | 
|  | 108 | class _LIBCPP_EXCEPTION_ABI length_error | 
|  | 109 | : public logic_error | 
|  | 110 | { | 
|  | 111 | public: | 
|  | 112 | _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {} | 
|  | 113 | _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} | 
|  | 114 |  | 
|  | 115 | virtual ~length_error() throw(); | 
|  | 116 | }; | 
|  | 117 |  | 
|  | 118 | class _LIBCPP_EXCEPTION_ABI out_of_range | 
|  | 119 | : public logic_error | 
|  | 120 | { | 
|  | 121 | public: | 
|  | 122 | _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {} | 
|  | 123 | _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {} | 
|  | 124 |  | 
|  | 125 | virtual ~out_of_range() throw(); | 
|  | 126 | }; | 
|  | 127 |  | 
|  | 128 | class _LIBCPP_EXCEPTION_ABI range_error | 
|  | 129 | : public runtime_error | 
|  | 130 | { | 
|  | 131 | public: | 
|  | 132 | _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {} | 
|  | 133 | _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {} | 
|  | 134 |  | 
|  | 135 | virtual ~range_error() throw(); | 
|  | 136 | }; | 
|  | 137 |  | 
|  | 138 | class _LIBCPP_EXCEPTION_ABI overflow_error | 
|  | 139 | : public runtime_error | 
|  | 140 | { | 
|  | 141 | public: | 
|  | 142 | _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {} | 
|  | 143 | _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {} | 
|  | 144 |  | 
|  | 145 | virtual ~overflow_error() throw(); | 
|  | 146 | }; | 
|  | 147 |  | 
|  | 148 | class _LIBCPP_EXCEPTION_ABI underflow_error | 
|  | 149 | : public runtime_error | 
|  | 150 | { | 
|  | 151 | public: | 
|  | 152 | _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {} | 
|  | 153 | _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {} | 
|  | 154 |  | 
|  | 155 | virtual ~underflow_error() throw(); | 
|  | 156 | }; | 
|  | 157 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 158 | } // std | 
|  | 159 |  | 
|  | 160 | #endif // _LIBCPP_STDEXCEPT |