Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-02 08:16:04

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