TreeFrogFramework  2.8
tcookie.h
Go to the documentation of this file.
1 #pragma once
2 #include <QByteArray>
3 #include <QNetworkCookie>
4 #include <TGlobal>
5 
6 
7 class TCookie : public QNetworkCookie {
8 public:
9  TCookie(const QByteArray &name = QByteArray(), const QByteArray &value = QByteArray());
10  TCookie(const TCookie &other);
11  TCookie(const QNetworkCookie &other);
12  ~TCookie() { }
13 
14  TCookie &operator=(const TCookie &other);
15  int64_t maxAge() const { return _maxAge; }
16  void setMaxAge(int64_t maxAge) { _maxAge = maxAge; }
17  QByteArray sameSite() const { return _sameSite; }
18  bool setSameSite(const QByteArray &sameSite);
19 
20  void swap(TCookie &other);
21  QByteArray toRawForm(QNetworkCookie::RawForm form = QNetworkCookie::Full) const;
22  bool operator!=(const TCookie &other) const;
23  bool operator==(const TCookie &other) const;
24 
25  static QList<TCookie> parseCookies(const QByteArray &cookieString);
26 
27 private:
28  int64_t _maxAge {INT64_MIN};
29  QByteArray _sameSite;
30 };
31 
32 
The TCookie class holds one network cookie.
Definition: tcookie.h:7
bool operator==(const TCookie &other) const
Definition: tcookie.cpp:83
void setMaxAge(int64_t maxAge)
Definition: tcookie.h:16
QByteArray sameSite() const
Definition: tcookie.h:17
TCookie & operator=(const TCookie &other)
Definition: tcookie.cpp:33
int64_t maxAge() const
Definition: tcookie.h:15
QByteArray toRawForm(QNetworkCookie::RawForm form=QNetworkCookie::Full) const
Definition: tcookie.cpp:60
TCookie(const QByteArray &name=QByteArray(), const QByteArray &value=QByteArray())
Definition: tcookie.cpp:13
static QList< TCookie > parseCookies(const QByteArray &cookieString)
Definition: tcookie.cpp:89
~TCookie()
Definition: tcookie.h:12
bool operator!=(const TCookie &other) const
Definition: tcookie.cpp:77
void swap(TCookie &other)
Definition: tcookie.cpp:52
bool setSameSite(const QByteArray &sameSite)
Definition: tcookie.cpp:42