List of all members
cgicc::Cgicc Class Reference

The main class of the GNU cgicc library. More...

#include <cgicc/Cgicc.h>

Public Member Functions

Constructors and Destructor
 Cgicc (CgiInput *input=0)
 Constructor.
 
 Cgicc (const Cgicc &cgi)
 Copy constructor.
 
 ~Cgicc ()
 Destructor.
 
Overloaded Operators
bool operator== (const Cgicc &cgi) const
 Compare two Cgiccs for equality.
 
bool operator!= (const Cgicc &cgi) const
 Compare two Cgiccs for inequality.
 
Cgiccoperator= (const Cgicc &cgi)
 Assign one Cgicc to another.

 
Library Information

Information on this installation of cgicc

const char * getCompileDate () const
 Get the date on which this library was compiled.
 
const char * getCompileTime () const
 Get the time at which this library was compiled.
 
const char * getVersion () const
 Get the version number of cgicc.
 
const char * getHost () const
 Get the platform for which Cgicc was configured.
 
Form Element Access

Information on submitted form elements

bool queryCheckbox (const std::string &elementName) const
 Query whether a checkbox is checked.
 
form_iterator operator[] (const std::string &name)
 Find a radio button in a radio group, or a selected list item.
 
std::string operator() (const std::string &name) const
 Find a radio button in a radio group, or a selected list item.
 
const_form_iterator operator[] (const std::string &name) const
 Find a radio button in a radio group, or a selected list item.
 
form_iterator getElement (const std::string &name)
 Find a radio button in a radio group, or a selected list item.
 
const_form_iterator getElement (const std::string &name) const
 Find a radio button in a radio group, or a selected list item.
 
bool getElement (const std::string &name, std::vector< FormEntry > &result) const
 Find multiple checkboxes in a group or selected items in a list.
 
form_iterator getElementByValue (const std::string &value)
 Find a radio button in a radio group, or a selected list item.
 
const_form_iterator getElementByValue (const std::string &value) const
 Find a radio button in a radio group, or a selected list item.
 
bool getElementByValue (const std::string &value, std::vector< FormEntry > &result) const
 Find multiple checkboxes in a group or selected items in a list.
 
const std::vector< FormEntry > & operator* () const
 Get all the submitted form entries, excluding files.
 
const std::vector< FormEntry > & getElements () const
 Get all the submitted form elements, excluding files.
 
Uploaded File Access
file_iterator getFile (const std::string &name)
 Find an uploaded file.
 
const_file_iterator getFile (const std::string &name) const
 Find an uploaded file.
 
const std::vector< FormFile > & getFiles () const
 
Environment Access
const CgiEnvironmentgetEnvironment () const
 

Save and Restore

void save (const std::string &filename) const
 Save the current CGI environment to a file.
 
void restore (const std::string &filename)
 Restore from a previously-saved CGI environment.
 

Detailed Description

The main class of the GNU cgicc library.

Cgicc is used to retrieve information on specific HTML form elements (such as checkboxes, radio buttons, and text fields), on uploaded files, and to save, restore, and retrieve information on the CGI environment.

Normally, you will instantiate an object of this type in main():

int
main(int argc, char **argv) {
try {
// do something with cgi
}
catch(const exception& e) {
//handle the error
}
}
The main class of the GNU cgicc library.
Definition: Cgicc.h:103

Definition at line 103 of file Cgicc.h.

Constructor & Destructor Documentation

◆ Cgicc() [1/2]

cgicc::Cgicc::Cgicc ( CgiInput input = 0)

Constructor.

If you are using cgicc with FastCGI, you will need to pass a CgiInput subclass that cgicc will use to read input. If input is omitted, standard input and environment variables will be used.

Parameters
inputA CgiInput object to use for reading input

◆ Cgicc() [2/2]

cgicc::Cgicc::Cgicc ( const Cgicc cgi)
inline

Copy constructor.

Sets the values of this Cgicc to those of cgi.

Parameters
envThe Cgicc to copy.

Definition at line 129 of file Cgicc.h.

◆ ~Cgicc()

cgicc::Cgicc::~Cgicc ( )

Destructor.

Delete this Cgicc object

Member Function Documentation

◆ getCompileDate()

const char * cgicc::Cgicc::getCompileDate ( ) const

Get the date on which this library was compiled.

This is a string of the form mmm dd yyyy.

Returns
The compile date

◆ getCompileTime()

const char * cgicc::Cgicc::getCompileTime ( ) const

Get the time at which this library was compiled.

This is a string of the form hh:mm:ss in 24-hour time.

Returns
The compile time

◆ getElement() [1/3]

form_iterator cgicc::Cgicc::getElement ( const std::string &  name)

Find a radio button in a radio group, or a selected list item.

Parameters
nameThe name of the radio button or list item to find.
Returns
An iterator referring to the desired element, if found.

Referenced by main().

◆ getElement() [2/3]

const_form_iterator cgicc::Cgicc::getElement ( const std::string &  name) const

Find a radio button in a radio group, or a selected list item.

Parameters
nameThe name of the radio button or list item to find.
Returns
A const_iterator referring to the desired element, if found.

◆ getElement() [3/3]

bool cgicc::Cgicc::getElement ( const std::string &  name,
std::vector< FormEntry > &  result 
) const

Find multiple checkboxes in a group or selected items in a list.

Parameters
nameThe name of the checkboxes or list to find.
resultA vector to hold the result.
Returns
true if any elements were found, false if not.

◆ getElementByValue() [1/3]

form_iterator cgicc::Cgicc::getElementByValue ( const std::string &  value)

Find a radio button in a radio group, or a selected list item.

Parameters
valueThe value of the radio button or list item to find.
Returns
An iterator referring to the desired element, if found.

◆ getElementByValue() [2/3]

const_form_iterator cgicc::Cgicc::getElementByValue ( const std::string &  value) const

Find a radio button in a radio group, or a selected list item.

Parameters
valueThe value of the radio button or list item to find.
Returns
A const_iterator referring to the desired element, if found.

◆ getElementByValue() [3/3]

bool cgicc::Cgicc::getElementByValue ( const std::string &  value,
std::vector< FormEntry > &  result 
) const

Find multiple checkboxes in a group or selected items in a list.

Parameters
valueThe value of the checkboxes or list to find.
resultA vector to hold the result.
Returns
true if any elements were found, false if not.

◆ getElements()

const std::vector< FormEntry > & cgicc::Cgicc::getElements ( ) const
inline

Get all the submitted form elements, excluding files.

Returns
A vector containing all the submitted elements.

Definition at line 348 of file Cgicc.h.

Referenced by main().

◆ getEnvironment()

const CgiEnvironment & cgicc::Cgicc::getEnvironment ( ) const
inline

Get the current runtime environment.

Returns
The current CGI environment.

Definition at line 394 of file Cgicc.h.

Referenced by main().

◆ getFile() [1/2]

file_iterator cgicc::Cgicc::getFile ( const std::string &  name)

Find an uploaded file.

Parameters
nameThe name of the file.
Returns
An iterator referring to the desired file, if found.

◆ getFile() [2/2]

const_file_iterator cgicc::Cgicc::getFile ( const std::string &  name) const

Find an uploaded file.

Parameters
nameThe name of the file.
Returns
An iterator referring to the desired file, if found.

◆ getFiles()

const std::vector< FormFile > & cgicc::Cgicc::getFiles ( ) const
inline

Get all uploaded files.

Returns
A vector containing all the uploaded files.

Definition at line 380 of file Cgicc.h.

◆ getHost()

const char * cgicc::Cgicc::getHost ( ) const

Get the platform for which Cgicc was configured.

The host is a string of the form processor-manufacturer-os return The host triplet.

◆ getVersion()

const char * cgicc::Cgicc::getVersion ( ) const

Get the version number of cgicc.

The version number is a string of the form #.#.

Returns
The version number

◆ operator!=()

bool cgicc::Cgicc::operator!= ( const Cgicc cgi) const
inline

Compare two Cgiccs for inequality.

Cgiccs are equal if they represent the same environment.

Parameters
cgiThe Cgicc to compare to this one.
Returns
false if the two Cgiccs are equal, true otherwise.

Definition at line 165 of file Cgicc.h.

◆ operator()()

std::string cgicc::Cgicc::operator() ( const std::string &  name) const

Find a radio button in a radio group, or a selected list item.

Parameters
nameThe name of the radio button or list item to find.
Returns
The desired element, or an empty string if not found.

◆ operator*()

const std::vector< FormEntry > & cgicc::Cgicc::operator* ( ) const
inline

Get all the submitted form entries, excluding files.

Returns
A vector containing all the submitted elements.

Definition at line 339 of file Cgicc.h.

◆ operator=()

Cgicc & cgicc::Cgicc::operator= ( const Cgicc cgi)

Assign one Cgicc to another.

Sets the environment in this Cgicc to that of cgi.

Parameters
cgiThe Cgicc to copy.
Returns
A reference to this.

◆ operator==()

bool cgicc::Cgicc::operator== ( const Cgicc cgi) const
inline

Compare two Cgiccs for equality.

Cgiccs are equal if they represent the same environment.

Parameters
cgiThe Cgicc to compare to this one.
Returns
true if the two Cgiccs are equal, false otherwise.

Definition at line 154 of file Cgicc.h.

◆ operator[]() [1/2]

form_iterator cgicc::Cgicc::operator[] ( const std::string &  name)
inline

Find a radio button in a radio group, or a selected list item.

Parameters
nameThe name of the radio button or list item to find.
Returns
An iterator referring to the desired element, if found.

Definition at line 253 of file Cgicc.h.

◆ operator[]() [2/2]

const_form_iterator cgicc::Cgicc::operator[] ( const std::string &  name) const
inline

Find a radio button in a radio group, or a selected list item.

Parameters
nameThe name of the radio button or list item to find.
Returns
An iterator referring to the desired element, if found.

Definition at line 272 of file Cgicc.h.

◆ queryCheckbox()

bool cgicc::Cgicc::queryCheckbox ( const std::string &  elementName) const

Query whether a checkbox is checked.

Parameters
elementNameThe name of the element to query
Returns
true if the desired checkbox was checked, false if not

◆ restore()

void cgicc::Cgicc::restore ( const std::string &  filename)

Restore from a previously-saved CGI environment.

This is useful for debugging CGI applications.

Parameters
filenameThe name of the file from which to restore.

◆ save()

void cgicc::Cgicc::save ( const std::string &  filename) const

Save the current CGI environment to a file.

This is useful for debugging CGI applications.

Parameters
filenameThe name of the file to which to save.

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

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