Line data Source code
1 : //
2 : // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
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/beast2
8 : //
9 :
10 : #ifndef BOOST_BEAST2_ERROR_HPP
11 : #define BOOST_BEAST2_ERROR_HPP
12 :
13 : #include <boost/beast2/detail/config.hpp>
14 : #include <boost/core/detail/string_view.hpp>
15 : #include <boost/system/error_category.hpp>
16 : #include <boost/system/is_error_code_enum.hpp>
17 : #include <type_traits>
18 :
19 : namespace boost {
20 : namespace beast2 {
21 :
22 : /** Error codes
23 : */
24 : enum class error
25 : {
26 : success = 0,
27 : };
28 :
29 : } // beast2
30 :
31 : namespace system {
32 : template<>
33 : struct is_error_code_enum<
34 : ::boost::beast2::error>
35 : {
36 : static bool const value = true;
37 : };
38 : } // system
39 :
40 : namespace beast2 {
41 :
42 : namespace detail {
43 : struct BOOST_SYMBOL_VISIBLE
44 : error_cat_type
45 : : system::error_category
46 : {
47 : BOOST_BEAST2_DECL const char* name(
48 : ) const noexcept override;
49 : BOOST_BEAST2_DECL std::string message(
50 : int) const override;
51 : BOOST_BEAST2_DECL char const* message(
52 : int, char*, std::size_t
53 : ) const noexcept override;
54 2 : BOOST_SYSTEM_CONSTEXPR error_cat_type()
55 2 : : error_category(0x515eb9dbd1314d96 )
56 : {
57 2 : }
58 : };
59 : BOOST_BEAST2_DECL extern error_cat_type error_cat;
60 : } // detail
61 :
62 : inline
63 : BOOST_SYSTEM_CONSTEXPR
64 : system::error_code
65 : make_error_code(
66 : error ev) noexcept
67 : {
68 : return system::error_code{
69 : static_cast<std::underlying_type<
70 : error>::type>(ev),
71 : detail::error_cat};
72 : }
73 :
74 : } // beast2
75 : } // boost
76 :
77 : #endif
|