MySQL 9.0.0
Source Code Documentation
method.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_METHOD_H_
27#define ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_METHOD_H_
28
29#include <bitset>
30#include <string_view>
31
33
34namespace http {
35namespace base {
36namespace method {
37
38using key_type = int;
39using pos_type = unsigned;
40
41namespace Pos {
42
43constexpr pos_type Get = 0;
44constexpr pos_type Post = 1;
45constexpr pos_type Head = 2;
46constexpr pos_type Put = 3;
47constexpr pos_type Delete = 4;
48constexpr pos_type Options = 5;
49constexpr pos_type Trace = 6;
50constexpr pos_type Connect = 7;
51constexpr pos_type Patch = 8;
52
53constexpr pos_type _LAST = Patch;
54
55} // namespace Pos
56
57using Bitset = std::bitset<Pos::_LAST + 1>;
58
59constexpr key_type Unknown{-1};
60constexpr key_type Get{1 << Pos::Get};
61constexpr key_type Post{1 << Pos::Post};
62constexpr key_type Head{1 << Pos::Head};
63constexpr key_type Put{1 << Pos::Put};
64constexpr key_type Delete{1 << Pos::Delete};
66constexpr key_type Trace{1 << Pos::Trace};
68constexpr key_type Patch{1 << Pos::Patch};
69
70HTTP_COMMON_EXPORT key_type from_string(const std::string_view &method_name);
71HTTP_COMMON_EXPORT pos_type from_string_to_post(const std::string_view &method);
72
73} // namespace method
74} // namespace base
75} // namespace http
76
77namespace HttpMethod {
78using namespace http::base::method;
79} // namespace HttpMethod
80
81#endif // ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_METHOD_H_
A simple bitset wrapper class, whose size can be specified after the object has been defined.
Definition: ut0bitset.h:39
This class is used to trace function calls and other process information.
Definition: semisync.h:43
#define HTTP_COMMON_EXPORT
Definition: http_common_export.h:15
Definition: method.h:77
constexpr pos_type Patch
Definition: method.h:51
constexpr pos_type Get
Definition: method.h:43
constexpr pos_type Connect
Definition: method.h:50
constexpr pos_type Post
Definition: method.h:44
constexpr pos_type Head
Definition: method.h:45
constexpr pos_type Put
Definition: method.h:46
constexpr pos_type Trace
Definition: method.h:49
constexpr pos_type Options
Definition: method.h:48
constexpr pos_type Delete
Definition: method.h:47
constexpr pos_type _LAST
Definition: method.h:53
Definition: method.h:36
constexpr key_type Get
Definition: method.h:60
unsigned pos_type
Definition: method.h:39
constexpr key_type Patch
Definition: method.h:68
constexpr key_type Head
Definition: method.h:62
constexpr key_type Post
Definition: method.h:61
HTTP_COMMON_EXPORT pos_type from_string_to_post(const std::string_view &method)
Definition: method.cc:50
constexpr key_type Delete
Definition: method.h:64
constexpr key_type Put
Definition: method.h:63
constexpr key_type Connect
Definition: method.h:67
int key_type
Definition: method.h:38
constexpr key_type Unknown
Definition: method.h:59
constexpr key_type Options
Definition: method.h:65
HTTP_COMMON_EXPORT key_type from_string(const std::string_view &method_name)
Definition: method.cc:35
Definition: connection.h:56