#include <cgicc/Cgicc.h>
Public Member Functions | |
Overloaded Operators | |
bool | operator== (const Cgicc &cgi) const |
Compare two Cgiccs for equality. | |
bool | operator!= (const Cgicc &cgi) const |
Compare two Cgiccs for inequality. | |
Cgicc & | operator= (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 CgiEnvironment & | getEnvironment () 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. |
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 { cgicc::Cgicc cgi; // do something with cgi } catch(const exception& e) { //handle the error } }
Definition at line 103 of file Cgicc.h.
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.
input | A CgiInput object to use for reading input |
Definition at line 184 of file Cgicc.cpp.
References cgicc::CgiEnvironment::getPostData(), and cgicc::CgiEnvironment::getQueryString().
cgicc::Cgicc::Cgicc | ( | const Cgicc & | cgi | ) | [inline] |
cgicc::Cgicc::~Cgicc | ( | ) |
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.
input | A CgiInput object to use for reading input |
Definition at line 184 of file Cgicc.cpp.
References cgicc::CgiEnvironment::getPostData(), and cgicc::CgiEnvironment::getQueryString().
cgicc::Cgicc::Cgicc | ( | const Cgicc & | cgi | ) | [inline] |
cgicc::Cgicc::~Cgicc | ( | ) |
bool cgicc::Cgicc::operator== | ( | const Cgicc & | cgi | ) | const [inline] |
Compare two Cgiccs for equality.
Cgiccs are equal if they represent the same environment.
cgi | The Cgicc to compare to this one. |
true
if the two Cgiccs are equal, false
otherwise. Definition at line 154 of file Cgicc.h.
References fEnvironment.
bool cgicc::Cgicc::operator!= | ( | const Cgicc & | cgi | ) | const [inline] |
cgicc::Cgicc & cgicc::Cgicc::operator= | ( | const Cgicc & | cgi | ) |
Assign one Cgicc to another.
Sets the environment in this Cgicc to that of cgi
.
cgi | The Cgicc to copy. |
Definition at line 199 of file Cgicc.cpp.
References fEnvironment, cgicc::CgiEnvironment::getPostData(), and cgicc::CgiEnvironment::getQueryString().
const char * cgicc::Cgicc::getCompileDate | ( | ) | const |
const char * cgicc::Cgicc::getCompileTime | ( | ) | const |
const char * cgicc::Cgicc::getVersion | ( | ) | const |
const char * cgicc::Cgicc::getHost | ( | ) | const |
bool cgicc::Cgicc::queryCheckbox | ( | const std::string & | elementName | ) | const |
Query whether a checkbox is checked.
elementName | The name of the element to query |
true
if the desired checkbox was checked, false
if not Definition at line 248 of file Cgicc.cpp.
References getElement(), and cgicc::stringsAreEqual().
Referenced by main(), and showForm().
form_iterator cgicc::Cgicc::operator[] | ( | const std::string & | name | ) | [inline] |
std::string cgicc::Cgicc::operator() | ( | const std::string & | name | ) | const |
Find a radio button in a radio group, or a selected list item.
name | The name of the radio button or list item to find. |
Definition at line 255 of file Cgicc.cpp.
References getElement().
const_form_iterator cgicc::Cgicc::operator[] | ( | const std::string & | name | ) | const [inline] |
cgicc::form_iterator cgicc::Cgicc::getElement | ( | const std::string & | name | ) |
Find a radio button in a radio group, or a selected list item.
name | The name of the radio button or list item to find. |
Definition at line 265 of file Cgicc.cpp.
Referenced by main(), operator()(), queryCheckbox(), and showForm().
cgicc::const_form_iterator cgicc::Cgicc::getElement | ( | const std::string & | name | ) | const |
bool cgicc::Cgicc::getElement | ( | const std::string & | name, | |
std::vector< FormEntry > & | result | |||
) | const |
cgicc::form_iterator cgicc::Cgicc::getElementByValue | ( | const std::string & | value | ) |
cgicc::const_form_iterator cgicc::Cgicc::getElementByValue | ( | const std::string & | value | ) | const |
bool cgicc::Cgicc::getElementByValue | ( | const std::string & | value, | |
std::vector< FormEntry > & | result | |||
) | const |
const std::vector<FormEntry>& cgicc::Cgicc::operator * | ( | ) | const [inline] |
const std::vector<FormEntry>& cgicc::Cgicc::getElements | ( | ) | const [inline] |
Get all the submitted form elements, excluding files.
Definition at line 348 of file Cgicc.h.
Referenced by dumpList(), and main().
cgicc::file_iterator cgicc::Cgicc::getFile | ( | const std::string & | name | ) |
cgicc::const_file_iterator cgicc::Cgicc::getFile | ( | const std::string & | name | ) | const |
const std::vector<FormFile>& cgicc::Cgicc::getFiles | ( | ) | const [inline] |
const CgiEnvironment& cgicc::Cgicc::getEnvironment | ( | ) | const [inline] |
Get the current runtime environment.
Definition at line 394 of file Cgicc.h.
Referenced by main(), and printForm().
void cgicc::Cgicc::save | ( | const std::string & | filename | ) | const |
Save the current CGI environment to a file.
This is useful for debugging CGI applications.
filename | The name of the file to which to save. |
Definition at line 229 of file Cgicc.cpp.
References cgicc::CgiEnvironment::save().
Referenced by main().
void cgicc::Cgicc::restore | ( | const std::string & | filename | ) |
Restore from a previously-saved CGI environment.
This is useful for debugging CGI applications.
filename | The name of the file from which to restore. |
Definition at line 235 of file Cgicc.cpp.
References cgicc::CgiEnvironment::getPostData(), cgicc::CgiEnvironment::getQueryString(), and cgicc::CgiEnvironment::restore().
Referenced by main().