10#include <unordered_map>
12#include <userver/http/predefined_header.hpp>
13#include <userver/utils/str_icase.hpp>
15USERVER_NAMESPACE_BEGIN
24 using CookiesMap = std::unordered_map<std::string, Cookie, utils::StrCaseHash>;
26 static std::optional<Cookie> FromString(std::string_view cookie_str);
28 Cookie(std::string name, std::string value);
29 Cookie(Cookie&& cookie)
noexcept;
30 Cookie(
const Cookie& cookie);
33 Cookie& operator=(Cookie&&)
noexcept;
34 Cookie& operator=(
const Cookie& cookie);
36 const std::string& Name()
const;
37 const std::string& Value()
const;
39 bool IsSecure()
const;
42 std::chrono::system_clock::time_point Expires()
const;
43 Cookie& SetExpires(std::chrono::system_clock::time_point value);
45 bool IsPermanent()
const;
46 Cookie& SetPermanent();
48 bool IsHttpOnly()
const;
49 Cookie& SetHttpOnly();
51 const std::string& Path()
const;
52 Cookie& SetPath(std::string value);
54 const std::string& Domain()
const;
55 Cookie& SetDomain(std::string value);
57 std::chrono::seconds MaxAge()
const;
58 Cookie& SetMaxAge(std::chrono::seconds value);
60 std::string SameSite()
const;
61 Cookie& SetSameSite(std::string value);
63 std::string ToString()
const;
65 void AppendToString(USERVER_NAMESPACE::http::
headers::HeadersString& os)
const;
69 std::unique_ptr<CookieData> data_;