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 : #include <boost/beast2/server/router_types.hpp>
11 : #include <boost/http_proto/string_body.hpp>
12 : #include <boost/assert.hpp>
13 : #include <cstring>
14 :
15 : namespace boost {
16 : namespace beast2 {
17 :
18 : namespace detail {
19 :
20 : const char*
21 0 : route_cat_type::
22 : name() const noexcept
23 : {
24 0 : return "boost.http_proto.route";
25 : }
26 :
27 : std::string
28 290 : route_cat_type::
29 : message(int code) const
30 : {
31 580 : return message(code, nullptr, 0);
32 : }
33 :
34 : char const*
35 290 : route_cat_type::
36 : message(
37 : int code,
38 : char*,
39 : std::size_t) const noexcept
40 : {
41 290 : switch(static_cast<route>(code))
42 : {
43 2 : case route::close: return "http_proto::route::close";
44 2 : case route::complete: return "http_proto::route::complete";
45 4 : case route::detach: return "http_proto::route::detach";
46 96 : case route::next: return "http_proto::route::next";
47 0 : case route::next_route: return "http_proto::route::next_route";
48 186 : case route::send: return "http_proto::route::send";
49 0 : default:
50 0 : return "http_proto::route::?";
51 : }
52 : }
53 :
54 : // msvc 14.0 has a bug that warns about inability
55 : // to use constexpr construction here, even though
56 : // there's no constexpr construction
57 : #if defined(_MSC_VER) && _MSC_VER <= 1900
58 : # pragma warning( push )
59 : # pragma warning( disable : 4592 )
60 : #endif
61 :
62 : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
63 : constinit route_cat_type route_cat;
64 : #else
65 : route_cat_type route_cat;
66 : #endif
67 :
68 : #if defined(_MSC_VER) && _MSC_VER <= 1900
69 : # pragma warning( pop )
70 : #endif
71 :
72 : } // detail
73 :
74 : } // beast2
75 : } // boost
|