100.00% Lines (6/6)
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 | - | #include <boost/core/detail/string_view.hpp> | ||||||
| 13 | - | #include <boost/system/error_category.hpp> | ||||||
| 14 | - | #include <boost/system/is_error_code_enum.hpp> | ||||||
| 15 | - | #include <boost/system/is_error_condition_enum.hpp> | ||||||
| 16 | 12 | |||||||
| 17 | #include <system_error> | 13 | #include <system_error> | |||||
| 18 | - | namespace boost { | ||||||
| 19 | - | |||||||
| 20 | - | namespace system { | ||||||
| 21 | - | |||||||
| 22 | - | template<> | ||||||
| 23 | - | struct is_error_code_enum< | ||||||
| 24 | - | ::boost::http::error> | ||||||
| 25 | - | { | ||||||
| 26 | - | static bool const value = true; | ||||||
| 27 | - | }; | ||||||
| 28 | - | |||||||
| 29 | - | template<> | ||||||
| 30 | - | struct is_error_condition_enum< | ||||||
| 31 | - | ::boost::http::condition> | ||||||
| 32 | - | { | ||||||
| 33 | - | static bool const value = true; | ||||||
| 34 | - | }; | ||||||
| 35 | - | |||||||
| 36 | - | } // system | ||||||
| 37 | - | } // boost | ||||||
| 38 | - | |||||||
| 39 | 14 | |||||||
| 40 | namespace std { | 15 | namespace std { | |||||
| 41 | template<> | 16 | template<> | |||||
| 42 | struct is_error_code_enum< | 17 | struct is_error_code_enum< | |||||
| 43 | ::boost::http::error> | 18 | ::boost::http::error> | |||||
| 44 | : std::true_type {}; | 19 | : std::true_type {}; | |||||
| 45 | 20 | |||||||
| 46 | template<> | 21 | template<> | |||||
| 47 | struct is_error_condition_enum< | 22 | struct is_error_condition_enum< | |||||
| 48 | ::boost::http::condition> | 23 | ::boost::http::condition> | |||||
| 49 | : std::true_type {}; | 24 | : std::true_type {}; | |||||
| 50 | } // std | 25 | } // std | |||||
| 51 | 26 | |||||||
| 52 | namespace boost { | 27 | namespace boost { | |||||
| 53 | 28 | |||||||
| 54 | //----------------------------------------------- | 29 | //----------------------------------------------- | |||||
| 55 | 30 | |||||||
| 56 | namespace http { | 31 | namespace http { | |||||
| 57 | 32 | |||||||
| 58 | namespace detail { | 33 | namespace detail { | |||||
| 59 | 34 | |||||||
| 60 | struct BOOST_HTTP_SYMBOL_VISIBLE | 35 | struct BOOST_HTTP_SYMBOL_VISIBLE | |||||
| 61 | error_cat_type | 36 | error_cat_type | |||||
| 62 | - | : system::error_category | 37 | + | : std::error_category | |||
| 63 | { | 38 | { | |||||
| 64 | BOOST_HTTP_DECL const char* name( | 39 | BOOST_HTTP_DECL const char* name( | |||||
| 65 | ) const noexcept override; | 40 | ) const noexcept override; | |||||
| 66 | BOOST_HTTP_DECL std::string message( | 41 | BOOST_HTTP_DECL std::string message( | |||||
| 67 | int) const override; | 42 | int) const override; | |||||
| 68 | - | BOOST_HTTP_DECL char const* message( | 43 | + | constexpr error_cat_type() noexcept = default; | |||
| 69 | - | int, char*, std::size_t | ||||||
| 70 | - | ) const noexcept override; | ||||||
| 71 | - | BOOST_SYSTEM_CONSTEXPR error_cat_type() | ||||||
| 72 | - | : error_category(0x3663257e7585fbfd) | ||||||
| 73 | - | { | ||||||
| 74 | - | } | ||||||
| 75 | }; | 44 | }; | |||||
| 76 | 45 | |||||||
| 77 | struct BOOST_HTTP_SYMBOL_VISIBLE | 46 | struct BOOST_HTTP_SYMBOL_VISIBLE | |||||
| 78 | condition_cat_type | 47 | condition_cat_type | |||||
| 79 | - | : system::error_category | 48 | + | : std::error_category | |||
| 80 | { | 49 | { | |||||
| 81 | BOOST_HTTP_DECL const char* name( | 50 | BOOST_HTTP_DECL const char* name( | |||||
| 82 | ) const noexcept override; | 51 | ) const noexcept override; | |||||
| 83 | BOOST_HTTP_DECL std::string message( | 52 | BOOST_HTTP_DECL std::string message( | |||||
| 84 | - | BOOST_HTTP_DECL char const* message( | ||||||
| 85 | - | int, char*, std::size_t | ||||||
| 86 | - | ) const noexcept override; | ||||||
| 87 | int) const override; | 53 | int) const override; | |||||
| 88 | BOOST_HTTP_DECL bool equivalent( | 54 | BOOST_HTTP_DECL bool equivalent( | |||||
| 89 | - | system::error_code const&, int | 55 | + | std::error_code const&, int | |||
| 90 | ) const noexcept override; | 56 | ) const noexcept override; | |||||
| 91 | - | BOOST_SYSTEM_CONSTEXPR condition_cat_type() | 57 | + | constexpr condition_cat_type() noexcept = default; | |||
| 92 | - | : error_category(0xa36e10f16c666a7) | ||||||
| 93 | - | { | ||||||
| 94 | - | } | ||||||
| 95 | }; | 58 | }; | |||||
| 96 | 59 | |||||||
| 97 | BOOST_HTTP_DECL extern | 60 | BOOST_HTTP_DECL extern | |||||
| 98 | error_cat_type error_cat; | 61 | error_cat_type error_cat; | |||||
| 99 | BOOST_HTTP_DECL extern | 62 | BOOST_HTTP_DECL extern | |||||
| 100 | condition_cat_type condition_cat; | 63 | condition_cat_type condition_cat; | |||||
| 101 | 64 | |||||||
| 102 | } // detail | 65 | } // detail | |||||
| 103 | 66 | |||||||
| 104 | inline | 67 | inline | |||||
| 105 | - | BOOST_SYSTEM_CONSTEXPR | 68 | + | std::error_code | |||
| 106 | - | system::error_code | ||||||
| HITCBC | 107 | 120678 | make_error_code( | 69 | 120678 | make_error_code( | ||
| 108 | error ev) noexcept | 70 | error ev) noexcept | |||||
| 109 | { | 71 | { | |||||
| HITGIC | 110 | - | return system::error_code{ | 72 | + | 120678 | return std::error_code{ | |
| 111 | static_cast<std::underlying_type< | 73 | static_cast<std::underlying_type< | |||||
| 112 | error>::type>(ev), | 74 | error>::type>(ev), | |||||
| HITCBC | 113 | 120678 | detail::error_cat}; | 75 | 120678 | detail::error_cat}; | ||
| 114 | } | 76 | } | |||||
| 115 | 77 | |||||||
| 116 | inline | 78 | inline | |||||
| 117 | - | BOOST_SYSTEM_CONSTEXPR | 79 | + | std::error_condition | |||
| 118 | - | system::error_condition | ||||||
| HITCBC | 119 | 154847 | make_error_condition( | 80 | 154847 | make_error_condition( | ||
| 120 | condition c) noexcept | 81 | condition c) noexcept | |||||
| 121 | { | 82 | { | |||||
| HITCBC | 122 | - | 154847 | return system::error_condition{ | 83 | + | 154847 | return std::error_condition{ |
| 123 | static_cast<std::underlying_type< | 84 | static_cast<std::underlying_type< | |||||
| 124 | condition>::type>(c), | 85 | condition>::type>(c), | |||||
| HITCBC | 125 | 154847 | detail::condition_cat}; | 86 | 154847 | detail::condition_cat}; | ||
| 126 | } | 87 | } | |||||
| 127 | 88 | |||||||
| 128 | } // http | 89 | } // http | |||||
| 129 | } // boost | 90 | } // boost | |||||
| 130 | 91 | |||||||
| 131 | #endif | 92 | #endif | |||||