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