userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
http_response_cookie.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/server/http/http_response_cookie.hpp
4
/// @brief @copybrief server::http::Cookie
5
6
#
include
<
chrono
>
7
#
include
<
memory
>
8
#
include
<
optional
>
9
#
include
<
string
>
10
#
include
<
unordered_map
>
11
12
#
include
<
userver
/
http
/
predefined_header
.
hpp
>
13
#
include
<
userver
/
utils
/
str_icase
.
hpp
>
14
15
USERVER_NAMESPACE_BEGIN
16
17
namespace
server::
http
{
18
19
/// @ingroup userver_containers
20
///
21
/// @brief HTTP response cookie
22
class
Cookie
final
{
23
public
:
24
using
CookiesMap = std::unordered_map<std::string, Cookie,
utils
::
StrCaseHash
>;
25
26
static
std::optional<Cookie> FromString(std::string_view cookie_str);
27
28
Cookie(std::string name, std::string value);
29
Cookie(Cookie&& cookie)
noexcept
;
30
Cookie(
const
Cookie& cookie);
31
~Cookie()
noexcept
;
32
33
Cookie& operator=(Cookie&&)
noexcept
;
34
Cookie& operator=(
const
Cookie& cookie);
35
36
const
std::string& Name()
const
noexcept
;
37
const
std::string& Value()
const
noexcept
;
38
39
bool
IsSecure()
const
noexcept
;
40
Cookie& SetSecure()
noexcept
;
41
42
std::chrono::system_clock::time_point Expires()
const
noexcept
;
43
Cookie& SetExpires(std::chrono::system_clock::time_point value)
noexcept
;
44
45
bool
IsPermanent()
const
noexcept
;
46
Cookie& SetPermanent();
47
48
bool
IsHttpOnly()
const
noexcept
;
49
Cookie& SetHttpOnly()
noexcept
;
50
51
const
std::string& Path()
const
noexcept
;
52
Cookie& SetPath(std::string value);
53
54
const
std::string& Domain()
const
noexcept
;
55
Cookie& SetDomain(std::string value);
56
57
std::chrono::seconds MaxAge()
const
noexcept
;
58
Cookie& SetMaxAge(std::chrono::seconds value)
noexcept
;
59
60
std::string SameSite()
const
;
61
Cookie& SetSameSite(std::string value);
62
63
std::string ToString()
const
;
64
65
void
AppendToString(USERVER_NAMESPACE::http::
headers
::HeadersString& os)
const
;
66
67
private
:
68
class
CookieData;
69
std::unique_ptr<CookieData> data_;
70
};
71
72
}
// namespace server::http
73
74
USERVER_NAMESPACE_END
userver
server
http
http_response_cookie.hpp
Generated on
for userver by
Doxygen
1.17.0