File indexing completed on 2025-01-18 09:39:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_JSON_IMPL_ERROR_HPP
0011 #define BOOST_JSON_IMPL_ERROR_HPP
0012
0013 #include <type_traits>
0014
0015 namespace boost {
0016 namespace system {
0017 template<>
0018 struct is_error_code_enum< ::boost::json::error >
0019 {
0020 static bool const value = true;
0021 };
0022 template<>
0023 struct is_error_condition_enum< ::boost::json::condition >
0024 {
0025 static bool const value = true;
0026 };
0027 }
0028 }
0029
0030 namespace std {
0031 template<>
0032 struct is_error_code_enum< ::boost::json::error >
0033 {
0034 static bool const value = true;
0035 };
0036 template<>
0037 struct is_error_condition_enum< ::boost::json::condition >
0038 {
0039 static bool const value = true;
0040 };
0041 }
0042
0043 namespace boost {
0044 namespace json {
0045 namespace detail {
0046
0047 struct error_code_category_t
0048 : error_category
0049 {
0050 constexpr
0051 error_code_category_t()
0052 : error_category(0xB9A9B9922177C772)
0053 {}
0054
0055 BOOST_JSON_DECL
0056 const char*
0057 name() const noexcept override;
0058
0059 BOOST_JSON_DECL
0060 char const*
0061 message( int ev, char* buf, std::size_t len ) const noexcept override;
0062
0063 BOOST_JSON_DECL
0064 std::string
0065 message( int ev ) const override;
0066
0067 BOOST_JSON_DECL
0068 error_condition
0069 default_error_condition( int ev ) const noexcept override;
0070 };
0071
0072 extern
0073 BOOST_JSON_DECL
0074 error_code_category_t error_code_category;
0075
0076 struct error_condition_category_t
0077 : error_category
0078 {
0079 constexpr
0080 error_condition_category_t()
0081 : error_category(0x37CEF5A036D24FD1)
0082 {}
0083
0084 BOOST_JSON_DECL
0085 const char*
0086 name() const noexcept override;
0087
0088 BOOST_JSON_DECL
0089 char const*
0090 message( int ev, char*, std::size_t ) const noexcept override;
0091
0092 BOOST_JSON_DECL
0093 std::string
0094 message( int cv ) const override;
0095 };
0096
0097 extern
0098 BOOST_JSON_DECL
0099 error_condition_category_t error_condition_category;
0100
0101 }
0102
0103 inline
0104 BOOST_SYSTEM_CONSTEXPR
0105 error_code
0106 make_error_code(error e) noexcept
0107 {
0108
0109 return error_code(
0110 static_cast<std::underlying_type<error>::type>(e),
0111 detail::error_code_category );
0112 }
0113
0114 inline
0115 BOOST_SYSTEM_CONSTEXPR
0116 error_condition
0117 make_error_condition(condition c) noexcept
0118 {
0119 return error_condition(
0120 static_cast<std::underlying_type<condition>::type>(c),
0121 detail::error_condition_category );
0122 }
0123
0124 }
0125 }
0126
0127 #endif