100.00% Lines (3/3) 100.00% Functions (1/1)
TLA Baseline Branch
Line Hits Code Line Hits Code
1   // 1   //
2   // Copyright (c) 2026 Mohammad Nejati 2   // Copyright (c) 2026 Mohammad Nejati
3   // 3   //
4   // Distributed under the Boost Software License, Version 1.0. (See accompanying 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) 5   // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6   // 6   //
7   // Official repository: https://github.com/cppalliance/http 7   // Official repository: https://github.com/cppalliance/http
8   // 8   //
9   9  
10   #ifndef BOOST_HTTP_ZSTD_IMPL_ERROR_HPP 10   #ifndef BOOST_HTTP_ZSTD_IMPL_ERROR_HPP
11   #define BOOST_HTTP_ZSTD_IMPL_ERROR_HPP 11   #define BOOST_HTTP_ZSTD_IMPL_ERROR_HPP
12   12  
13   #include <boost/http/detail/config.hpp> 13   #include <boost/http/detail/config.hpp>
14   14  
15   #include <system_error> 15   #include <system_error>
16   16  
17   namespace std { 17   namespace std {
18   template<> 18   template<>
19   struct is_error_code_enum< 19   struct is_error_code_enum<
20   ::boost::http::zstd::error> 20   ::boost::http::zstd::error>
21   : std::true_type {}; 21   : std::true_type {};
22   } // std 22   } // std
23   23  
24   namespace boost { 24   namespace boost {
25   namespace http { 25   namespace http {
26   namespace zstd { 26   namespace zstd {
27   27  
28   namespace detail { 28   namespace detail {
29   29  
30   struct BOOST_SYMBOL_VISIBLE 30   struct BOOST_SYMBOL_VISIBLE
31   error_cat_type 31   error_cat_type
32   : std::error_category 32   : std::error_category
33   { 33   {
34   BOOST_HTTP_DECL const char* name( 34   BOOST_HTTP_DECL const char* name(
35   ) const noexcept override; 35   ) const noexcept override;
36   BOOST_HTTP_DECL std::string message( 36   BOOST_HTTP_DECL std::string message(
37   int) const override; 37   int) const override;
38   constexpr error_cat_type() noexcept = default; 38   constexpr error_cat_type() noexcept = default;
39   }; 39   };
40   40  
41   BOOST_HTTP_DECL extern 41   BOOST_HTTP_DECL extern
42   error_cat_type error_cat; 42   error_cat_type error_cat;
43   43  
44   } // detail 44   } // detail
45   45  
46   inline 46   inline
47   std::error_code 47   std::error_code
HITCBC 48   5 make_error_code( 48   5 make_error_code(
49   error ev) noexcept 49   error ev) noexcept
50   { 50   {
HITCBC 51   5 return std::error_code{ 51   5 return std::error_code{
52   static_cast<std::underlying_type< 52   static_cast<std::underlying_type<
53   error>::type>(ev), 53   error>::type>(ev),
HITCBC 54   5 detail::error_cat}; 54   5 detail::error_cat};
55   } 55   }
56   56  
57   } // zstd 57   } // zstd
58   } // http 58   } // http
59   } // boost 59   } // boost
60   60  
61   #endif 61   #endif