100.00% Lines (5/5)
100.00% Functions (2/2)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com) | |||||
| 3 | // | 3 | // | |||||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 6 | // | 6 | // | |||||
| 7 | // Official repository: https://github.com/cppalliance/http | 7 | // Official repository: https://github.com/cppalliance/http | |||||
| 8 | // | 8 | // | |||||
| 9 | 9 | |||||||
| 10 | #ifndef BOOST_HTTP_IMPL_ERROR_HPP | 10 | #ifndef BOOST_HTTP_IMPL_ERROR_HPP | |||||
| 11 | #define BOOST_HTTP_IMPL_ERROR_HPP | 11 | #define BOOST_HTTP_IMPL_ERROR_HPP | |||||
| 12 | 12 | |||||||
| 13 | #include <boost/core/detail/string_view.hpp> | 13 | #include <boost/core/detail/string_view.hpp> | |||||
| 14 | #include <boost/system/error_category.hpp> | 14 | #include <boost/system/error_category.hpp> | |||||
| 15 | #include <boost/system/is_error_code_enum.hpp> | 15 | #include <boost/system/is_error_code_enum.hpp> | |||||
| 16 | #include <boost/system/is_error_condition_enum.hpp> | 16 | #include <boost/system/is_error_condition_enum.hpp> | |||||
| 17 | #include <system_error> | 17 | #include <system_error> | |||||
| 18 | 18 | |||||||
| 19 | namespace boost { | 19 | namespace boost { | |||||
| 20 | 20 | |||||||
| 21 | namespace system { | 21 | namespace system { | |||||
| 22 | 22 | |||||||
| 23 | template<> | 23 | template<> | |||||
| 24 | struct is_error_code_enum< | 24 | struct is_error_code_enum< | |||||
| 25 | ::boost::http::error> | 25 | ::boost::http::error> | |||||
| 26 | { | 26 | { | |||||
| 27 | static bool const value = true; | 27 | static bool const value = true; | |||||
| 28 | }; | 28 | }; | |||||
| 29 | 29 | |||||||
| 30 | template<> | 30 | template<> | |||||
| 31 | struct is_error_condition_enum< | 31 | struct is_error_condition_enum< | |||||
| 32 | ::boost::http::condition> | 32 | ::boost::http::condition> | |||||
| 33 | { | 33 | { | |||||
| 34 | static bool const value = true; | 34 | static bool const value = true; | |||||
| 35 | }; | 35 | }; | |||||
| 36 | 36 | |||||||
| 37 | } // system | 37 | } // system | |||||
| 38 | } // boost | 38 | } // boost | |||||
| 39 | 39 | |||||||
| 40 | namespace std { | 40 | namespace std { | |||||
| 41 | template<> | 41 | template<> | |||||
| 42 | struct is_error_code_enum< | 42 | struct is_error_code_enum< | |||||
| 43 | ::boost::http::error> | 43 | ::boost::http::error> | |||||
| 44 | : std::true_type {}; | 44 | : std::true_type {}; | |||||
| 45 | 45 | |||||||
| 46 | template<> | 46 | template<> | |||||
| 47 | struct is_error_condition_enum< | 47 | struct is_error_condition_enum< | |||||
| 48 | ::boost::http::condition> | 48 | ::boost::http::condition> | |||||
| 49 | : std::true_type {}; | 49 | : std::true_type {}; | |||||
| 50 | } // std | 50 | } // std | |||||
| 51 | 51 | |||||||
| 52 | namespace boost { | 52 | namespace boost { | |||||
| 53 | 53 | |||||||
| 54 | //----------------------------------------------- | 54 | //----------------------------------------------- | |||||
| 55 | 55 | |||||||
| 56 | namespace http { | 56 | namespace http { | |||||
| 57 | 57 | |||||||
| 58 | namespace detail { | 58 | namespace detail { | |||||
| 59 | 59 | |||||||
| 60 | struct BOOST_HTTP_SYMBOL_VISIBLE | 60 | struct BOOST_HTTP_SYMBOL_VISIBLE | |||||
| 61 | error_cat_type | 61 | error_cat_type | |||||
| 62 | : system::error_category | 62 | : system::error_category | |||||
| 63 | { | 63 | { | |||||
| 64 | BOOST_HTTP_DECL const char* name( | 64 | BOOST_HTTP_DECL const char* name( | |||||
| 65 | ) const noexcept override; | 65 | ) const noexcept override; | |||||
| 66 | BOOST_HTTP_DECL std::string message( | 66 | BOOST_HTTP_DECL std::string message( | |||||
| 67 | int) const override; | 67 | int) const override; | |||||
| 68 | BOOST_HTTP_DECL char const* message( | 68 | BOOST_HTTP_DECL char const* message( | |||||
| 69 | int, char*, std::size_t | 69 | int, char*, std::size_t | |||||
| 70 | ) const noexcept override; | 70 | ) const noexcept override; | |||||
| 71 | BOOST_SYSTEM_CONSTEXPR error_cat_type() | 71 | BOOST_SYSTEM_CONSTEXPR error_cat_type() | |||||
| 72 | : error_category(0x3663257e7585fbfd) | 72 | : error_category(0x3663257e7585fbfd) | |||||
| 73 | { | 73 | { | |||||
| 74 | } | 74 | } | |||||
| 75 | }; | 75 | }; | |||||
| 76 | 76 | |||||||
| 77 | struct BOOST_HTTP_SYMBOL_VISIBLE | 77 | struct BOOST_HTTP_SYMBOL_VISIBLE | |||||
| 78 | condition_cat_type | 78 | condition_cat_type | |||||
| 79 | : system::error_category | 79 | : system::error_category | |||||
| 80 | { | 80 | { | |||||
| 81 | BOOST_HTTP_DECL const char* name( | 81 | BOOST_HTTP_DECL const char* name( | |||||
| 82 | ) const noexcept override; | 82 | ) const noexcept override; | |||||
| 83 | BOOST_HTTP_DECL std::string message( | 83 | BOOST_HTTP_DECL std::string message( | |||||
| 84 | int) const override; | 84 | int) const override; | |||||
| 85 | BOOST_HTTP_DECL char const* message( | 85 | BOOST_HTTP_DECL char const* message( | |||||
| 86 | int, char*, std::size_t | 86 | int, char*, std::size_t | |||||
| 87 | ) const noexcept override; | 87 | ) const noexcept override; | |||||
| 88 | BOOST_HTTP_DECL bool equivalent( | 88 | BOOST_HTTP_DECL bool equivalent( | |||||
| 89 | system::error_code const&, int | 89 | system::error_code const&, int | |||||
| 90 | ) const noexcept override; | 90 | ) const noexcept override; | |||||
| 91 | BOOST_SYSTEM_CONSTEXPR condition_cat_type() | 91 | BOOST_SYSTEM_CONSTEXPR condition_cat_type() | |||||
| 92 | : error_category(0xa36e10f16c666a7) | 92 | : error_category(0xa36e10f16c666a7) | |||||
| 93 | { | 93 | { | |||||
| 94 | } | 94 | } | |||||
| 95 | }; | 95 | }; | |||||
| 96 | 96 | |||||||
| 97 | BOOST_HTTP_DECL extern | 97 | BOOST_HTTP_DECL extern | |||||
| 98 | error_cat_type error_cat; | 98 | error_cat_type error_cat; | |||||
| 99 | BOOST_HTTP_DECL extern | 99 | BOOST_HTTP_DECL extern | |||||
| 100 | condition_cat_type condition_cat; | 100 | condition_cat_type condition_cat; | |||||
| 101 | 101 | |||||||
| 102 | } // detail | 102 | } // detail | |||||
| 103 | 103 | |||||||
| 104 | inline | 104 | inline | |||||
| 105 | BOOST_SYSTEM_CONSTEXPR | 105 | BOOST_SYSTEM_CONSTEXPR | |||||
| 106 | system::error_code | 106 | system::error_code | |||||
| HITCBC | 107 | 120196 | make_error_code( | 107 | 120206 | make_error_code( | ||
| 108 | error ev) noexcept | 108 | error ev) noexcept | |||||
| 109 | { | 109 | { | |||||
| 110 | return system::error_code{ | 110 | return system::error_code{ | |||||
| 111 | static_cast<std::underlying_type< | 111 | static_cast<std::underlying_type< | |||||
| 112 | error>::type>(ev), | 112 | error>::type>(ev), | |||||
| HITCBC | 113 | 120196 | detail::error_cat}; | 113 | 120206 | detail::error_cat}; | ||
| 114 | } | 114 | } | |||||
| 115 | 115 | |||||||
| 116 | inline | 116 | inline | |||||
| 117 | BOOST_SYSTEM_CONSTEXPR | 117 | BOOST_SYSTEM_CONSTEXPR | |||||
| 118 | system::error_condition | 118 | system::error_condition | |||||
| HITCBC | 119 | 149266 | make_error_condition( | 119 | 149275 | make_error_condition( | ||
| 120 | condition c) noexcept | 120 | condition c) noexcept | |||||
| 121 | { | 121 | { | |||||
| HITCBC | 122 | 149266 | return system::error_condition{ | 122 | 149275 | return system::error_condition{ | ||
| 123 | static_cast<std::underlying_type< | 123 | static_cast<std::underlying_type< | |||||
| 124 | condition>::type>(c), | 124 | condition>::type>(c), | |||||
| HITCBC | 125 | 149266 | detail::condition_cat}; | 125 | 149275 | detail::condition_cat}; | ||
| 126 | } | 126 | } | |||||
| 127 | 127 | |||||||
| 128 | } // http | 128 | } // http | |||||
| 129 | } // boost | 129 | } // boost | |||||
| 130 | 130 | |||||||
| 131 | #endif | 131 | #endif | |||||