Toolbox
snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
toolbox
http
Types.hpp
Go to the documentation of this file.
1
// The Reactive C++ Toolbox.
2
// Copyright (C) 2013-2019 Swirly Cloud Limited
3
// Copyright (C) 2022 Reactive Markets Limited
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
17
#ifndef TOOLBOX_HTTP_TYPES_HPP
18
#define TOOLBOX_HTTP_TYPES_HPP
19
20
#include <
toolbox/util/Concepts.hpp
>
21
22
#include <toolbox/contrib/http_parser.h>
23
24
#include <iostream>
25
26
namespace
toolbox
{
27
inline
namespace
http {
28
29
enum class
First
:
bool
{
No
=
false
,
Yes
=
true
};
30
31
enum class
NoCache
:
bool
{
No
=
false
,
Yes
=
true
};
32
33
enum class
Method
:
int
{
34
Delete
=
HTTP_DELETE
,
35
Get
=
HTTP_GET
,
36
Head
=
HTTP_HEAD
,
37
Post
=
HTTP_POST
,
38
Put
=
HTTP_PUT
,
39
Connect
=
HTTP_CONNECT
,
40
Options
=
HTTP_OPTIONS
,
41
Trace
=
HTTP_TRACE
,
42
Copy
=
HTTP_COPY
,
43
Lock
=
HTTP_LOCK
,
44
MkCol
=
HTTP_MKCOL
,
45
Move
=
HTTP_MOVE
,
46
PropFind
=
HTTP_PROPFIND
,
47
PropPatch
=
HTTP_PROPPATCH
,
48
Search
=
HTTP_SEARCH
,
49
Unlock
=
HTTP_UNLOCK
,
50
Bind
=
HTTP_BIND
,
51
Rebind
=
HTTP_REBIND
,
52
Unbind
=
HTTP_UNBIND
,
53
Acl
=
HTTP_ACL
,
54
Report
=
HTTP_REPORT
,
55
MkActivity
=
HTTP_MKACTIVITY
,
56
Checkout
=
HTTP_CHECKOUT
,
57
Merge
=
HTTP_MERGE
,
58
MSearch
=
HTTP_MSEARCH
,
59
Notify
=
HTTP_NOTIFY
,
60
Subscribe
=
HTTP_SUBSCRIBE
,
61
Unsubscribe
=
HTTP_UNSUBSCRIBE
,
62
Patch
=
HTTP_PATCH
,
63
Purge
=
HTTP_PURGE
,
64
MkCalendar
=
HTTP_MKCALENDAR
,
65
Link
=
HTTP_LINK
,
66
Unlink
=
HTTP_UNLINK
,
67
Source
=
HTTP_SOURCE
68
};
69
70
inline
const
char
*
enum_string
(
Method
method)
noexcept
71
{
72
return
http_method_str
(
static_cast<
http_method
>
(method));
73
}
74
75
template
<
typename
StreamT>
76
requires
Streamable<StreamT>
77
StreamT
&
operator<<
(
StreamT
& os,
Method
method)
78
{
79
os <<
enum_string
(method);
80
return
os;
81
}
82
83
enum class
Status
:
int
{
84
Ok
=
HTTP_STATUS_OK
,
85
NoContent
=
HTTP_STATUS_NO_CONTENT
,
86
BadRequest
=
HTTP_STATUS_BAD_REQUEST
,
87
Unauthorized
=
HTTP_STATUS_UNAUTHORIZED
,
88
Forbidden
=
HTTP_STATUS_FORBIDDEN
,
89
NotFound
=
HTTP_STATUS_NOT_FOUND
,
90
MethodNotAllowed
=
HTTP_STATUS_METHOD_NOT_ALLOWED
,
91
RequestTimeout
=
HTTP_STATUS_REQUEST_TIMEOUT
,
92
InternalServerError
=
HTTP_STATUS_INTERNAL_SERVER_ERROR
,
93
ServiceUnavailable
=
HTTP_STATUS_SERVICE_UNAVAILABLE
94
};
95
96
TOOLBOX_API
const
char
*
enum_string
(
Status
status
)
noexcept
;
97
98
template
<
typename
StreamT>
99
requires
Streamable<StreamT>
100
StreamT
&
operator<<
(
StreamT
& os,
Status
status
)
101
{
102
os << static_cast<int>
(
status
);
103
return
os;
104
}
105
106
enum class
Type
:
int
{
Request
=
HTTP_REQUEST
,
Response
=
HTTP_RESPONSE
};
107
108
}
// namespace http
109
}
// namespace toolbox
110
111
#endif
// TOOLBOX_HTTP_TYPES_HPP
Concepts.hpp
TOOLBOX_API
#define TOOLBOX_API
Definition
Config.h:39
toolbox::Request
Definition
Request.hpp:29
toolbox::Options
Definition
Options.hpp:121
std::operator<<
ostream & operator<<(ostream &os, const pair< T, U > &p)
Definition
Parser.ut.cpp:29
toolbox::http::First
First
Definition
Types.hpp:29
toolbox::http::First::Yes
@ Yes
toolbox::http::First::No
@ No
toolbox::http::NoCache
NoCache
Definition
Types.hpp:31
toolbox::http::Method
Method
Definition
Types.hpp:33
toolbox::http::Method::MkCol
@ MkCol
toolbox::http::Method::Post
@ Post
toolbox::http::Method::Bind
@ Bind
toolbox::http::Method::Search
@ Search
toolbox::http::Method::Patch
@ Patch
toolbox::http::Method::PropFind
@ PropFind
toolbox::http::Method::Rebind
@ Rebind
toolbox::http::Method::MSearch
@ MSearch
toolbox::http::Method::Unsubscribe
@ Unsubscribe
toolbox::http::Method::Connect
@ Connect
toolbox::http::Method::Report
@ Report
toolbox::http::Method::Unbind
@ Unbind
toolbox::http::Method::Copy
@ Copy
toolbox::http::Method::Merge
@ Merge
toolbox::http::Method::Move
@ Move
toolbox::http::Method::Checkout
@ Checkout
toolbox::http::Method::MkActivity
@ MkActivity
toolbox::http::Method::Unlock
@ Unlock
toolbox::http::Method::Link
@ Link
toolbox::http::Method::Head
@ Head
toolbox::http::Method::Notify
@ Notify
toolbox::http::Method::Subscribe
@ Subscribe
toolbox::http::Method::Lock
@ Lock
toolbox::http::Method::Unlink
@ Unlink
toolbox::http::Method::Get
@ Get
toolbox::http::Method::PropPatch
@ PropPatch
toolbox::http::Method::Put
@ Put
toolbox::http::Method::Purge
@ Purge
toolbox::http::Method::Acl
@ Acl
toolbox::http::Method::Trace
@ Trace
toolbox::http::Method::Delete
@ Delete
toolbox::http::Method::Source
@ Source
toolbox::http::Method::MkCalendar
@ MkCalendar
toolbox::http::Status
Status
Definition
Types.hpp:83
toolbox::http::Status::ServiceUnavailable
@ ServiceUnavailable
toolbox::http::Status::RequestTimeout
@ RequestTimeout
toolbox::http::Status::NotFound
@ NotFound
toolbox::http::Status::Forbidden
@ Forbidden
toolbox::http::Status::MethodNotAllowed
@ MethodNotAllowed
toolbox::http::Status::BadRequest
@ BadRequest
toolbox::http::Status::Ok
@ Ok
toolbox::http::Status::NoContent
@ NoContent
toolbox::http::Status::Unauthorized
@ Unauthorized
toolbox::http::Status::InternalServerError
@ InternalServerError
toolbox::http::enum_string
const char * enum_string(Status status) noexcept
Definition
Types.cpp:22
toolbox::http::Type
Type
Definition
Types.hpp:106
toolbox::http::Type::Response
@ Response
toolbox::util::bind
constexpr auto bind() noexcept
Definition
Slot.hpp:92
toolbox
Definition
Benchmark.cpp:26
Generated by
1.9.8