CppCMS
Public Member Functions | Friends | List of all members
cppcms::http::cookie Class Reference

Class that represents single HTTP Cookie Generally used in context of http::request and http::response. More...

#include <cppcms/http_cookie.h>

Public Member Functions

std::string name () const
 
std::string value () const
 
std::string path () const
 
std::string domain () const
 
std::string comment () const
 
bool secure () const
 
void name (std::string n)
 
void value (std::string v)
 
void path (std::string p)
 
void domain (std::string)
 
void comment (std::string)
 
void expires (time_t when)
 
time_t expires () const
 
bool expires_defined () const
 
void max_age (unsigned age)
 
unsigned max_age () const
 
bool max_age_defined () const
 
void browser_age ()
 
void secure (bool v)
 
bool empty () const
 
 cookie (cookie const &)
 
cookie const & operator= (cookie const &)
 
 cookie (std::string name, std::string value)
 
 cookie (std::string name, std::string value, unsigned age)
 
 cookie (std::string name, std::string value, unsigned age, std::string path, std::string domain=std::string(), std::string comment=std::string())
 
 cookie (std::string name, std::string value, std::string path, std::string domain=std::string(), std::string comment=std::string())
 Create cookie with name, value, path, domain and comment, age - browser.
 

Friends

std::ostream & operator<< (std::ostream &, cookie const &)
 

Detailed Description

Class that represents single HTTP Cookie Generally used in context of http::request and http::response.

Constructor & Destructor Documentation

cppcms::http::cookie::cookie ( std::string  name,
std::string  value 
)

Create cookie with name and value, age - browser, rest properties undefined.

cppcms::http::cookie::cookie ( std::string  name,
std::string  value,
unsigned  age 
)

Create cookies with name, value and max-age, rest properties undefined.

cppcms::http::cookie::cookie ( std::string  name,
std::string  value,
unsigned  age,
std::string  path,
std::string  domain = std::string(),
std::string  comment = std::string() 
)

Create cookie with name, value, max-age, path, domain and command

Member Function Documentation

void cppcms::http::cookie::browser_age ( )

Set age according to browser's session (i.e. no Max-Age)

std::string cppcms::http::cookie::comment ( ) const

Cookie's comment

void cppcms::http::cookie::comment ( std::string  )

Set cookie's comment

std::string cppcms::http::cookie::domain ( ) const

Cookie's domain

void cppcms::http::cookie::domain ( std::string  )

Set cookie's domain

bool cppcms::http::cookie::empty ( ) const

Check if cookie is not assigned - empty

void cppcms::http::cookie::expires ( time_t  when)

Set expiration date/time

time_t cppcms::http::cookie::expires ( ) const

Returns expires timestamp for the cookie, if not set returns 0

New in CppCMS 1.2

bool cppcms::http::cookie::expires_defined ( ) const

returns true if expires(time_t when) was called and expiration was set, if browser_age() is called it is reset to false

New in CppCMS 1.2

void cppcms::http::cookie::max_age ( unsigned  age)

Set max cookie's age

unsigned cppcms::http::cookie::max_age ( ) const

Get max cookie's age, returns 0 if not set

New in CppCMS 1.2

bool cppcms::http::cookie::max_age_defined ( ) const

returns true if max(unsigned age) was called and max_age was set, if browser_age() is called it is reset to false

New in CppCMS 1.2

std::string cppcms::http::cookie::name ( ) const

Cookie's Name

void cppcms::http::cookie::name ( std::string  n)

Set cookie's name

std::string cppcms::http::cookie::path ( ) const

Cookie's path

void cppcms::http::cookie::path ( std::string  p)

Set cookie's path

bool cppcms::http::cookie::secure ( ) const

Check if the cookie is transferred over secure connection only

void cppcms::http::cookie::secure ( bool  v)

Set secure property on the cookies

std::string cppcms::http::cookie::value ( ) const

Cookie's value

void cppcms::http::cookie::value ( std::string  v)

Set cookie's value


The documentation for this class was generated from the following file: