include/boost/http/zstd/impl/error.hpp

100.0% Lines (3/0/3) 100.0% List of functions (1/0/1)
error.hpp
f(x) Functions (1)
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 <system_error>
16
17 namespace std {
18 template<>
19 struct is_error_code_enum<
20 ::boost::http::zstd::error>
21 : std::true_type {};
22 } // std
23
24 namespace boost {
25 namespace http {
26 namespace zstd {
27
28 namespace detail {
29
30 struct BOOST_SYMBOL_VISIBLE
31 error_cat_type
32 : std::error_category
33 {
34 BOOST_HTTP_DECL const char* name(
35 ) const noexcept override;
36 BOOST_HTTP_DECL std::string message(
37 int) const override;
38 constexpr error_cat_type() noexcept = default;
39 };
40
41 BOOST_HTTP_DECL extern
42 error_cat_type error_cat;
43
44 } // detail
45
46 inline
47 std::error_code
48 5x make_error_code(
49 error ev) noexcept
50 {
51 5x return std::error_code{
52 static_cast<std::underlying_type<
53 error>::type>(ev),
54 5x detail::error_cat};
55 }
56
57 } // zstd
58 } // http
59 } // boost
60
61 #endif
62