QtWebApp
httpcookie.h
Go to the documentation of this file.
1 
6 #ifndef HTTPCOOKIE_H
7 #define HTTPCOOKIE_H
8 
9 #include <QList>
10 #include <QByteArray>
11 #include "httpglobal.h"
12 
13 namespace stefanfrings {
14 
20 class DECLSPEC HttpCookie
21 {
22 public:
23 
25  HttpCookie();
26 
40  HttpCookie(const QByteArray name, const QByteArray value, const int maxAge,
41  const QByteArray path="/", const QByteArray comment=QByteArray(),
42  const QByteArray domain=QByteArray(), const bool secure=false,
43  const bool httpOnly=false, const QByteArray sameSite=QByteArray());
44 
49  HttpCookie(const QByteArray source);
50 
52  QByteArray toByteArray() const ;
53 
58  static QList<QByteArray> splitCSV(const QByteArray source);
59 
61  void setName(const QByteArray name);
62 
64  void setValue(const QByteArray value);
65 
67  void setComment(const QByteArray comment);
68 
70  void setDomain(const QByteArray domain);
71 
73  void setMaxAge(const int maxAge);
74 
76  void setPath(const QByteArray path);
77 
79  void setSecure(const bool secure);
80 
82  void setHttpOnly(const bool httpOnly);
83 
88  void setSameSite(const QByteArray sameSite);
89 
91  QByteArray getName() const;
92 
94  QByteArray getValue() const;
95 
97  QByteArray getComment() const;
98 
100  QByteArray getDomain() const;
101 
103  int getMaxAge() const;
104 
106  QByteArray getPath() const;
107 
109  bool getSecure() const;
110 
112  bool getHttpOnly() const;
113 
115  QByteArray getSameSite() const;
116 
118  int getVersion() const;
119 
120 private:
121 
122  QByteArray name;
123  QByteArray value;
124  QByteArray comment;
125  QByteArray domain;
126  int maxAge;
127  QByteArray path;
128  bool secure;
129  bool httpOnly;
130  QByteArray sameSite;
131  int version;
132 
133 };
134 
135 } // end of namespace
136 
137 #endif // HTTPCOOKIE_H
HTTP cookie as defined in RFC 2109.
Definition: httpcookie.h:21