| [13f7525] | 1 | /*
|
|---|
| [b57ba05] | 2 | * SPDX-FileCopyrightText: 2018 Jaroslav Jindrak
|
|---|
| [13f7525] | 3 | *
|
|---|
| [b57ba05] | 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| [13f7525] | 5 | */
|
|---|
| 6 |
|
|---|
| [b57a3ee] | 7 | #ifndef LIBCPP_BITS_STDEXCEPT
|
|---|
| 8 | #define LIBCPP_BITS_STDEXCEPT
|
|---|
| [13f7525] | 9 |
|
|---|
| [b57a3ee] | 10 | #include <__bits/string/stringfwd.hpp>
|
|---|
| 11 | #include <__bits/trycatch.hpp>
|
|---|
| [0d221d2] | 12 | #include <exception>
|
|---|
| 13 | #include <iosfwd>
|
|---|
| 14 |
|
|---|
| 15 | namespace std
|
|---|
| 16 | {
|
|---|
| 17 | class logic_error: public exception
|
|---|
| 18 | {
|
|---|
| 19 | public:
|
|---|
| 20 | explicit logic_error(const string&);
|
|---|
| 21 | explicit logic_error(const char*);
|
|---|
| 22 | logic_error(const logic_error&) noexcept;
|
|---|
| 23 | logic_error& operator=(const logic_error&);
|
|---|
| 24 | ~logic_error() override;
|
|---|
| 25 |
|
|---|
| 26 | const char* what() const noexcept override;
|
|---|
| 27 |
|
|---|
| 28 | protected:
|
|---|
| [c735afb] | 29 | char* what_;
|
|---|
| [0d221d2] | 30 | };
|
|---|
| 31 |
|
|---|
| 32 | class domain_error: public logic_error
|
|---|
| 33 | {
|
|---|
| 34 | public:
|
|---|
| 35 | explicit domain_error(const string&);
|
|---|
| 36 | explicit domain_error(const char*);
|
|---|
| 37 | domain_error(const domain_error&) noexcept;
|
|---|
| 38 | };
|
|---|
| 39 |
|
|---|
| 40 | class invalid_argument: public logic_error
|
|---|
| 41 | {
|
|---|
| 42 | public:
|
|---|
| 43 | explicit invalid_argument(const string&);
|
|---|
| 44 | explicit invalid_argument(const char*);
|
|---|
| 45 | invalid_argument(const invalid_argument&) noexcept;
|
|---|
| 46 | };
|
|---|
| 47 |
|
|---|
| 48 | class length_error: public logic_error
|
|---|
| 49 | {
|
|---|
| 50 | public:
|
|---|
| 51 | explicit length_error(const string&);
|
|---|
| 52 | explicit length_error(const char*);
|
|---|
| 53 | length_error(const length_error&) noexcept;
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | class out_of_range: public logic_error
|
|---|
| 57 | {
|
|---|
| 58 | public:
|
|---|
| 59 | explicit out_of_range(const string&);
|
|---|
| 60 | explicit out_of_range(const char*);
|
|---|
| 61 | out_of_range(const out_of_range&) noexcept;
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | class runtime_error: public exception
|
|---|
| 65 | {
|
|---|
| 66 | public:
|
|---|
| 67 | explicit runtime_error(const string&);
|
|---|
| 68 | explicit runtime_error(const char*);
|
|---|
| 69 | runtime_error(const runtime_error&) noexcept;
|
|---|
| 70 | runtime_error& operator=(const runtime_error&);
|
|---|
| 71 | ~runtime_error() override;
|
|---|
| 72 |
|
|---|
| 73 | const char* what() const noexcept override;
|
|---|
| 74 |
|
|---|
| 75 | protected:
|
|---|
| [c735afb] | 76 | char* what_;
|
|---|
| [0d221d2] | 77 | };
|
|---|
| 78 |
|
|---|
| 79 | class range_error: public runtime_error
|
|---|
| 80 | {
|
|---|
| 81 | public:
|
|---|
| 82 | explicit range_error(const string&);
|
|---|
| 83 | explicit range_error(const char*);
|
|---|
| 84 | range_error(const range_error&) noexcept;
|
|---|
| 85 | };
|
|---|
| 86 |
|
|---|
| 87 | class overflow_error: public runtime_error
|
|---|
| 88 | {
|
|---|
| 89 | public:
|
|---|
| 90 | explicit overflow_error(const string&);
|
|---|
| 91 | explicit overflow_error(const char*);
|
|---|
| 92 | overflow_error(const overflow_error&) noexcept;
|
|---|
| 93 | };
|
|---|
| 94 |
|
|---|
| 95 | class underflow_error: public runtime_error
|
|---|
| 96 | {
|
|---|
| 97 | public:
|
|---|
| 98 | explicit underflow_error(const string&);
|
|---|
| 99 | explicit underflow_error(const char*);
|
|---|
| 100 | underflow_error(const underflow_error&) noexcept;
|
|---|
| 101 | };
|
|---|
| 102 | }
|
|---|
| [13f7525] | 103 |
|
|---|
| 104 | #endif
|
|---|