| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2018 Jaroslav Jindrak
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #include <cstdlib>
|
|---|
| 8 | #include <cstring>
|
|---|
| 9 | #include <stdexcept>
|
|---|
| 10 | #include <string>
|
|---|
| 11 | #include <str.h>
|
|---|
| 12 |
|
|---|
| 13 | namespace std
|
|---|
| 14 | {
|
|---|
| 15 | logic_error::logic_error(const string& what)
|
|---|
| 16 | : what_{::helenos::str_dup(what.c_str())}
|
|---|
| 17 | { /* DUMMY BODY */ }
|
|---|
| 18 |
|
|---|
| 19 | logic_error::logic_error(const char* what)
|
|---|
| 20 | : what_{::helenos::str_dup(what)}
|
|---|
| 21 | { /* DUMMY BODY */ }
|
|---|
| 22 |
|
|---|
| 23 | logic_error::logic_error(const logic_error& other) noexcept
|
|---|
| 24 | : exception{other}, what_{::helenos::str_dup(other.what_)}
|
|---|
| 25 | { /* DUMMY BODY */ }
|
|---|
| 26 |
|
|---|
| 27 | logic_error& logic_error::operator=(const logic_error& other)
|
|---|
| 28 | {
|
|---|
| 29 | if (what_)
|
|---|
| 30 | free(what_);
|
|---|
| 31 | what_ = ::helenos::str_dup(other.what_);
|
|---|
| 32 |
|
|---|
| 33 | return *this;
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | logic_error::~logic_error()
|
|---|
| 37 | {
|
|---|
| 38 | free(what_);
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | const char* logic_error::what() const noexcept
|
|---|
| 42 | {
|
|---|
| 43 | return what_;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | domain_error::domain_error(const string& what)
|
|---|
| 47 | : logic_error{what}
|
|---|
| 48 | { /* DUMMY BODY */ }
|
|---|
| 49 |
|
|---|
| 50 | domain_error::domain_error(const char* what)
|
|---|
| 51 | : logic_error{what}
|
|---|
| 52 | { /* DUMMY BODY */ }
|
|---|
| 53 |
|
|---|
| 54 | domain_error::domain_error(const domain_error& other) noexcept
|
|---|
| 55 | : logic_error{other}
|
|---|
| 56 | { /* DUMMY BODY */ }
|
|---|
| 57 |
|
|---|
| 58 | invalid_argument::invalid_argument(const string& what)
|
|---|
| 59 | : logic_error{what}
|
|---|
| 60 | { /* DUMMY BODY */ }
|
|---|
| 61 |
|
|---|
| 62 | invalid_argument::invalid_argument(const char* what)
|
|---|
| 63 | : logic_error{what}
|
|---|
| 64 | { /* DUMMY BODY */ }
|
|---|
| 65 |
|
|---|
| 66 | invalid_argument::invalid_argument(const invalid_argument& other) noexcept
|
|---|
| 67 | : logic_error{other}
|
|---|
| 68 | { /* DUMMY BODY */ }
|
|---|
| 69 |
|
|---|
| 70 | length_error::length_error(const string& what)
|
|---|
| 71 | : logic_error{what}
|
|---|
| 72 | { /* DUMMY BODY */ }
|
|---|
| 73 |
|
|---|
| 74 | length_error::length_error(const char* what)
|
|---|
| 75 | : logic_error{what}
|
|---|
| 76 | { /* DUMMY BODY */ }
|
|---|
| 77 |
|
|---|
| 78 | length_error::length_error(const length_error& other) noexcept
|
|---|
| 79 | : logic_error{other}
|
|---|
| 80 | { /* DUMMY BODY */ }
|
|---|
| 81 |
|
|---|
| 82 | out_of_range::out_of_range(const string& what)
|
|---|
| 83 | : logic_error{what}
|
|---|
| 84 | { /* DUMMY BODY */ }
|
|---|
| 85 |
|
|---|
| 86 | out_of_range::out_of_range(const char* what)
|
|---|
| 87 | : logic_error{what}
|
|---|
| 88 | { /* DUMMY BODY */ }
|
|---|
| 89 |
|
|---|
| 90 | out_of_range::out_of_range(const out_of_range& other) noexcept
|
|---|
| 91 | : logic_error{other}
|
|---|
| 92 | { /* DUMMY BODY */ }
|
|---|
| 93 |
|
|---|
| 94 | runtime_error::runtime_error(const string& what)
|
|---|
| 95 | : what_{::helenos::str_dup(what.c_str())}
|
|---|
| 96 | { /* DUMMY BODY */ }
|
|---|
| 97 |
|
|---|
| 98 | runtime_error::runtime_error(const char* what)
|
|---|
| 99 | : what_{::helenos::str_dup(what)}
|
|---|
| 100 | { /* DUMMY BODY */ }
|
|---|
| 101 |
|
|---|
| 102 | runtime_error::runtime_error(const runtime_error& other) noexcept
|
|---|
| 103 | : exception{other}, what_{::helenos::str_dup(other.what_)}
|
|---|
| 104 | { /* DUMMY BODY */ }
|
|---|
| 105 |
|
|---|
| 106 | runtime_error& runtime_error::operator=(const runtime_error& other)
|
|---|
| 107 | {
|
|---|
| 108 | if (what_)
|
|---|
| 109 | free(what_);
|
|---|
| 110 | what_ = ::helenos::str_dup(other.what_);
|
|---|
| 111 |
|
|---|
| 112 | return *this;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | runtime_error::~runtime_error()
|
|---|
| 116 | {
|
|---|
| 117 | free(what_);
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | const char* runtime_error::what() const noexcept
|
|---|
| 121 | {
|
|---|
| 122 | return what_;
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | range_error::range_error(const string& what)
|
|---|
| 126 | : runtime_error{what}
|
|---|
| 127 | { /* DUMMY BODY */ }
|
|---|
| 128 |
|
|---|
| 129 | range_error::range_error(const char* what)
|
|---|
| 130 | : runtime_error{what}
|
|---|
| 131 | { /* DUMMY BODY */ }
|
|---|
| 132 |
|
|---|
| 133 | range_error::range_error(const range_error& other) noexcept
|
|---|
| 134 | : runtime_error{other}
|
|---|
| 135 | { /* DUMMY BODY */ }
|
|---|
| 136 |
|
|---|
| 137 | overflow_error::overflow_error(const string& what)
|
|---|
| 138 | : runtime_error{what}
|
|---|
| 139 | { /* DUMMY BODY */ }
|
|---|
| 140 |
|
|---|
| 141 | overflow_error::overflow_error(const char* what)
|
|---|
| 142 | : runtime_error{what}
|
|---|
| 143 | { /* DUMMY BODY */ }
|
|---|
| 144 |
|
|---|
| 145 | overflow_error::overflow_error(const overflow_error& other) noexcept
|
|---|
| 146 | : runtime_error{other}
|
|---|
| 147 | { /* DUMMY BODY */ }
|
|---|
| 148 |
|
|---|
| 149 | underflow_error::underflow_error(const string& what)
|
|---|
| 150 | : runtime_error{what}
|
|---|
| 151 | { /* DUMMY BODY */ }
|
|---|
| 152 |
|
|---|
| 153 | underflow_error::underflow_error(const char* what)
|
|---|
| 154 | : runtime_error{what}
|
|---|
| 155 | { /* DUMMY BODY */ }
|
|---|
| 156 |
|
|---|
| 157 | underflow_error::underflow_error(const underflow_error& other) noexcept
|
|---|
| 158 | : runtime_error{other}
|
|---|
| 159 | { /* DUMMY BODY */ }
|
|---|
| 160 | }
|
|---|