#include <cgicc/HTTPCookie.h>
Inheritance diagram for cgicc::HTTPCookie::
Public Methods | |
Constructors and Destructor | |
HTTPCookie () | |
Default Constructor. More... | |
HTTPCookie (const std::string &name, const std::string &value) | |
Create a new HTTPCookie. More... | |
HTTPCookie (const std::string &name, const std::string &value, const std::string &comment, const std::string &domain, unsigned long maxAge, const std::string &path, bool secure) | |
Create a new fully-spefified HTTPCookie. More... | |
HTTPCookie (const HTTPCookie &cookie) | |
Copy constructor. More... | |
virtual | ~HTTPCookie () |
Destructor. More... | |
Overloaded Operators | |
bool | operator== (const HTTPCookie &cookie) const |
Compare two HTTPCookies for equality. More... | |
bool | operator!= (const HTTPCookie &cookie) const |
Compare two HTTPCookies for inequality. More... | |
Accessor Methods | |
std::string | getName () const |
Get the name of this cookie. More... | |
std::string | getValue () const |
Get the value of this cookie. More... | |
std::string | getComment () const |
Get the comment of this cookie. More... | |
std::string | getDomain () const |
Get the domain for which this cookie is valid. More... | |
unsigned long | getMaxAge () const |
Get the lifetime of this cookie, in seconds. More... | |
std::string | getPath () const |
Get the path of this cookie. More... | |
bool | isSecure () const |
Determine if this is a secure cookie. More... | |
Mutator Methods | |
void | setName (const std::string &name) |
Set the name of this cookie. More... | |
void | setValue (const std::string &value) |
Set the value of this cookie. More... | |
void | setComment (const std::string &comment) |
Set the comment of this cookie. More... | |
void | setDomain (const std::string &domain) |
Set the domain of this cookie. More... | |
void | setMaxAge (unsigned long maxAge) |
Set the lifetime of this cookie, in seconds. More... | |
void | setPath (const std::string &path) |
Set the path of this cookie. More... | |
void | setSecure (bool secure) |
Mark this cookie as secure or unsecure. More... | |
Inherited Methods | |
virtual void | render (std::ostream &out) const |
Write this object to a stream. More... |
An HTTP cookie is a way to maintain state between stateless HTTP requests. HTTP cookies consist of name/value pairs, with optional comments, domains, and expiration dates. Usually, you will add one or more HTTPCookie objects to the HTTP headers your script is returning. For example, to set a cookie called count
to 1
in a normal HTML document:
out << HTTPHTMLHeader().setCookie(HTTPCookie("count","1"));
Definition at line 56 of file HTTPCookie.h.
|
Default Constructor.
Create a new, empty HTTPCookie. |
|
Create a new HTTPCookie.
This is the most commonly-used constructor.
|
|
Create a new fully-spefified HTTPCookie.
|
|
Copy constructor.
Set the name, value, comment, domain, age and path of this cookie to those of
|
|
Destructor.
Delete this HTTPCookie |
|
Get the comment of this cookie.
Definition at line 186 of file HTTPCookie.h. |
|
Get the domain for which this cookie is valid.
An empty string indicates the hostname of the server which generated the cookie response.
Definition at line 197 of file HTTPCookie.h. |
|
Get the lifetime of this cookie, in seconds.
Definition at line 206 of file HTTPCookie.h. |
|
Get the name of this cookie.
Definition at line 168 of file HTTPCookie.h. |
|
Get the path of this cookie.
This is the subset of URLS in a domain for which the cookie is valid, for example
Definition at line 217 of file HTTPCookie.h. |
|
Get the value of this cookie.
Definition at line 177 of file HTTPCookie.h. |
|
Determine if this is a secure cookie.
Definition at line 226 of file HTTPCookie.h. |
|
Compare two HTTPCookies for inequality.
Two HTTPCookie objects are equal if their names, values, comments, domains, ages, and paths match.
Definition at line 146 of file HTTPCookie.h. |
|
Compare two HTTPCookies for equality.
Two HTTPCookie objects are equal if their names, values, comments, domains, ages, and paths match.
|
|
Write this object to a stream.
Subclasses must implement this function.
Reimplemented from cgicc::MStreamable. |
|
Set the comment of this cookie.
Definition at line 259 of file HTTPCookie.h. |
|
Set the domain of this cookie.
An empty string indicates the hostname of the server which generated the cookie response. If specified, the domain must start with a period('.').
Definition at line 271 of file HTTPCookie.h. |
|
Set the lifetime of this cookie, in seconds.
A value of
Definition at line 281 of file HTTPCookie.h. |
|
Set the name of this cookie.
Definition at line 241 of file HTTPCookie.h. |
|
Set the path of this cookie.
This is the subset of URLS in a domain for which the cookie is valid, for example
Definition at line 292 of file HTTPCookie.h. |
|
Mark this cookie as secure or unsecure.
Definition at line 301 of file HTTPCookie.h. |
|
Set the value of this cookie.
Definition at line 250 of file HTTPCookie.h. |