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

NForm.h File Reference

Methods to handle form data in CGI processing. More...

#include <MonsterworksCopyright.h>
#include <NWWWCodec.h>
#include <string>
#include <exception>

Include dependency graph for NForm.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  monsterworks
namespace  monsterworks::cgi
namespace  monsterworks::cgi::NForm

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

Methods to handle form data in CGI processing.

Author
eeyore
Date
2004/03/06 18:54:56

Copyright (c) 2004 eeyore@monsterworks.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2.

This program is distributed in the hope that it wil be found useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MECHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Gnu Public License in the documentation or read the source of MonsterworksCopyright.h.

You should have received a copy of the GNU General Public Licence along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307 USA.

Definition in file NForm.h.


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 monsterworks::cgi::NForm::EDataSource_Query, monsterworks::cgi::NForm::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 monsterworks::cgi::NForm::EDataSource_Query, monsterworks::cgi::NForm::EDataSource_StdInput, monsterworks::cgi::FormPairs, NFormInitialize(), ourFormPairs, and ourQueryPairs.


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