Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.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/http_proto |
8 |
|
|
// |
9 |
|
|
|
10 |
|
|
#ifndef BOOST_HTTP_PROTO_IMPL_ERROR_HPP |
11 |
|
|
#define BOOST_HTTP_PROTO_IMPL_ERROR_HPP |
12 |
|
|
|
13 |
|
|
#include <boost/core/detail/string_view.hpp> |
14 |
|
|
#include <boost/system/error_category.hpp> |
15 |
|
|
#include <boost/system/is_error_code_enum.hpp> |
16 |
|
|
#include <boost/system/is_error_condition_enum.hpp> |
17 |
|
|
|
18 |
|
|
namespace boost { |
19 |
|
|
|
20 |
|
|
namespace system { |
21 |
|
|
|
22 |
|
|
template<> |
23 |
|
|
struct is_error_code_enum< |
24 |
|
|
::boost::http_proto::error> |
25 |
|
|
{ |
26 |
|
|
static bool const value = true; |
27 |
|
|
}; |
28 |
|
|
|
29 |
|
|
template<> |
30 |
|
|
struct is_error_condition_enum< |
31 |
|
|
::boost::http_proto::condition> |
32 |
|
|
{ |
33 |
|
|
static bool const value = true; |
34 |
|
|
}; |
35 |
|
|
|
36 |
|
|
} // system |
37 |
|
|
|
38 |
|
|
//----------------------------------------------- |
39 |
|
|
|
40 |
|
|
namespace http_proto { |
41 |
|
|
|
42 |
|
|
namespace detail { |
43 |
|
|
|
44 |
|
|
struct BOOST_SYMBOL_VISIBLE |
45 |
|
|
error_cat_type |
46 |
|
|
: system::error_category |
47 |
|
|
{ |
48 |
|
|
BOOST_HTTP_PROTO_DECL const char* name( |
49 |
|
|
) const noexcept override; |
50 |
|
|
BOOST_HTTP_PROTO_DECL std::string message( |
51 |
|
|
int) const override; |
52 |
|
|
BOOST_HTTP_PROTO_DECL char const* message( |
53 |
|
|
int, char*, std::size_t |
54 |
|
|
) const noexcept override; |
55 |
|
49 |
BOOST_SYSTEM_CONSTEXPR error_cat_type() |
56 |
|
49 |
: error_category(0x3663257e7585fbfd) |
57 |
|
|
{ |
58 |
|
49 |
} |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
|
struct BOOST_SYMBOL_VISIBLE |
62 |
|
|
condition_cat_type |
63 |
|
|
: system::error_category |
64 |
|
|
{ |
65 |
|
|
BOOST_HTTP_PROTO_DECL const char* name( |
66 |
|
|
) const noexcept override; |
67 |
|
|
BOOST_HTTP_PROTO_DECL std::string message( |
68 |
|
|
int) const override; |
69 |
|
|
BOOST_HTTP_PROTO_DECL char const* message( |
70 |
|
|
int, char*, std::size_t |
71 |
|
|
) const noexcept override; |
72 |
|
|
BOOST_HTTP_PROTO_DECL bool equivalent( |
73 |
|
|
system::error_code const&, int |
74 |
|
|
) const noexcept override; |
75 |
|
49 |
BOOST_SYSTEM_CONSTEXPR condition_cat_type() |
76 |
|
49 |
: error_category(0xa36e10f16c666a7) |
77 |
|
|
{ |
78 |
|
49 |
} |
79 |
|
|
}; |
80 |
|
|
|
81 |
|
|
BOOST_HTTP_PROTO_DECL extern |
82 |
|
|
error_cat_type error_cat; |
83 |
|
|
BOOST_HTTP_PROTO_DECL extern |
84 |
|
|
condition_cat_type condition_cat; |
85 |
|
|
|
86 |
|
|
} // detail |
87 |
|
|
|
88 |
|
|
inline |
89 |
|
|
BOOST_SYSTEM_CONSTEXPR |
90 |
|
|
system::error_code |
91 |
|
4547 |
make_error_code( |
92 |
|
|
error ev) noexcept |
93 |
|
|
{ |
94 |
|
|
return system::error_code{ |
95 |
|
|
static_cast<std::underlying_type< |
96 |
|
|
error>::type>(ev), |
97 |
|
4547 |
detail::error_cat}; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
inline |
101 |
|
|
BOOST_SYSTEM_CONSTEXPR |
102 |
|
|
system::error_condition |
103 |
|
11334 |
make_error_condition( |
104 |
|
|
condition c) noexcept |
105 |
|
|
{ |
106 |
|
11334 |
return system::error_condition{ |
107 |
|
|
static_cast<std::underlying_type< |
108 |
|
|
condition>::type>(c), |
109 |
|
11334 |
detail::condition_cat}; |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
} // http_proto |
113 |
|
|
} // boost |
114 |
|
|
|
115 |
|
|
#endif |
116 |
|
|
|