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 
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,
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);
58  ~Cookie();
62  Cookie &operator=(Cookie &&other) noexcept
63  {
64  swap(other);
65  return *this;
66  }
70  Cookie &operator=(const Cookie &other);
71 
75  void swap(Cookie &other) noexcept
76  {
77  QNetworkCookie::swap(other);
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 
110 private:
112 };
113 
114 } // namespace Cutelyst
115 
116 Q_DECLARE_TYPEINFO(Cutelyst::Cookie, Q_MOVABLE_TYPE);
117 
118 #ifndef QT_NO_DEBUG_STREAM
119 class QDebug;
120 CUTELYST_LIBRARY QDebug operator<<(QDebug, const Cutelyst::Cookie &);
121 #endif
122 
123 #endif // CUTELYST_COOKIE_H
void swap(Cookie &other) noexcept
Swaps this cookie with other.
Definition: cookie.h:75
void swap(QNetworkCookie &other)
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
bool operator!=(const Cookie &other) const
Returns true if this cookie is not equal to other.
Definition: cookie.h:91
QDebug & operator<<(QChar t)
The Cutelyst Cookie.
Definition: cookie.h:28
Cookie & operator=(Cookie &&other) noexcept
Move assigns the contents of the Cookie object other to this object.
Definition: cookie.h:62