NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
CCgiCookie Class Reference

Search Toolkit Book for CCgiCookie

CCgiCookie:: More...

#include <cgi/ncbicgi.hpp>


struct  PLessCPtr

Public Types

enum  EWriteMethod { eHTTPResponse , eHTTPRequest }
 Whether the cookie is sent as a part of HTTP request or HTTP response. More...
enum  EInvalidFlag { fValid = 0 , fInvalid_Name = 1<<0 , fInvalid_Value = 1<<1 , fInvalid_Any = fInvalid_Name | fInvalid_Value }
enum  ECookieEncoding { eCookieEnc_Url , eCookieEnc_Quote }
typedef const CCgiCookieTCPtr
 Predicate for the cookie comparison. More...
typedef int TInvalidFlag

Public Member Functions

 CCgiCookie (const CCgiCookie &cookie)
 Copy constructor. More...
 CCgiCookie (const string &name, const string &value, const string &domain=NcbiEmptyString, const string &path=NcbiEmptyString)
 Throw the "invalid_argument" if "name" or "value" have invalid format. More...
const stringGetName (void) const
 The cookie name cannot be changed during its whole timelife. More...
CNcbiOstreamWrite (CNcbiOstream &os, EWriteMethod wmethod=eHTTPResponse, EUrlEncode flag=eUrlEncode_SkipMarkChars) const
 Compose and write to output stream "os": More...
void Reset (void)
 Reset everything but name to default state like CCgiCookie(m_Name, "") More...
void CopyAttributes (const CCgiCookie &cookie)
 Set all attribute values(but name!) to those from "cookie". More...
void SetValue (const string &str)
 All SetXXX(const string&) methods beneath: More...
void SetDomain (const string &str)
void SetPath (const string &str)
void SetExpDate (const tm &exp_date)
void SetExpTime (const CTime &exp_time)
void SetSecure (bool secure)
void SetHttpOnly (bool http_only)
const stringGetValue (void) const
 All "const string& GetXXX(...)" methods beneath return reference to "NcbiEmptyString" if the requested attributre is not set. More...
const stringGetDomain (void) const
const stringGetPath (void) const
string GetExpDate (void) const
 Day, dd-Mon-yyyy hh:mm:ss GMT (return empty string if not set) More...
bool GetExpDate (tm *exp_date) const
 If is not set then return FALSE and dont assign "*exp_date". More...
bool GetSecure (void) const
bool GetHttpOnly (void) const
bool operator< (const CCgiCookie &cookie) const
 Compare two cookies. More...
TInvalidFlag IsInvalid (void) const
void SetInvalid (TInvalidFlag flag)
void ResetInvalid (TInvalidFlag flag)

Private Types

enum  EFieldType { eField_Name , eField_Value , eField_Other }

Private Member Functions

CCgiCookieoperator= (const CCgiCookie &)

Static Private Member Functions

static void x_CheckField (const string &str, EFieldType ftype, const char *banned_symbols, const string *cookie_name=NULL)
static string x_EncodeCookie (const string &str, EFieldType ftype, NStr::EUrlEncode flag)
static bool x_GetString (string *str, const string &val)

Private Attributes

string m_Name
string m_Value
string m_Domain
string m_Path
tm m_Expires
bool m_Secure
bool m_HttpOnly
TInvalidFlag m_InvalidFlag


class CCgiCookies

Detailed Description


HTTP cookie class

Definition at line 66 of file ncbicgi.hpp.

The documentation for this class was generated from the following files:
Modified on Fri Mar 01 10:07:13 2024 by rev. 669887