Main Page | Namespace List | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

A namespace for handling form input. More...


Data Structures

class  monsterworks::cgi::NForm::XMissingValue
 A class used to indicate that a parameter was requested which didn't exist. More...
class  monsterworks::cgi::NForm::XMalformedValue
 A class used to indicate a parameter was in the wrong form. More...

Enumerations

enum  EDataSources { EDataSource_StdInput, EDataSource_Query }
 The places where data can come in a form. More...

Functions

std::string GetString (const std::string &inName, EDataSources inSource=EDataSource_StdInput)
 returns a string from a form
int GetInt (const std::string &inName, EDataSources inSource=EDataSource_StdInput)
 returns an integer from a form
const std::string & GetPostData ()
 returns all of the post data in undecoded format
const monsterworks::cgi::FormPairsGetFormPairs ()
 returns the key/value pairs in a POST request
const monsterworks::cgi::QueryWordsGetQueryWords ()
 returns query string interpreted as key/value pairs
const monsterworks::cgi::FormPairsGetQueryPairs ()
 returns query string interpreted as key/value pairs


Detailed Description

A namespace for handling form input.

Enumeration Type Documentation

enum EDataSources
 

The places where data can come in a form.

Enumeration values:
EDataSource_StdInput  the data from a POST request is usually obtained through standard input
EDataSource_Query  the data from a GET request can be encoded in the query string
Definition at line 40 of file NForm.h.


Function Documentation

const monsterworks::cgi::FormPairs & monsterworks::cgi::NForm::GetFormPairs  ) 
 

returns the key/value pairs in a POST request

Returns:
the POST data as key/value pairs.
Definition at line 64 of file NForm.cp.

References NFormInitialize(), and ourFormPairs.

int monsterworks::cgi::NForm::GetInt const std::string &  inName,
EDataSources  inSource = EDataSource_StdInput
 

returns an integer from a form

Returns:
the value of the parameter in a POST request with a specified name after converting it to an integer
Exceptions:
XMissingValue if the key is not found in the form data
XMalformedValue if the value cannot be converted to an integer
XMalformedValue if the value is out of range
Parameters:
inName  the name of the parameter being requested
inSource  the source of the data
Definition at line 145 of file NForm.cp.

References EDataSource_Query, EDataSource_StdInput, monsterworks::cgi::FormPairs, NFormInitialize(), ourFormPairs, and ourQueryPairs.

const std::string & monsterworks::cgi::NForm::GetPostData  ) 
 

returns all of the post data in undecoded format

Returns:
the POST data without any translation.
Definition at line 54 of file NForm.cp.

References NFormInitialize(), and ourPostData.

const monsterworks::cgi::FormPairs & monsterworks::cgi::NForm::GetQueryPairs  ) 
 

returns query string interpreted as key/value pairs

Returns:
the Query string data as key/value pairs.
Definition at line 85 of file NForm.cp.

References NFormInitialize(), and ourQueryPairs.

const monsterworks::cgi::QueryWords & monsterworks::cgi::NForm::GetQueryWords  ) 
 

returns query string interpreted as key/value pairs

Returns:
the Query string data as keywords.
Definition at line 75 of file NForm.cp.

References NFormInitialize(), and ourQueryWords.

std::string monsterworks::cgi::NForm::GetString const std::string &  inName,
EDataSources  inSource = EDataSource_StdInput
 

returns a string from a form

Returns:
the value of the parameter as a string.
Exceptions:
XMissingValue if inName is not a key
Parameters:
inName  the name of the parameter to be found
inSource  the source of the data
Definition at line 97 of file NForm.cp.

References EDataSource_Query, EDataSource_StdInput, monsterworks::cgi::FormPairs, NFormInitialize(), ourFormPairs, and ourQueryPairs.


monsterworks Code by Monsterworks. Made available under the GNU Public License.
Documentation by doxygen.