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/contrib/http_parser.h>
21
22
#include <iostream>
23
24
namespace
toolbox
{
25
inline
namespace
http {
26
27
enum class
First
:
bool
{
No
=
false
,
Yes
=
true
};
28
29
enum class
NoCache
:
bool
{
No
=
false
,
Yes
=
true
};
30
31
enum class
Method
:
int
{
32
Delete
=
HTTP_DELETE
,
33
Get
=
HTTP_GET
,
34
Head
=
HTTP_HEAD
,
35
Post
=
HTTP_POST
,
36
Put
=
HTTP_PUT
,
37
Connect
=
HTTP_CONNECT
,
38
Options
=
HTTP_OPTIONS
,
39
Trace
=
HTTP_TRACE
,
40
Copy
=
HTTP_COPY
,
41
Lock
=
HTTP_LOCK
,
42
MkCol
=
HTTP_MKCOL
,
43
Move
=
HTTP_MOVE
,
44
PropFind
=
HTTP_PROPFIND
,
45
PropPatch
=
HTTP_PROPPATCH
,
46
Search
=
HTTP_SEARCH
,
47
Unlock
=
HTTP_UNLOCK
,
48
Bind
=
HTTP_BIND
,
49
Rebind
=
HTTP_REBIND
,
50
Unbind
=
HTTP_UNBIND
,
51
Acl
=
HTTP_ACL
,
52
Report
=
HTTP_REPORT
,
53
MkActivity
=
HTTP_MKACTIVITY
,
54
Checkout
=
HTTP_CHECKOUT
,
55
Merge
=
HTTP_MERGE
,
56
MSearch
=
HTTP_MSEARCH
,
57
Notify
=
HTTP_NOTIFY
,
58
Subscribe
=
HTTP_SUBSCRIBE
,
59
Unsubscribe
=
HTTP_UNSUBSCRIBE
,
60
Patch
=
HTTP_PATCH
,
61
Purge
=
HTTP_PURGE
,
62
MkCalendar
=
HTTP_MKCALENDAR
,
63
Link
=
HTTP_LINK
,
64
Unlink
=
HTTP_UNLINK
,
65
Source
=
HTTP_SOURCE
66
};
67
68
inline
const
char
*
enum_string
(
Method
method)
noexcept
69
{
70
return
http_method_str
(
static_cast<
http_method
>
(method));
71
}
72
73
inline
std::ostream&
operator<<
(std::ostream& os,
Method
method)
74
{
75
return
os <<
enum_string
(method);
76
}
77
78
enum class
Status
:
int
{
79
Ok
=
HTTP_STATUS_OK
,
80
NoContent
=
HTTP_STATUS_NO_CONTENT
,
81
BadRequest
=
HTTP_STATUS_BAD_REQUEST
,
82
Unauthorized
=
HTTP_STATUS_UNAUTHORIZED
,
83
Forbidden
=
HTTP_STATUS_FORBIDDEN
,
84
NotFound
=
HTTP_STATUS_NOT_FOUND
,
85
MethodNotAllowed
=
HTTP_STATUS_METHOD_NOT_ALLOWED
,
86
RequestTimeout
=
HTTP_STATUS_REQUEST_TIMEOUT
,
87
InternalServerError
=
HTTP_STATUS_INTERNAL_SERVER_ERROR
,
88
ServiceUnavailable
=
HTTP_STATUS_SERVICE_UNAVAILABLE
89
};
90
91
TOOLBOX_API
const
char
*
enum_string
(
Status
status
)
noexcept
;
92
93
inline
std::ostream&
operator<<
(std::ostream& os,
Status
status
)
94
{
95
return
os << static_cast<int>
(
status
);
96
}
97
98
enum class
Type
:
int
{
Request
=
HTTP_REQUEST
,
Response
=
HTTP_RESPONSE
};
99
100
}
// namespace http
101
}
// namespace toolbox
102
103
#endif
// TOOLBOX_HTTP_TYPES_HPP
TOOLBOX_API
#define TOOLBOX_API
Definition
Config.h:39
toolbox::Request
Definition
Request.hpp:29
toolbox::Options
Definition
Options.hpp:119
std::operator<<
ostream & operator<<(ostream &os, const pair< T, U > &p)
Definition
Parser.ut.cpp:29
toolbox::http::First
First
Definition
Types.hpp:27
toolbox::http::First::Yes
@ Yes
toolbox::http::First::No
@ No
toolbox::http::NoCache
NoCache
Definition
Types.hpp:29
toolbox::http::Method
Method
Definition
Types.hpp:31
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:78
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:98
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