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