include/boost/http/zstd/impl/error.hpp
100.0% Lines (2/0/2)
100.0% List of functions (1/0/1)
Functions (1)
Function
Calls
Lines
Blocks
boost::http::zstd::make_error_code(boost::http::zstd::error)
:71
5x
100.0%
100.0%
| Line | TLA | Hits | Source Code |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2026 Mohammad Nejati | ||
| 3 | // | ||
| 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) | ||
| 6 | // | ||
| 7 | // Official repository: https://github.com/cppalliance/http | ||
| 8 | // | ||
| 9 | |||
| 10 | #ifndef BOOST_HTTP_ZSTD_IMPL_ERROR_HPP | ||
| 11 | #define BOOST_HTTP_ZSTD_IMPL_ERROR_HPP | ||
| 12 | |||
| 13 | #include <boost/http/detail/config.hpp> | ||
| 14 | |||
| 15 | #include <boost/system/error_category.hpp> | ||
| 16 | #include <boost/system/is_error_code_enum.hpp> | ||
| 17 | #include <system_error> | ||
| 18 | |||
| 19 | namespace boost { | ||
| 20 | |||
| 21 | namespace system { | ||
| 22 | template<> | ||
| 23 | struct is_error_code_enum< | ||
| 24 | ::boost::http::zstd::error> | ||
| 25 | { | ||
| 26 | static bool const value = true; | ||
| 27 | }; | ||
| 28 | } // system | ||
| 29 | } // boost | ||
| 30 | |||
| 31 | namespace std { | ||
| 32 | template<> | ||
| 33 | struct is_error_code_enum< | ||
| 34 | ::boost::http::zstd::error> | ||
| 35 | : std::true_type {}; | ||
| 36 | } // std | ||
| 37 | |||
| 38 | namespace boost { | ||
| 39 | namespace http { | ||
| 40 | namespace zstd { | ||
| 41 | |||
| 42 | namespace detail { | ||
| 43 | |||
| 44 | struct BOOST_SYMBOL_VISIBLE | ||
| 45 | error_cat_type | ||
| 46 | : system::error_category | ||
| 47 | { | ||
| 48 | BOOST_HTTP_DECL const char* name( | ||
| 49 | ) const noexcept override; | ||
| 50 | BOOST_HTTP_DECL bool failed( | ||
| 51 | int) const noexcept override; | ||
| 52 | BOOST_HTTP_DECL std::string message( | ||
| 53 | int) const override; | ||
| 54 | BOOST_HTTP_DECL char const* message( | ||
| 55 | int, char*, std::size_t | ||
| 56 | ) const noexcept override; | ||
| 57 | BOOST_SYSTEM_CONSTEXPR error_cat_type() | ||
| 58 | : error_category(0x9971e0803a6de4e7) | ||
| 59 | { | ||
| 60 | } | ||
| 61 | }; | ||
| 62 | |||
| 63 | BOOST_HTTP_DECL extern | ||
| 64 | error_cat_type error_cat; | ||
| 65 | |||
| 66 | } // detail | ||
| 67 | |||
| 68 | inline | ||
| 69 | BOOST_SYSTEM_CONSTEXPR | ||
| 70 | system::error_code | ||
| 71 | 5x | make_error_code( | |
| 72 | error ev) noexcept | ||
| 73 | { | ||
| 74 | return system::error_code{ | ||
| 75 | static_cast<std::underlying_type< | ||
| 76 | error>::type>(ev), | ||
| 77 | 5x | detail::error_cat}; | |
| 78 | } | ||
| 79 | |||
| 80 | } // zstd | ||
| 81 | } // http | ||
| 82 | } // boost | ||
| 83 | |||
| 84 | #endif | ||
| 85 |