100.00% Lines (2/2)
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_BROTLI_IMPL_ERROR_HPP | 11 | #ifndef BOOST_HTTP_BROTLI_IMPL_ERROR_HPP | |||||
| 12 | #define BOOST_HTTP_BROTLI_IMPL_ERROR_HPP | 12 | #define BOOST_HTTP_BROTLI_IMPL_ERROR_HPP | |||||
| 13 | 13 | |||||||
| 14 | #include <boost/http/detail/config.hpp> | 14 | #include <boost/http/detail/config.hpp> | |||||
| 15 | 15 | |||||||
| 16 | + | #include <boost/system/error_category.hpp> | ||||||
| 17 | + | #include <boost/system/is_error_code_enum.hpp> | ||||||
| 16 | #include <system_error> | 18 | #include <system_error> | |||||
| 17 | 19 | |||||||
| 20 | + | namespace boost { | ||||||
| 21 | + | |||||||
| 22 | + | namespace system { | ||||||
| 23 | + | template<> | ||||||
| 24 | + | struct is_error_code_enum< | ||||||
| 25 | + | ::boost::http::brotli::error> | ||||||
| 26 | + | { | ||||||
| 27 | + | static bool const value = true; | ||||||
| 28 | + | }; | ||||||
| 29 | + | } // system | ||||||
| 30 | + | } // boost | ||||||
| 31 | + | |||||||
| 18 | namespace std { | 32 | namespace std { | |||||
| 19 | template<> | 33 | template<> | |||||
| 20 | struct is_error_code_enum< | 34 | struct is_error_code_enum< | |||||
| 21 | ::boost::http::brotli::error> | 35 | ::boost::http::brotli::error> | |||||
| 22 | : std::true_type {}; | 36 | : std::true_type {}; | |||||
| 23 | } // std | 37 | } // std | |||||
| 24 | 38 | |||||||
| 25 | namespace boost { | 39 | namespace boost { | |||||
| 26 | namespace http { | 40 | namespace http { | |||||
| 27 | namespace brotli { | 41 | namespace brotli { | |||||
| 28 | 42 | |||||||
| 29 | namespace detail { | 43 | namespace detail { | |||||
| 30 | 44 | |||||||
| 31 | struct BOOST_SYMBOL_VISIBLE | 45 | struct BOOST_SYMBOL_VISIBLE | |||||
| 32 | error_cat_type | 46 | error_cat_type | |||||
| 33 | - | : std::error_category | 47 | + | : system::error_category | |||
| 34 | { | 48 | { | |||||
| 35 | BOOST_HTTP_DECL const char* name( | 49 | BOOST_HTTP_DECL const char* name( | |||||
| 36 | ) const noexcept override; | 50 | ) const noexcept override; | |||||
| 51 | + | BOOST_HTTP_DECL bool failed( | ||||||
| 52 | + | int) const noexcept override; | ||||||
| 37 | BOOST_HTTP_DECL std::string message( | 53 | BOOST_HTTP_DECL std::string message( | |||||
| 38 | int) const override; | 54 | int) const override; | |||||
| 39 | - | constexpr error_cat_type() noexcept = default; | 55 | + | BOOST_HTTP_DECL char const* message( | |||
| 56 | + | int, char*, std::size_t | ||||||
| 57 | + | ) const noexcept override; | ||||||
| 58 | + | BOOST_SYSTEM_CONSTEXPR error_cat_type() | ||||||
| 59 | + | : error_category(0xc38951ab8832fb6f) | ||||||
| 60 | + | { | ||||||
| 61 | + | } | ||||||
| 40 | }; | 62 | }; | |||||
| 41 | 63 | |||||||
| 42 | BOOST_HTTP_DECL extern | 64 | BOOST_HTTP_DECL extern | |||||
| 43 | error_cat_type error_cat; | 65 | error_cat_type error_cat; | |||||
| 44 | 66 | |||||||
| 45 | } // detail | 67 | } // detail | |||||
| 46 | 68 | |||||||
| 47 | inline | 69 | inline | |||||
| 48 | - | std::error_code | 70 | + | BOOST_SYSTEM_CONSTEXPR | |||
| 71 | + | system::error_code | ||||||
| HITCBC | 49 | 1 | make_error_code( | 72 | 1 | make_error_code( | ||
| 50 | error ev) noexcept | 73 | error ev) noexcept | |||||
| 51 | { | 74 | { | |||||
| ECB | 52 | - | 1 | return std::error_code{ | 75 | + | return system::error_code{ | |
| 53 | static_cast<std::underlying_type< | 76 | static_cast<std::underlying_type< | |||||
| 54 | error>::type>(ev), | 77 | error>::type>(ev), | |||||
| HITCBC | 55 | 1 | detail::error_cat}; | 78 | 1 | detail::error_cat}; | ||
| 56 | } | 79 | } | |||||
| 57 | 80 | |||||||
| 58 | } // brotli | 81 | } // brotli | |||||
| 59 | } // http | 82 | } // http | |||||
| 60 | } // boost | 83 | } // boost | |||||
| 61 | 84 | |||||||
| 62 | #endif | 85 | #endif | |||||