cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
cookie.h
1/*
2 * SPDX-FileCopyrightText: (C) 2023 Matthias Fehring <mf@huessenbergnetz.de>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef CUTELYST_COOKIE_H
7#define CUTELYST_COOKIE_H
8
9#include <Cutelyst/cutelyst_global.h>
10
11#include <QNetworkCookie>
12#include <QObject>
13
14namespace Cutelyst {
15
16class CookiePrivate;
28class CUTELYST_LIBRARY Cookie : public QNetworkCookie
29{
30 Q_GADGET
31public:
32 enum class SameSite {
33 Default,
34 None,
37 Lax,
39 Strict
40 };
41 Q_ENUM(SameSite)
42
43
50 explicit Cookie(const QByteArray &name = QByteArray(), const QByteArray &value = QByteArray());
54 Cookie(const Cookie &other);
62 Cookie &operator=(Cookie &&other) noexcept
63 {
64 swap(other);
65 return *this;
66 }
67
70 Cookie &operator=(const Cookie &other);
71
75 void swap(Cookie &other) noexcept
76 {
78 d.swap(other.d);
79 }
80
87 bool operator==(const Cookie &other) const;
91 inline bool operator!=(const Cookie &other) const { return !(*this == other); }
92
97 SameSite sameSitePolicy() const;
101 void setSameSitePolicy(SameSite sameSite);
102
108 QByteArray toRawForm(RawForm form = Full) const;
109
110private:
112};
113
114} // namespace Cutelyst
115
116Q_DECLARE_TYPEINFO(Cutelyst::Cookie, Q_MOVABLE_TYPE);
117
118#ifndef QT_NO_DEBUG_STREAM
119class QDebug;
120CUTELYST_LIBRARY QDebug operator<<(QDebug, const Cutelyst::Cookie &);
121#endif
122
123#endif // CUTELYST_COOKIE_H
The Cutelyst Cookie.
Definition cookie.h:29
Cookie(const QByteArray &name=QByteArray(), const QByteArray &value=QByteArray())
Create a new Cookie object, initializing the cookie name to name and its value to value.
Definition cookie.cpp:15
~Cookie()
Destroys this Cookie object.
void swap(Cookie &other) noexcept
Swaps this cookie with other.
Definition cookie.h:75
Cookie & operator=(Cookie &&other) noexcept
Move assigns the contents of the Cookie object other to this object.
Definition cookie.h:62
bool operator!=(const Cookie &other) const
Returns true if this cookie is not equal to other.
Definition cookie.h:91
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
QDebug & operator<<(QChar t)
QNetworkCookie(const QByteArray &name, const QByteArray &value)
void swap(QNetworkCookie &other)