Hobrasoft httpd server
Embedded HTTP server for Qt and C++
httpcookie.h
Go to the documentation of this file.
1 
8 #ifndef _HttpCookie_H_
9 #define _HttpCookie_H_
10 
11 #include <QString>
12 #include <QByteArray>
13 #include "testsettings.h"
14 
15 namespace HobrasoftHttpd {
16 
20 class HttpCookie {
21  FRIEND_CLASS_TEST;
22  public:
23 
27  HttpCookie();
28 
32  HttpCookie( const QString& name,
33  const QString& value,
34  const int maxAge,
35  const QString& path = "/",
36  const QString& comment = QString(),
37  const QString& domain = QString(),
38  const bool secure = false);
39 
43  QByteArray toByteArray() const;
44 
45  void setName (const QString& x) { m_name = x; }
46  void setValue (const QString& x) { m_value = x; }
47  void setComment (const QString& x) { m_comment = x; }
48  void setDomain (const QString& x) { m_domain = x; }
49  void setMaxAge (const int& x) { m_maxAge = x; }
50  void setPath (const QString& x) { m_path = x; }
51  void setSecure (const bool& x) { m_secure = x; }
52  void setVersion (const int& x) { m_version = x; }
53 
54  QString name() const { return m_name; }
55  QString value() const { return m_value; }
56  QString comment() const { return m_comment; }
57  QString domain() const { return m_domain; }
58  int maxAge() const { return m_maxAge; }
59  QString path() const { return m_path; }
60  bool secure() const { return m_secure; }
61  int version() const { return m_version; }
62 
63  private:
64  #ifndef DOXYGEN_SHOULD_SKIP_THIS
65  QString m_name;
66  QString m_value;
67  QString m_comment;
68  QString m_domain;
69  int m_maxAge;
70  QString m_path;
71  bool m_secure;
72  int m_version;
73  #endif
74 };
75 }
76 
77 #endif
void setComment(const QString &x)
Sets the comment of cookie.
Definition: httpcookie.h:47
void setDomain(const QString &x)
Sets the domain of cookie.
Definition: httpcookie.h:48
QString path() const
Returns the path of cookie.
Definition: httpcookie.h:59
bool secure() const
Returns the secure status of cookie.
Definition: httpcookie.h:60
void setName(const QString &x)
Sets the name of cookie.
Definition: httpcookie.h:45
void setMaxAge(const int &x)
Sets the max age of cookie.
Definition: httpcookie.h:49
QString name() const
Returns the name of cookie.
Definition: httpcookie.h:54
One cookie of HTTP protocol.
Definition: httpcookie.h:20
QByteArray toByteArray() const
Returns cookie on form of line formated for HTTP header.
Definition: httpcookie.cpp:39
int maxAge() const
Returns the max age of cookie.
Definition: httpcookie.h:58
QString comment() const
Returns the comment of cookie.
Definition: httpcookie.h:56
QString value() const
Returns the value of cookie.
Definition: httpcookie.h:55
int version() const
Returns the version of cookie.
Definition: httpcookie.h:61
void setPath(const QString &x)
Sets the path of cookie.
Definition: httpcookie.h:50
void setVersion(const int &x)
Sets the version ot cookie.
Definition: httpcookie.h:52
void setSecure(const bool &x)
Sets the cookie as secure.
Definition: httpcookie.h:51
void setValue(const QString &x)
Sets the value of cookie.
Definition: httpcookie.h:46
HttpCookie()
Constructor, creates an empty cookie.
Definition: httpcookie.cpp:13
Namespace of HTTP server.
QString domain() const
Returns the domain of cookie.
Definition: httpcookie.h:57