Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / c++ / stdexcept @ 13

History | View | Annotate | Download (4.31 KB)

1 13 up20180614
// -*- C++ -*-
2
//===--------------------------- stdexcept --------------------------------===//
3
//
4
//                     The LLVM Compiler Infrastructure
5
//
6
// This file is dual licensed under the MIT and the University of Illinois Open
7
// Source Licenses. 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);
37
38
    virtual const char* what() const noexcept // 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
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
50
#pragma GCC system_header
51
#endif
52
53
#ifndef _LIBCPP___REFSTRING
54
_LIBCPP_BEGIN_NAMESPACE_STD
55
class _LIBCPP_HIDDEN __libcpp_refstring {
56
    const char *__imp_ _LIBCPP_UNUSED;
57
};
58
_LIBCPP_END_NAMESPACE_STD
59
#endif
60
61
namespace std  // purposefully not using versioning namespace
62
{
63
64
class _LIBCPP_EXCEPTION_ABI logic_error
65
    : public exception
66
{
67
private:
68
    _VSTD::__libcpp_refstring __imp_;
69
public:
70
    explicit logic_error(const string&);
71
    explicit logic_error(const char*);
72
73
    logic_error(const logic_error&) _NOEXCEPT;
74
    logic_error& operator=(const logic_error&) _NOEXCEPT;
75
76
    virtual ~logic_error() _NOEXCEPT;
77
78
    virtual const char* what() const _NOEXCEPT;
79
};
80
81
class _LIBCPP_EXCEPTION_ABI runtime_error
82
    : public exception
83
{
84
private:
85
    _VSTD::__libcpp_refstring __imp_;
86
public:
87
    explicit runtime_error(const string&);
88
    explicit runtime_error(const char*);
89
90
    runtime_error(const runtime_error&) _NOEXCEPT;
91
    runtime_error& operator=(const runtime_error&) _NOEXCEPT;
92
93
    virtual ~runtime_error() _NOEXCEPT;
94
95
    virtual const char* what() const _NOEXCEPT;
96
};
97
98
class _LIBCPP_EXCEPTION_ABI domain_error
99
    : public logic_error
100
{
101
public:
102
    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
103
    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s)   : logic_error(__s) {}
104
105
    virtual ~domain_error() _NOEXCEPT;
106
};
107
108
class _LIBCPP_EXCEPTION_ABI invalid_argument
109
    : public logic_error
110
{
111
public:
112
    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
113
    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s)   : logic_error(__s) {}
114
115
    virtual ~invalid_argument() _NOEXCEPT;
116
};
117
118
class _LIBCPP_EXCEPTION_ABI length_error
119
    : public logic_error
120
{
121
public:
122
    _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
123
    _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s)   : logic_error(__s) {}
124
125
    virtual ~length_error() _NOEXCEPT;
126
};
127
128
class _LIBCPP_EXCEPTION_ABI out_of_range
129
    : public logic_error
130
{
131
public:
132
    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
133
    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s)   : logic_error(__s) {}
134
135
    virtual ~out_of_range() _NOEXCEPT;
136
};
137
138
class _LIBCPP_EXCEPTION_ABI range_error
139
    : public runtime_error
140
{
141
public:
142
    _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
143
    _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s)   : runtime_error(__s) {}
144
145
    virtual ~range_error() _NOEXCEPT;
146
};
147
148
class _LIBCPP_EXCEPTION_ABI overflow_error
149
    : public runtime_error
150
{
151
public:
152
    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
153
    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s)   : runtime_error(__s) {}
154
155
    virtual ~overflow_error() _NOEXCEPT;
156
};
157
158
class _LIBCPP_EXCEPTION_ABI underflow_error
159
    : public runtime_error
160
{
161
public:
162
    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
163
    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s)   : runtime_error(__s) {}
164
165
    virtual ~underflow_error() _NOEXCEPT;
166
};
167
168
}  // std
169
170
#endif  // _LIBCPP_STDEXCEPT