cutelyst  3.7.0
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 
14 namespace Cutelyst {
15 
16 class CookiePrivate;
28 class CUTELYST_LIBRARY Cookie : public QNetworkCookie
29 {
30  Q_GADGET
31 public:
32  enum class SameSite {
33  Default,
34  None,
35  Lax,
36  Strict
37  };
38  Q_ENUM(SameSite)
39 
40 
45  explicit Cookie(const QByteArray &name = QByteArray(), const QByteArray &value = QByteArray());
49  Cookie(const Cookie &other);
57  Cookie &operator=(Cookie &&other) noexcept { swap(other); return *this; }
61  Cookie &operator=(const Cookie &other);
62 
66  void swap(Cookie &other) noexcept
67  {
68  QNetworkCookie::swap(other);
69  d.swap(other.d);
70  }
71 
77  bool operator==(const Cookie &other) const;
81  inline bool operator!=(const Cookie &other) const
82  { return !(*this == other); }
83 
87  SameSite sameSitePolicy() const;
91  void setSameSitePolicy(SameSite sameSite);
92 
98  QByteArray toRawForm(RawForm form = Full) const;
99 
100 private:
102 };
103 
104 }
105 
106 Q_DECLARE_TYPEINFO(Cutelyst::Cookie, Q_MOVABLE_TYPE);
107 
108 #ifndef QT_NO_DEBUG_STREAM
109 class QDebug;
110 CUTELYST_LIBRARY QDebug operator<<(QDebug, const Cutelyst::Cookie &);
111 #endif
112 
113 #endif // CUTELYST_COOKIE_H
The Cutelyst Cookie.
Definition: cookie.h:29
Cookie & operator=(Cookie &&other) noexcept
Move assigns the contents of the Cookie object other to this object.
Definition: cookie.h:57
~Cookie()
Destroys this Cookie object.
void swap(Cookie &other) noexcept
Swaps this cookie with other.
Definition: cookie.h:66
bool operator!=(const Cookie &other) const
Returns true if this cookie is not equal to other.
Definition: cookie.h:81
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QDebug & operator<<(QChar t)
void swap(QNetworkCookie &other)