Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# cgicc Namespace Reference

The namespace containing the cgicc library. More...

## Compounds
class | cgicc::Cgicc
| The main class of the GNU cgicc library. More...
class | cgicc::CgiEnvironment
| Class encapsulating the CGI runtime environment. More...
class | cgicc::CgiInput
| Class that abstracts a data source. More...
class | cgicc::comment
| An HTML comment. More...
class | cgicc::FormEntry
| Class representing a single HTML form entry. More...
class | cgicc::FormFile
| Class representing a file submitted via an HTML form. More...
class | cgicc::HTMLAtomicElement
| Template for concrete atomic HTMLElement subclasses. More...
class | cgicc::HTMLAttribute
| Class representing a name or a single name/value pair. More...
class | cgicc::HTMLAttributeList
| An expandable list of HTMLAttribute objects. More...
class | cgicc::HTMLBooleanElement
| Template for concrete boolean HTMLElement subclasses. More...
class | cgicc::HTMLDoctype
| Specifies the DTD of the HTML 4 document. More...
class | cgicc::HTMLElement
| Class representing an HTML element. More...
class | cgicc::HTMLElementList
| An expandable list of HTMLElement objects. More...
class | cgicc::HTTPContentHeader
| HTTP header for data of a specified MIME type. More...
class | cgicc::HTTPCookie
| An HTTP cookie. More...
class | cgicc::HTTPHeader
| Abstract base class for all simple HTTP response headers. More...
class | cgicc::HTTPHTMLHeader
| Shortcut to HTTPContentHeader for `text/html`. More...
class | cgicc::HTTPPlainHeader
| Shortcut to HTTPContentHeader for `text/html`. More...
class | cgicc::HTTPRedirectHeader
| Class for redirecting the client to a different URI. More...
class | cgicc::HTTPResponseHeader
| Generic HTTP response header. More...
class | cgicc::HTTPStatusHeader
| HTTP header to set a specific request status. More...
class | cgicc::MStreamable
| Mix-in streamable interface. More...
class | cgicc::nullTag
## 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
std::string | safeGetenv (const char *varName)
| Query the value of an environment variable. More...
bool | stringsAreEqual (const std::string &s1, const std::string &s2)
| Compare two strings for equality, ignoring case. More...
bool | stringsAreEqual (const std::string &s1, const std::string &s2, size_t n)
| Compare two strings for equality, ignoring case. More...
int | saferSystem (const std::string &command)
| A safer alternative to system(). More...
std::string | unescapeString (const std::string &src)
| Convert encoded characters in form data to normal ASCII. More...
char | hexToChar (char first, char second)
| Convert a hex-encoded character to its ASCII equivalent. More...
std::string | extractBetween (const std::string &data, const std::string &separator1, const std::string &separator2)
| Extract a substring contained within two separators. More...
std::string | extractBetween (const std::string &data, const std::string &separator)
| Extract a substring contained between a separator. More...
void | writeString (std::ostream &out, const std::string &s)
| Write a string to an ostream. More...
void | writeLong (std::ostream &out, unsigned long l)
| Write a long to an ostream. More...
std::string | readString (std::istream &in)
| Read a string from an istream. More...
unsigned long | readLong (std::istream &in)
| Read a long from an istream. More...
HTMLAttributeList | set (const std::string &name)
| Create a new HTMLAttributeList, and set an HTMLAttribute. More...
HTMLAttributeList | set (const std::string &name, const std::string &value)
| Create a new HTMLAttributeList, and set an HTMLAttribute. More...
| 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.

## Function Documentation

std:: string extractBetween | ( | const std::string & | data,
|  | const std::string & | separator
| ) | `[inline]`

  | Extract a substring contained between a separator. This function is used internally to decode `multipart/form-data` Parameters:
  data | The data to search.
  separator | The separator.
Returns: The substring between the separator. Definition at line 178 of file CgiUtils.h.

std:: string 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
     STDNS string data = "11foo22";
     STDNS string res;
     res = extractBetween(data, "11", "22");
  `res` will be "foo". Parameters:
  data | The data to search.
  separator1 | The first logical separator.
  separator2 | The second logical separator.
Returns: The substring between the separators.

char hexToChar | ( | char | first,
|  | char | second
| ) |

| Convert a hex-encoded character to its ASCII equivalent. For example, after the call
     char c = hexToChar('2', '1');
  `c` will have a value of '!'. Normally, this is called internally to decode encoded characters in the query string or post data. Parameters:
  first | The first character of the hex value
  second | the second character of the hex value
Returns: The ASCII character

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

  | Prototype for overloading streaming operator Parameters:
  out | The ostream to which to write
  obj | The MStreamable object to write
Returns: A reference to `out`

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

  | Read a long from an istream. This function is used internally by cgicc for restoring environments. Parameters:
  in | The istream from which to read.
Returns: The long read.

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

  | Read a string from an istream. This function is used internally by cgicc for restoring environments. Parameters:
  in | The istream from which to read.
Returns: The string read.

std:: string safeGetenv | ( | const char * | varName | ) |

  | Query the value of an environment variable. This function is used internally by CgiEnvironment Parameters:
  varName | The name of an environment variable
Returns: The value of the requested environment variable, or an empty string if not found.

int saferSystem | ( | const std::string & | command | ) |

  | A safer alternative to system(). This command will escape out (by prepending \) all semicolons, pipes and redirects (;|<>) present in the command string. Parameters:
  command | The command to be sanitized and run
Returns: The result of running the sanitized version of command

HTMLAttributeList 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:
  name | The name of the HTMLAttribute to set.
  value | The value of the HTMLAttribute to set.
Returns: A reference to the list. Definition at line 203 of file HTMLAttributeList.h.

HTMLAttributeList 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;
  Parameters:
  name | The name of the HTMLAttribute to set.
Returns: A reference to the list. Definition at line 187 of file HTMLAttributeList.h.

bool stringsAreEqual | ( | const std::string & | s1,
|  | const std::string & | s2,
|  | size_t | n
| ) |

  | Compare two strings for equality, ignoring case. For case-sensitive comparison, use (s1 == s2); Parameters:
  s1 | The first string to compare
  s2 | The second string to compare
  n | The number of characters to compare.
Returns: `true` if the strings are equal, `false` if they are not

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

  | Compare two strings for equality, ignoring case. For case-sensitive comparison, use (s1 == s2); Parameters:
  s1 | The first string to compare
  s2 | The second string to compare
Returns: `true` if the strings are equal, `false` if they are not

std:: string unescapeString | ( | 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:
  src | The src string containing the encoded characters
Returns: The converted string

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

  | Write a long to an ostream. This function is used internally for saving environments. Parameters:
  out | The ostream to which to write.
  l | The long to write.

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

  | Write a string to an ostream. This function is used internally for saving environments. Parameters:
  out | The ostream to which to write.
  s | The string to write.