Classes | Typedefs | Functions
cgicc Namespace Reference

The namespace containing the cgicc library. More...

Classes

class  Cgicc
 The main class of the GNU cgicc library. More...
 
class  CgiEnvironment
 Class encapsulating the CGI runtime environment. More...
 
class  CgiInput
 Class that abstracts a data source. More...
 
class  comment
 An HTML comment. More...
 
class  FormEntry
 Class representing a single HTML form entry. More...
 
class  FormFile
 Class representing a file submitted via an HTML form. More...
 
class  HTMLAtomicElement
 Template for concrete atomic HTMLElement subclasses. More...
 
class  HTMLAttribute
 Class representing a name or a single name/value pair. More...
 
class  HTMLAttributeList
 An expandable list of HTMLAttribute objects. More...
 
class  HTMLBooleanElement
 Template for concrete boolean HTMLElement subclasses. More...
 
class  HTMLDoctype
 Specifies the DTD of the HTML 4 document. More...
 
class  HTMLElement
 Class representing an HTML element. More...
 
class  HTMLElementList
 An expandable list of HTMLElement objects. More...
 
class  HTTPContentHeader
 HTTP header for data of a specified MIME type. More...
 
class  HTTPCookie
 An HTTP cookie. More...
 
class  HTTPHeader
 Abstract base class for all simple HTTP response headers. More...
 
class  HTTPHTMLHeader
 Shortcut to HTTPContentHeader for text/html. More...
 
class  HTTPPlainHeader
 Shortcut to HTTPContentHeader for text/html. More...
 
class  HTTPRedirectHeader
 Class for redirecting the client to a different URI. More...
 
class  HTTPResponseHeader
 Generic HTTP response header. More...
 
class  HTTPStatusHeader
 HTTP header to set a specific request status. More...
 
class  HTTPXHTMLHeader
 Class that abstracts a XHTML Content Header. More...
 
class  MStreamable
 Mix-in streamable interface. More...
 
class  nullTag
 
class  XHTMLDoctype
 Class that abstracts a XHTML Doc Type. More...
 
class  XMLDeclaration
 Class that abstracts a XMLDeclaration. More...
 
class  XMLPI
 Class that abstracts a XMLPI. More...
 

Typedefs

typedef std::vector< FormEntry >::iterator form_iterator
 A vector of FormEntry objects.
 
typedef std::vector< FormEntry >::const_iterator const_form_iterator
 A vector of const FormEntry objects.
 
typedef std::vector< FormFile >::iterator file_iterator
 A vector of FormFile objects.
 
typedef std::vector< FormFile >::const_iterator const_file_iterator
 A vector of const FormFile objects.
 
typedef std::vector< HTTPCookie >::iterator cookie_iterator
 A vector of HTTPCookie objects.
 
typedef std::vector< HTTPCookie >::const_iterator const_cookie_iterator
 A vector of const HTTPCookie objects.
 

Functions

bool stringsAreEqual (const std::string &s1, const std::string &s2)
 Compare two strings for equality, ignoring case.
 
bool stringsAreEqual (const std::string &ss1, const std::string &ss2, size_t n)
 Compare two strings for equality, ignoring case.
 
std::string form_urldecode (const std::string &src)
 Convert encoded characters in form data to normal ASCII.
 
std::string form_urlencode (const std::string &src)
 Convert an ASCII string to a URL-safe string.
 
std::string charToHex (char c)
 Convert an ASCII character to its hexadecimal equivalent.
 
char hexToChar (char first, char second)
 Convert a hex-encoded character to its ASCII equivalent.
 
std::string extractBetween (const std::string &data, const std::string &separator1, const std::string &separator2)
 Extract a substring contained within two separators.
 
std::string extractBetween (const std::string &datas, const std::string &separators)
 Extract a substring contained between a separator.
 
void writeString (std::ostream &out, const std::string &s)
 Write a string to an ostream.
 
void writeLong (std::ostream &out, unsigned long l)
 Write a long to an ostream.
 
std::string readString (std::istream &in)
 Read a string from an istream.
 
unsigned long readLong (std::istream &in)
 Read a long from an istream.
 
HTMLAttributeList set (const std::string &name)
 Create a new HTMLAttributeList, and set an HTMLAttribute.
 
HTMLAttributeList set (const std::string &name, const std::string &value)
 Create a new HTMLAttributeList, and set an HTMLAttribute.
 
 BOOLEAN_ELEMENT (html, "html")
 
 BOOLEAN_ELEMENT (head, "head")
 
 BOOLEAN_ELEMENT (title, "title")
 
 ATOMIC_ELEMENT (meta, "meta")
 
 BOOLEAN_ELEMENT (style, "style")
 
 BOOLEAN_ELEMENT (body, "body")
 
 BOOLEAN_ELEMENT (div, "div")
 
 BOOLEAN_ELEMENT (span, "span")
 
 BOOLEAN_ELEMENT (h1, "h1")
 
 BOOLEAN_ELEMENT (h2, "h2")
 
 BOOLEAN_ELEMENT (h3, "h3")
 
 BOOLEAN_ELEMENT (h4, "h4")
 
 BOOLEAN_ELEMENT (h5, "h5")
 
 BOOLEAN_ELEMENT (h6, "h6")
 
 BOOLEAN_ELEMENT (address, "address")
 
 BOOLEAN_ELEMENT (em, "em")
 
 BOOLEAN_ELEMENT (strong, "strong")
 
 BOOLEAN_ELEMENT (cite, "cite")
 
 BOOLEAN_ELEMENT (dfn, "dfn")
 
 BOOLEAN_ELEMENT (code, "code")
 
 BOOLEAN_ELEMENT (samp, "samp")
 
 BOOLEAN_ELEMENT (kbd, "kbd")
 
 BOOLEAN_ELEMENT (var, "var")
 
 BOOLEAN_ELEMENT (abbr, "abbr")
 
 BOOLEAN_ELEMENT (acronym, "acronym")
 
 BOOLEAN_ELEMENT (blockquote, "blockquote")
 
 BOOLEAN_ELEMENT (q, "q")
 
 BOOLEAN_ELEMENT (sub, "sub")
 
 BOOLEAN_ELEMENT (sup, "sup")
 
 BOOLEAN_ELEMENT (p, "p")
 
 ATOMIC_ELEMENT (br, "br")
 
 BOOLEAN_ELEMENT (pre, "pre")
 
 BOOLEAN_ELEMENT (ins, "ins")
 
 BOOLEAN_ELEMENT (del, "del")
 
 BOOLEAN_ELEMENT (bdo, "bdo")
 
 BOOLEAN_ELEMENT (ul, "ul")
 
 BOOLEAN_ELEMENT (ol, "ol")
 
 BOOLEAN_ELEMENT (li, "li")
 
 BOOLEAN_ELEMENT (dl, "dl")
 
 BOOLEAN_ELEMENT (dt, "dt")
 
 BOOLEAN_ELEMENT (dd, "dd")
 
 BOOLEAN_ELEMENT (table, "table")
 
 BOOLEAN_ELEMENT (caption, "caption")
 
 BOOLEAN_ELEMENT (thead, "thead")
 
 BOOLEAN_ELEMENT (tfoot, "tfoot")
 
 BOOLEAN_ELEMENT (tbody, "tbody")
 
 BOOLEAN_ELEMENT (colgroup, "colgroup")
 
 ATOMIC_ELEMENT (col, "col")
 
 BOOLEAN_ELEMENT (tr, "tr")
 
 BOOLEAN_ELEMENT (th, "th")
 
 BOOLEAN_ELEMENT (td, "td")
 
 BOOLEAN_ELEMENT (a, "a")
 
 ATOMIC_ELEMENT (link, "link")
 
 ATOMIC_ELEMENT (base, "base")
 
 ATOMIC_ELEMENT (img, "img")
 
 BOOLEAN_ELEMENT (object, "object")
 
 ATOMIC_ELEMENT (param, "param")
 
 BOOLEAN_ELEMENT (map, "map")
 
 ATOMIC_ELEMENT (area, "area")
 
 ATOMIC_ELEMENT (hr, "hr")
 
 BOOLEAN_ELEMENT (tt, "tt")
 
 BOOLEAN_ELEMENT (i, "i")
 
 BOOLEAN_ELEMENT (b, "b")
 
 BOOLEAN_ELEMENT (big, "big")
 
 BOOLEAN_ELEMENT (small, "small")
 
 BOOLEAN_ELEMENT (frameset, "frameset")
 
 ATOMIC_ELEMENT (frame, "frame")
 
 BOOLEAN_ELEMENT (noframes, "noframes")
 
 BOOLEAN_ELEMENT (iframe, "iframe")
 
 BOOLEAN_ELEMENT (form, "form")
 
 ATOMIC_ELEMENT (input, "input")
 
 BOOLEAN_ELEMENT (button, "button")
 
 BOOLEAN_ELEMENT (select, "select")
 
 BOOLEAN_ELEMENT (optgroup, "optgroup")
 
 BOOLEAN_ELEMENT (option, "option")
 
 BOOLEAN_ELEMENT (textarea, "textarea")
 
 BOOLEAN_ELEMENT (label, "label")
 
 BOOLEAN_ELEMENT (fieldset, "fieldset")
 
 BOOLEAN_ELEMENT (legend, "legend")
 
 BOOLEAN_ELEMENT (script, "script")
 
 BOOLEAN_ELEMENT (noscript, "noscript")
 
std::ostream & operator<< (std::ostream &out, const MStreamable &obj)
 

Detailed Description

The namespace containing the cgicc library.

The namespace containing all classes and functions of the GNU cgicc library.

Typedef Documentation

◆ const_cookie_iterator

typedef std::vector<HTTPCookie>::const_iterator cgicc::const_cookie_iterator

A vector of const HTTPCookie objects.

Definition at line 62 of file CgiEnvironment.h.

◆ const_file_iterator

typedef std::vector<FormFile>::const_iterator cgicc::const_file_iterator

A vector of const FormFile objects.

Definition at line 73 of file Cgicc.h.

◆ const_form_iterator

typedef std::vector<FormEntry>::const_iterator cgicc::const_form_iterator

A vector of const FormEntry objects.

Definition at line 68 of file Cgicc.h.

◆ cookie_iterator

typedef std::vector<HTTPCookie>::iterator cgicc::cookie_iterator

A vector of HTTPCookie objects.

Definition at line 60 of file CgiEnvironment.h.

◆ file_iterator

typedef std::vector<FormFile>::iterator cgicc::file_iterator

A vector of FormFile objects.

Definition at line 71 of file Cgicc.h.

◆ form_iterator

typedef std::vector<FormEntry>::iterator cgicc::form_iterator

A vector of FormEntry objects.

Definition at line 66 of file Cgicc.h.

Function Documentation

◆ charToHex()

std::string cgicc::charToHex ( char  c)

Convert an ASCII character to its hexadecimal equivalent.

For example, after the call

string s = charToHex(':');
std::string charToHex(char c)
Convert an ASCII character to its hexadecimal equivalent.

s will have a value of "3A". Normally, this is called internally to encode characters by escapeString.

Parameters
cThe character to encode
Returns
A string representing the hexadecimal value of c

◆ extractBetween() [1/2]

std::string cgicc::extractBetween ( const std::string &  data,
const std::string &  separator1,
const std::string &  separator2 
)

Extract a substring contained within two separators.

For example, after the call

std::string data = "11foo22";
std::string res;
res = extractBetween(data, "11", "22");
std::string extractBetween(const std::string &data, const std::string &separator1, const std::string &separator2)
Extract a substring contained within two separators.

res will be "foo".

Parameters
dataThe data to search.
separator1The first logical separator.
separator2The second logical separator.
Returns
The substring between the separators.

Referenced by extractBetween().

◆ extractBetween() [2/2]

std::string cgicc::extractBetween ( const std::string &  datas,
const std::string &  separators 
)
inline

Extract a substring contained between a separator.

This function is used internally to decode multipart/form-data

Parameters
dataThe data to search.
separatorThe separator.
Returns
The substring between the separator.

Definition at line 160 of file CgiUtils.h.

References extractBetween().

◆ form_urldecode()

std::string cgicc::form_urldecode ( const std::string &  src)

Convert encoded characters in form data to normal ASCII.

For example, "%21" is converted to '!' and '+' is converted to a space. Normally, this is called internally to decode the query string or post data.

Parameters
srcThe src string containing the encoded characters
Returns
The converted string

◆ form_urlencode()

std::string cgicc::form_urlencode ( const std::string &  src)

Convert an ASCII string to a URL-safe string.

For example, '!' is converted to "%21" and ' ' is converted to '+'.

Parameters
srcThe src string containing the characters to encode
Returns
The converted string

◆ hexToChar()

char cgicc::hexToChar ( char  first,
char  second 
)

Convert a hex-encoded character to its ASCII equivalent.

For example, after the call

char c = hexToChar('2', '1');
char hexToChar(char first, char second)
Convert a hex-encoded character to its ASCII equivalent.

c will have a value of '!'. Normally, this is called internally to decode encoded characters in the query string or post data.

Parameters
firstThe first hex digit
secondThe second hex digit
Returns
The ASCII character

◆ operator<<()

std::ostream & cgicc::operator<< ( std::ostream &  out,
const MStreamable obj 
)

Prototype for overloading streaming operator

Parameters
outThe ostream to which to write
objThe MStreamable object to write
Returns
A reference to out

◆ readLong()

unsigned long cgicc::readLong ( std::istream &  in)

Read a long from an istream.

This function is used internally by cgicc for restoring environments.

Parameters
inThe istream from which to read.
Returns
The long read.

◆ readString()

std::string cgicc::readString ( std::istream &  in)

Read a string from an istream.

This function is used internally by cgicc for restoring environments.

Parameters
inThe istream from which to read.
Returns
The string read.

◆ set() [1/2]

HTMLAttributeList cgicc::set ( const std::string &  name)
inline

Create a new HTMLAttributeList, and set an HTMLAttribute.

This function is usually called from within the constructor of an HTMLElement:

out << img(set("ISINDEX")) << endl;
HTMLAttributeList set(const std::string &name)
Create a new HTMLAttributeList, and set an HTMLAttribute.
Parameters
nameThe name of the HTMLAttribute to set.
Returns
A reference to the list.

Definition at line 189 of file HTMLAttributeList.h.

◆ set() [2/2]

HTMLAttributeList cgicc::set ( const std::string &  name,
const std::string &  value 
)
inline

Create a new HTMLAttributeList, and set an HTMLAttribute.

This function is usually called from within the constructor of an HTMLElement:

out << a("link text", set("HREF","http://www.foo.com")) << endl;
Parameters
nameThe name of the HTMLAttribute to set.
valueThe value of the HTMLAttribute to set.
Returns
A reference to the list.

Definition at line 205 of file HTMLAttributeList.h.

◆ stringsAreEqual() [1/2]

bool cgicc::stringsAreEqual ( const std::string &  s1,
const std::string &  s2 
)

Compare two strings for equality, ignoring case.

For case-sensitive comparison, use (s1 == s2);

Parameters
s1The first string to compare
s2The second string to compare
Returns
true if the strings are equal, false if they are not

Referenced by cgicc::FormEntry::operator==().

◆ stringsAreEqual() [2/2]

bool cgicc::stringsAreEqual ( const std::string &  ss1,
const std::string &  ss2,
size_t  n 
)

Compare two strings for equality, ignoring case.

For case-sensitive comparison, use (s1 == s2);

Parameters
s1The first string to compare
s2The second string to compare
nThe number of characters to compare.
Returns
true if the strings are equal, false if they are not

◆ writeLong()

void cgicc::writeLong ( std::ostream &  out,
unsigned long  l 
)

Write a long to an ostream.

This function is used internally for saving environments.

Parameters
outThe ostream to which to write.
lThe long to write.

◆ writeString()

void cgicc::writeString ( std::ostream &  out,
const std::string &  s 
)

Write a string to an ostream.

This function is used internally for saving environments.

Parameters
outThe ostream to which to write.
sThe string to write.

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Fri Mar 1 2024 08:39:42 for cgicc by doxygen 1.9.6