29 #ifndef _GLIBCXX_SYSTEM_ERROR
30 #define _GLIBCXX_SYSTEM_ERROR 1
32 #pragma GCC system_header
34 #ifndef __GXX_EXPERIMENTAL_CXX0X__
43 _GLIBCXX_BEGIN_NAMESPACE(std)
46 class error_condition;
51 template<typename _Tp>
55 template<
typename _Tp>
79 message(
int)
const = 0;
82 default_error_condition(
int __i)
const;
88 equivalent(
const error_code& __code,
int __i)
const;
96 {
return this == &__other; }
100 {
return this != &__other; }
114 : _M_value(0), _M_cat(&system_category()) { }
117 : _M_value(__v), _M_cat(&__cat) { }
119 template<
typename _ErrorCodeEnum>
122 { *
this = make_error_code(__e); }
133 { assign(0, system_category()); }
136 template<
typename _ErrorCodeEnum>
137 typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value,
139 operator=(_ErrorCodeEnum __e)
140 {
return *
this = make_error_code(__e); }
143 value()
const {
return _M_value; }
146 category()
const {
return *_M_cat; }
149 default_error_condition()
const;
153 {
return category().message(value()); }
158 typedef void (*__bool_type)();
160 static void __not_bool_type() { }
162 operator __bool_type()
const
163 {
return _M_value != 0 ? &__not_bool_type :
false; }
173 make_error_code(errc __e)
174 {
return error_code(static_cast<int>(__e), generic_category()); }
177 operator<(
const error_code& __lhs,
const error_code& __rhs)
179 return (__lhs.category() < __rhs.category()
180 || (__lhs.category() == __rhs.category()
181 && __lhs.value() < __rhs.value()));
184 template<
typename _CharT,
typename _Traits>
185 basic_ostream<_CharT, _Traits>&
186 operator<<(basic_ostream<_CharT, _Traits>& __os,
const error_code& __e)
187 {
return (__os << __e.category().name() <<
':' << __e.value()); }
189 error_condition make_error_condition(errc);
196 : _M_value(0), _M_cat(&generic_category()) { }
199 : _M_value(__v), _M_cat(&__cat) { }
201 template<
typename _ErrorConditionEnum>
204 <_ErrorConditionEnum>::value>::type* = 0)
205 { *
this = make_error_condition(__e); }
215 template<
typename _ErrorConditionEnum>
218 operator=(_ErrorConditionEnum __e)
219 {
return *
this = make_error_condition(__e); }
223 { assign(0, generic_category()); }
227 value()
const {
return _M_value; }
230 category()
const {
return *_M_cat; }
234 {
return category().message(value()); }
239 typedef void (*__bool_type)();
241 static void __not_bool_type() { }
243 operator __bool_type()
const
244 {
return _M_value != 0 ? &__not_bool_type :
false; }
254 make_error_condition(errc __e)
258 operator<(
const error_condition& __lhs,
const error_condition& __rhs)
260 return (__lhs.category() < __rhs.category()
261 || (__lhs.category() == __rhs.category()
262 && __lhs.value() < __rhs.value()));
267 operator==(
const error_code& __lhs,
const error_code& __rhs)
268 {
return (__lhs.category() == __rhs.category()
269 && __lhs.value() == __rhs.value()); }
272 operator==(
const error_code& __lhs,
const error_condition& __rhs)
274 return (__lhs.category().equivalent(__lhs.value(), __rhs)
275 || __rhs.category().equivalent(__lhs, __rhs.value()));
279 operator==(
const error_condition& __lhs,
const error_code& __rhs)
281 return (__rhs.category().equivalent(__rhs.value(), __lhs)
282 || __lhs.category().equivalent(__rhs, __lhs.value()));
286 operator==(
const error_condition& __lhs,
const error_condition& __rhs)
288 return (__lhs.category() == __rhs.category()
289 && __lhs.value() == __rhs.value());
293 operator!=(
const error_code& __lhs,
const error_code& __rhs)
294 {
return !(__lhs == __rhs); }
297 operator!=(
const error_code& __lhs,
const error_condition& __rhs)
298 {
return !(__lhs == __rhs); }
301 operator!=(
const error_condition& __lhs,
const error_code& __rhs)
302 {
return !(__lhs == __rhs); }
305 operator!=(
const error_condition& __lhs,
const error_condition& __rhs)
306 {
return !(__lhs == __rhs); }
345 code()
const throw() {
return _M_code; }
348 _GLIBCXX_END_NAMESPACE
350 #endif // __GXX_EXPERIMENTAL_CXX0X__
352 #endif // _GLIBCXX_SYSTEM_ERROR
Thrown to indicate error code of underlying system.
One of two subclasses of exception.
One of the comparison functors.