NAWA 0.9
Web Application Framework for C++
nawa::Cookie Class Reference

#include <nawa/connection/Cookie.h>

Public Types

enum class  SameSite { OFF , LAX , STRICT }
 

Public Member Functions

virtual ~Cookie ()
 
 Cookie ()
 
 Cookie (Cookie const &other)
 
Cookieoperator= (const Cookie &other)
 
 Cookie (Cookie &&other) noexcept
 
Cookieoperator= (Cookie &&other) noexcept
 
 Cookie (std::string c)
 
std::string & content () noexcept
 
std::string const & content () const noexcept
 
Cookiecontent (std::string value) noexcept
 
std::optional< time_t > & expires () noexcept
 
std::optional< time_t > const & expires () const noexcept
 
Cookieexpires (std::optional< time_t > value) noexcept
 
std::optional< unsigned long > & maxAge () noexcept
 
std::optional< unsigned long > const & maxAge () const noexcept
 
CookiemaxAge (std::optional< unsigned long > value) noexcept
 
std::optional< std::string > & domain () noexcept
 
std::optional< std::string > const & domain () const noexcept
 
Cookiedomain (std::optional< std::string > value) noexcept
 
std::optional< std::string > & path () noexcept
 
std::optional< std::string > const & path () const noexcept
 
Cookiepath (std::optional< std::string > value) noexcept
 
bool & secure () noexcept
 
bool secure () const noexcept
 
Cookiesecure (bool value) noexcept
 
bool & httpOnly () noexcept
 
bool httpOnly () const noexcept
 
CookiehttpOnly (bool value) noexcept
 
SameSitesameSite () noexcept
 
SameSite sameSite () const noexcept
 
CookiesameSite (SameSite value) noexcept
 

Detailed Description

Structure for creating Cookie objects. Content can be set by using a constructor.

Definition at line 36 of file Cookie.h.

Member Enumeration Documentation

◆ SameSite

enum class nawa::Cookie::SameSite
strong
Enumerator
OFF 
LAX 
STRICT 

Definition at line 51 of file Cookie.h.

Constructor & Destructor Documentation

◆ ~Cookie()

virtual nawa::Cookie::~Cookie ( )
virtual

◆ Cookie() [1/4]

nawa::Cookie::Cookie ( )

◆ Cookie() [2/4]

nawa::Cookie::Cookie ( Cookie const &  other)

◆ Cookie() [3/4]

nawa::Cookie::Cookie ( Cookie &&  other)
noexcept

◆ Cookie() [4/4]

Cookie::Cookie ( std::string  c)
explicit

Create a cookie and directly set the content.

Parameters
cContent of the cookie.

Definition at line 52 of file Cookie.cpp.

Member Function Documentation

◆ operator=() [1/2]

Cookie & nawa::Cookie::operator= ( const Cookie other)

◆ operator=() [2/2]

Cookie & nawa::Cookie::operator= ( Cookie &&  other)
noexcept

◆ content() [1/3]

std::string & nawa::Cookie::content ( )
noexcept

Content of the cookie.

Returns
Reference to element.

◆ content() [2/3]

std::string const & nawa::Cookie::content ( ) const
noexcept

◆ content() [3/3]

Cookie & nawa::Cookie::content ( std::string  value)
noexcept

◆ expires() [1/3]

std::optional< time_t > & nawa::Cookie::expires ( )
noexcept

Set (optional) expiry date as time_t structure. Session cookies usually do not have an expiry date, meaning that they are deleted when the browser is closed.

Returns
Reference to element.

◆ expires() [2/3]

std::optional< time_t > const & nawa::Cookie::expires ( ) const
noexcept

◆ expires() [3/3]

Cookie & nawa::Cookie::expires ( std::optional< time_t >  value)
noexcept

◆ maxAge() [1/3]

std::optional< unsigned long > & nawa::Cookie::maxAge ( )
noexcept

Set (optional) Max-Age attribute.

Returns
Reference to element.

◆ maxAge() [2/3]

std::optional< unsigned long > const & nawa::Cookie::maxAge ( ) const
noexcept

◆ maxAge() [3/3]

Cookie & nawa::Cookie::maxAge ( std::optional< unsigned long >  value)
noexcept

◆ domain() [1/3]

std::optional< std::string > & nawa::Cookie::domain ( )
noexcept

Set (optional) Domain attribute.

Returns
Reference to element.

◆ domain() [2/3]

std::optional< std::string > const & nawa::Cookie::domain ( ) const
noexcept

◆ domain() [3/3]

Cookie & nawa::Cookie::domain ( std::optional< std::string >  value)
noexcept

◆ path() [1/3]

std::optional< std::string > & nawa::Cookie::path ( )
noexcept

Set (optional) Path attribute.

Returns
Reference to element.

◆ path() [2/3]

std::optional< std::string > const & nawa::Cookie::path ( ) const
noexcept

◆ path() [3/3]

Cookie & nawa::Cookie::path ( std::optional< std::string >  value)
noexcept

◆ secure() [1/3]

bool & nawa::Cookie::secure ( )
noexcept

Set Secure attribute.

Returns
Reference to element.

◆ secure() [2/3]

bool nawa::Cookie::secure ( ) const
noexcept

◆ secure() [3/3]

Cookie & nawa::Cookie::secure ( bool  value)
noexcept

◆ httpOnly() [1/3]

bool & nawa::Cookie::httpOnly ( )
noexcept

Set HttpOnly attribute.

Returns
Reference to element.

◆ httpOnly() [2/3]

bool nawa::Cookie::httpOnly ( ) const
noexcept

◆ httpOnly() [3/3]

Cookie & nawa::Cookie::httpOnly ( bool  value)
noexcept

◆ sameSite() [1/3]

SameSite & nawa::Cookie::sameSite ( )
noexcept

Set SameSite attribute.

Returns
Reference to element.

◆ sameSite() [2/3]

SameSite nawa::Cookie::sameSite ( ) const
noexcept

◆ sameSite() [3/3]

Cookie & nawa::Cookie::sameSite ( SameSite  value)
noexcept

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