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

Search Toolkit Book for CCgiCookies

CCgiCookies:: More...

#include <cgi/ncbicgi.hpp>

+ Collaboration diagram for CCgiCookies:

Public Types

enum  EOnBadCookie {
  eOnBadCookie_ThrowException , eOnBadCookie_SkipAndError , eOnBadCookie_Skip , eOnBadCookie_StoreAndError ,
  eOnBadCookie_Store
}
 How to handle badly formed cookies. More...
 
typedef set< CCgiCookie *, CCgiCookie::PLessCPtrTSet
 
typedef TSet::iterator TIter
 
typedef TSet::const_iterator TCIter
 
typedef pair< TIter, TIterTRange
 
typedef pair< TCIter, TCIterTCRange
 

Public Member Functions

 CCgiCookies (void)
 Empty set of cookies. More...
 
 CCgiCookies (EUrlEncode encode_flag)
 Use the specified method of string encoding. More...
 
 CCgiCookies (const string &str, EOnBadCookie on_bad_cookie=eOnBadCookie_SkipAndError, EUrlEncode encode_flag=eUrlEncode_SkipMarkChars)
 Format of the string: "name1=value1; name2=value2; ...". More...
 
 ~CCgiCookies (void)
 Destructor. More...
 
bool Empty (void) const
 Return TRUE if this set contains no cookies. More...
 
EUrlEncode GetUrlEncodeFlag (void) const
 
void SetUrlEncodeFlag (EUrlEncode encode_flag)
 
CCgiCookieAdd (const string &name, const string &value, const string &domain=kEmptyStr, const string &path=kEmptyStr, EOnBadCookie on_bad_cookie=eOnBadCookie_SkipAndError)
 All Add() functions: if the added cookie has the same {name, domain, path} as an already existing one then the new cookie will override the old one. More...
 
CCgiCookieAdd (const string &name, const string &value, EOnBadCookie on_bad_cookie)
 
CCgiCookieAdd (const CCgiCookie &cookie)
 Update with a copy of "cookie". More...
 
void Add (const CCgiCookies &cookies)
 Update by a set of cookies. More...
 
void Add (const string &str, EOnBadCookie on_bad_cookie=eOnBadCookie_SkipAndError)
 Update with a HTTP request like string: "name1=value1; name2=value2; ...". More...
 
CCgiCookieFind (const string &name, const string &domain, const string &path)
 Return NULL if cannot find this exact cookie. More...
 
const CCgiCookieFind (const string &name, const string &domain, const string &path) const
 
CCgiCookieFind (const string &name, TRange *range=0)
 Return the first matched cookie with name "name", or NULL if there is no such cookie(s). More...
 
const CCgiCookieFind (const string &name, TCRange *range=0) const
 
TCRange GetAll (void) const
 Return the full range [begin():end()] on the underlying container. More...
 
bool Remove (CCgiCookie *cookie, bool destroy=true)
 Remove "cookie" from this set; deallocate it if "destroy" is true Return FALSE if can not find "cookie" in this set. More...
 
size_t Remove (TRange &range, bool destroy=true)
 Remove (and destroy if "destroy" is true) all cookies belonging to range "range". More...
 
size_t Remove (const string &name, bool destroy=true)
 Remove (and destroy if "destroy" is true) all cookies with the given "name". More...
 
void Clear (void)
 Remove all stored cookies. More...
 
CNcbiOstreamWrite (CNcbiOstream &os, CCgiCookie::EWriteMethod wmethod=CCgiCookie::eHTTPResponse) const
 Printout all cookies into the stream "os". More...
 
void SetSecure (bool secure)
 Set secure connection flag. More...
 
void SetAllCookiesSecure (bool value)
 Mark all cookies as secure. More...
 
bool GetAllCookiesSecure (void) const
 
void SetAllCookiesHttpOnly (bool value)
 Mark all cookies as HTTP_ONLY. More...
 
bool GetAllCookiesHttpOnly (void) const
 

Private Types

enum  ECheckResult { eCheck_Valid , eCheck_SkipInvalid , eCheck_StoreInvalid }
 

Private Member Functions

 CCgiCookies (const CCgiCookies &)
 prohibit default initialization and assignment More...
 
CCgiCookiesoperator= (const CCgiCookies &)
 

Static Private Member Functions

static ECheckResult x_CheckField (const string &str, CCgiCookie::EFieldType ftype, const char *banned_symbols, EOnBadCookie on_bad_cookie, const string *cookie_name=NULL)
 

Private Attributes

NStr::EUrlEncode m_EncodeFlag
 
TSet m_Cookies
 
bool m_Secure
 
bool m_AllSecure
 
bool m_AllHttpOnly
 

Detailed Description

CCgiCookies::

Set of CGI send-cookies

The cookie is uniquely identified by {name, domain, path}. "name" is mandatory and non-empty; "domain" and "path" are optional. "name" and "domain" are not case-sensitive; "path" is case-sensitive.

Definition at line 218 of file ncbicgi.hpp.


The documentation for this class was generated from the following files:
Modified on Wed Apr 17 13:08:45 2024 by modify_doxy.py rev. 669887