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