Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | // -*- C++ -*- |
|---|---|
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H |
| 11 | #define _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H |
| 12 | |
| 13 | #include <__compare/ordering.h> |
| 14 | #include <__config> |
| 15 | #include <string> |
| 16 | |
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | # pragma GCC system_header |
| 19 | #endif |
| 20 | |
| 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 22 | |
| 23 | class _LIBCPP_EXPORTED_FROM_ABI error_condition; |
| 24 | class _LIBCPP_EXPORTED_FROM_ABI error_code; |
| 25 | |
| 26 | class _LIBCPP_HIDDEN __do_message; |
| 27 | |
| 28 | class _LIBCPP_EXPORTED_FROM_ABI error_category { |
| 29 | public: |
| 30 | virtual ~error_category() _NOEXCEPT; |
| 31 | |
| 32 | #if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS) |
| 33 | error_category() noexcept; |
| 34 | #else |
| 35 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default; |
| 36 | #endif |
| 37 | error_category(const error_category&) = delete; |
| 38 | error_category& operator=(const error_category&) = delete; |
| 39 | |
| 40 | virtual const char* name() const _NOEXCEPT = 0; |
| 41 | virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; |
| 42 | virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; |
| 43 | virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; |
| 44 | virtual string message(int __ev) const = 0; |
| 45 | |
| 46 | _LIBCPP_HIDE_FROM_ABI bool operator==(const error_category& __rhs) const _NOEXCEPT { return this == &__rhs; } |
| 47 | |
| 48 | #if _LIBCPP_STD_VER >= 20 |
| 49 | |
| 50 | _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const error_category& __rhs) const noexcept { |
| 51 | return compare_three_way()(this, std::addressof(__rhs)); |
| 52 | } |
| 53 | |
| 54 | #else // _LIBCPP_STD_VER >= 20 |
| 55 | |
| 56 | _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_category& __rhs) const _NOEXCEPT { return !(*this == __rhs); } |
| 57 | |
| 58 | _LIBCPP_HIDE_FROM_ABI bool operator<(const error_category& __rhs) const _NOEXCEPT { return this < &__rhs; } |
| 59 | |
| 60 | #endif // _LIBCPP_STD_VER >= 20 |
| 61 | |
| 62 | friend class _LIBCPP_HIDDEN __do_message; |
| 63 | }; |
| 64 | |
| 65 | class _LIBCPP_HIDDEN __do_message : public error_category { |
| 66 | public: |
| 67 | string message(int __ev) const override; |
| 68 | }; |
| 69 | |
| 70 | [[__gnu__::__const__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT; |
| 71 | [[__gnu__::__const__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT; |
| 72 | |
| 73 | _LIBCPP_END_NAMESPACE_STD |
| 74 | |
| 75 | #endif // _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H |
| 76 |
Warning: This file is not a C or C++ file. It does not have highlighting.
