TLA Line data Source code
1 : //
2 : // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
3 : // Copyright (c) 2024 Mohammad Nejati
4 : //
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)
7 : //
8 : // Official repository: https://github.com/cppalliance/http
9 : //
10 :
11 : #ifndef BOOST_HTTP_ZLIB_IMPL_ERROR_HPP
12 : #define BOOST_HTTP_ZLIB_IMPL_ERROR_HPP
13 :
14 : #include <boost/http/detail/config.hpp>
15 :
16 : #include <system_error>
17 :
18 : namespace std {
19 : template<>
20 : struct is_error_code_enum<
21 : ::boost::http::zlib::error>
22 : : std::true_type {};
23 : } // std
24 :
25 : namespace boost {
26 : namespace http {
27 : namespace zlib {
28 :
29 : namespace detail {
30 :
31 : struct BOOST_SYMBOL_VISIBLE
32 : error_cat_type
33 : : std::error_category
34 : {
35 : BOOST_HTTP_DECL const char* name(
36 : ) const noexcept override;
37 : BOOST_HTTP_DECL std::string message(
38 : int) const override;
39 : constexpr error_cat_type() noexcept = default;
40 : };
41 :
42 : BOOST_HTTP_DECL extern
43 : error_cat_type error_cat;
44 :
45 : } // detail
46 :
47 : inline
48 : std::error_code
49 HIT 1 : make_error_code(
50 : error ev) noexcept
51 : {
52 1 : return std::error_code{
53 : static_cast<std::underlying_type<
54 : error>::type>(ev),
55 1 : detail::error_cat};
56 : }
57 :
58 : } // zlib
59 : } // http
60 : } // boost
61 :
62 : #endif
|