100.00% Lines (3/3)
100.00% Functions (1/1)
| 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 | // Copyright (c) 2024 Mohammad Nejati | 3 | // Copyright (c) 2024 Mohammad Nejati | |||||
| 4 | // | 4 | // | |||||
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||||
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 7 | // | 7 | // | |||||
| 8 | // Official repository: https://github.com/cppalliance/http | 8 | // Official repository: https://github.com/cppalliance/http | |||||
| 9 | // | 9 | // | |||||
| 10 | 10 | |||||||
| 11 | #ifndef BOOST_HTTP_ZLIB_IMPL_ERROR_HPP | 11 | #ifndef BOOST_HTTP_ZLIB_IMPL_ERROR_HPP | |||||
| 12 | #define BOOST_HTTP_ZLIB_IMPL_ERROR_HPP | 12 | #define BOOST_HTTP_ZLIB_IMPL_ERROR_HPP | |||||
| 13 | 13 | |||||||
| 14 | #include <boost/http/detail/config.hpp> | 14 | #include <boost/http/detail/config.hpp> | |||||
| 15 | - | #include <boost/system/error_category.hpp> | ||||||
| 16 | - | #include <boost/system/is_error_code_enum.hpp> | ||||||
| 17 | 15 | |||||||
| 18 | #include <system_error> | 16 | #include <system_error> | |||||
| 19 | - | namespace boost { | ||||||
| 20 | - | |||||||
| 21 | - | namespace system { | ||||||
| 22 | - | template<> | ||||||
| 23 | - | struct is_error_code_enum< | ||||||
| 24 | - | ::boost::http::zlib::error> | ||||||
| 25 | - | { | ||||||
| 26 | - | static bool const value = true; | ||||||
| 27 | - | }; | ||||||
| 28 | - | } // system | ||||||
| 29 | - | } // boost | ||||||
| 30 | - | |||||||
| 31 | 17 | |||||||
| 32 | namespace std { | 18 | namespace std { | |||||
| 33 | template<> | 19 | template<> | |||||
| 34 | struct is_error_code_enum< | 20 | struct is_error_code_enum< | |||||
| 35 | ::boost::http::zlib::error> | 21 | ::boost::http::zlib::error> | |||||
| 36 | : std::true_type {}; | 22 | : std::true_type {}; | |||||
| 37 | } // std | 23 | } // std | |||||
| 38 | 24 | |||||||
| 39 | namespace boost { | 25 | namespace boost { | |||||
| 40 | namespace http { | 26 | namespace http { | |||||
| 41 | namespace zlib { | 27 | namespace zlib { | |||||
| 42 | 28 | |||||||
| 43 | namespace detail { | 29 | namespace detail { | |||||
| 44 | 30 | |||||||
| 45 | struct BOOST_SYMBOL_VISIBLE | 31 | struct BOOST_SYMBOL_VISIBLE | |||||
| 46 | error_cat_type | 32 | error_cat_type | |||||
| 47 | - | : system::error_category | 33 | + | : std::error_category | |||
| 48 | { | 34 | { | |||||
| 49 | BOOST_HTTP_DECL const char* name( | 35 | BOOST_HTTP_DECL const char* name( | |||||
| 50 | - | BOOST_HTTP_DECL bool failed( | ||||||
| 51 | - | int) const noexcept override; | ||||||
| 52 | ) const noexcept override; | 36 | ) const noexcept override; | |||||
| 53 | BOOST_HTTP_DECL std::string message( | 37 | BOOST_HTTP_DECL std::string message( | |||||
| 54 | int) const override; | 38 | int) const override; | |||||
| 55 | - | BOOST_HTTP_DECL char const* message( | 39 | + | constexpr error_cat_type() noexcept = default; | |||
| 56 | - | int, char*, std::size_t | ||||||
| 57 | - | ) const noexcept override; | ||||||
| 58 | - | BOOST_SYSTEM_CONSTEXPR error_cat_type() | ||||||
| 59 | - | : error_category(0x43fd42f819852b73) | ||||||
| 60 | - | { | ||||||
| 61 | - | } | ||||||
| 62 | }; | 40 | }; | |||||
| 63 | 41 | |||||||
| 64 | BOOST_HTTP_DECL extern | 42 | BOOST_HTTP_DECL extern | |||||
| 65 | error_cat_type error_cat; | 43 | error_cat_type error_cat; | |||||
| 66 | 44 | |||||||
| 67 | } // detail | 45 | } // detail | |||||
| 68 | 46 | |||||||
| 69 | inline | 47 | inline | |||||
| 70 | - | BOOST_SYSTEM_CONSTEXPR | 48 | + | std::error_code | |||
| 71 | - | system::error_code | ||||||
| HITCBC | 72 | 1 | make_error_code( | 49 | 1 | make_error_code( | ||
| 73 | error ev) noexcept | 50 | error ev) noexcept | |||||
| 74 | { | 51 | { | |||||
| HITGIC | 75 | - | return system::error_code{ | 52 | + | 1 | return std::error_code{ | |
| 76 | static_cast<std::underlying_type< | 53 | static_cast<std::underlying_type< | |||||
| 77 | error>::type>(ev), | 54 | error>::type>(ev), | |||||
| HITCBC | 78 | 1 | detail::error_cat}; | 55 | 1 | detail::error_cat}; | ||
| 79 | } | 56 | } | |||||
| 80 | 57 | |||||||
| 81 | } // zlib | 58 | } // zlib | |||||
| 82 | } // http | 59 | } // http | |||||
| 83 | } // boost | 60 | } // boost | |||||
| 84 | 61 | |||||||
| 85 | #endif | 62 | #endif | |||||