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

mpcl::net::cgi::TConfigProcessor Class Reference

#include <config_processor.hh>

Inheritance diagram for mpcl::net::cgi::TConfigProcessor:

mpcl::util::prefs::TConfigProcessor List of all members.

Public Methods

 TConfigProcessor (int iPARAMETER_COUNT, const char **ppkcPARAMETERS)
void processOptions (void)
const TString & getFormValue (const char *pkcNAME) const
const TString & getFormValue (const std::string &rkyNAME) const
bool hasFormOption (const TString &rkyNAME) const
bool hasInput (void) const
bool hasOption (const TString &rkyNAME) const
void updateForm (text::html::TForm &rtTARGET_FORM) const

Protected Methods

void processCommandLine (void)
 Loads variables from command-line in CGI fashion.

void readFormData (std::basic_istream< char_type, traits_type > &rtSOURCE_ISTREAM)
TOption & updateFormOption (const TString &rkyNAME, const TString &rkyVALUE)
TOption & updateOptionWithName (const TString &rkyNAME, const TString &rkyVALUE)

Detailed Description

CGI configuration processor. It parses input from command-line, and standard input in CGI fashion.

In CGI programs, the parameters come in this format:

<name_1>=[<value_1>]&<name_2>=[<value_2>]&...<name_n>=[<value_n>]

Furthermore, options can have more than one value. One of the most useful techniques used in HTMLL is coding identifier and value as NAME attribute of THtmlInputImage (input type=image). This must be done cause to the fact that, when that type of input is used, the value provided by the server is:

<name.x>=<position_x>&<name.y>=<position_y>

As you can see, there is no value attribute, so HTMLL bypasses this problem encoding name as a pair of identifier and value. Then, the server will give us, something like this:

<identifier/value.x>=<position_x>&<identifier/value.y>=<position_y>

Next this is translated to:

<identifier>=<value>&<identifier>=<value>

Definition at line 75 of file net/cgi/config_processor.hh.


Constructor & Destructor Documentation

mpcl::net::cgi::TConfigProcessor::TConfigProcessor int    iPARAMETER_COUNT,
const char **    ppkcPARAMETERS
 

Builds a new instance, and adds all environment variables sets by the HTTP server.

Parameters:
iPARAMETER_COUNT  Parameter count.
ppkcPARAMETERS  Parameter array.

Reimplemented from mpcl::util::prefs::TConfigProcessor.

Definition at line 40 of file net/cgi/config_processor.cc.

References mpcl::util::prefs::TConfigProcessor::addEnvironmentVariable().


Member Function Documentation

const TString& mpcl::net::cgi::TConfigProcessor::getFormValue const std::string &    rkyNAME const [inline]
 

Gets form option value corresponding to name rkyNAME.

Parameters:
rkyNAME  Option name.
Returns:
The corresponding option.

Definition at line 177 of file net/cgi/config_processor.hh.

References getFormValue(), and mpcl::text::TString.

const mpcl::text::TString & mpcl::net::cgi::TConfigProcessor::getFormValue const char *    pkcNAME const
 

Gets form option value corresponding to name pkcNAME.

Parameters:
pkcNAME  Option name.
Returns:
The corresponding option.

Definition at line 299 of file net/cgi/config_processor.cc.

References mpcl::text::Format(), and mpcl::text::TString.

Referenced by getFormValue().

bool mpcl::net::cgi::TConfigProcessor::hasFormOption const TString &    rkyNAME const
 

True if there is an form option called rkyNAME.

Definition at line 329 of file net/cgi/config_processor.cc.

References mpcl::text::TString.

bool mpcl::net::cgi::TConfigProcessor::hasInput void    const [inline]
 

Returns true if there was any kind of input (from command-line, or from standard input).

Definition at line 191 of file net/cgi/config_processor.hh.

bool mpcl::net::cgi::TConfigProcessor::hasOption const TString &    rkyNAME const
 

True if there is an option called rkyNAME.

Definition at line 350 of file net/cgi/config_processor.cc.

References mpcl::util::prefs::TConfigProcessor::tOptionVector, and mpcl::text::TString.

void mpcl::net::cgi::TConfigProcessor::processOptions void    [virtual]
 

Loads options from the source defined in the CGI environment variables (from standard-input or from an environment variable).

Reimplemented from mpcl::util::prefs::TConfigProcessor.

Definition at line 69 of file net/cgi/config_processor.cc.

References mpcl::util::prefs::TConfigProcessor::environmentValue(), mpcl::util::prefs::TConfigProcessor::gOptionsProcessed, mpcl::util::prefs::TConfigProcessor::processConfigFile(), readFormData(), and mpcl::text::TString.

void mpcl::net::cgi::TConfigProcessor::readFormData std::basic_istream< char_type, traits_type > &    rtSOURCE_ISTREAM [protected]
 

Loads variables from standard-input in CGI fashion.

Definition at line 151 of file net/cgi/config_processor.cc.

References mpcl::text::html::kcIdentifierValueSeparator, mpcl::text::TString, and updateFormOption().

Referenced by processOptions().

void mpcl::net::cgi::TConfigProcessor::updateForm text::html::TForm   rtTARGET_FORM const
 

Updates form qtTARGET_FORM with values parsed from input (from command-line, or from standard input).

Definition at line 371 of file net/cgi/config_processor.cc.

References mpcl::text::html::TContainer::reset(), and mpcl::text::html::TForm::setValues().

mpcl::util::prefs::TOption & mpcl::net::cgi::TConfigProcessor::updateFormOption const TString &    rkyNAME,
const TString &    rkyVALUE
[protected]
 

Updates form variable named rkyNAME with value rkyVALUE. If there is no form variable named rkyNAME, then a new form option is added.

Parameters:
rkyNAME  Form variable name.
rkyVALUE  Form variable value.
Returns:
The form variable.

Definition at line 214 of file net/cgi/config_processor.cc.

References mpcl::text::TString.

Referenced by readFormData().

mpcl::util::prefs::TOption & mpcl::net::cgi::TConfigProcessor::updateOptionWithName const TString &    rkyNAME,
const TString &    rkyVALUE
[protected, virtual]
 

Updates option named rkyNAME with value rkyVALUE.

Parameters:
rkyNAME  Name of the option.
rkyVALUE  Value to assigned.
Returns:
The option that has been updated.

Reimplemented from mpcl::util::prefs::TConfigProcessor.

Definition at line 254 of file net/cgi/config_processor.cc.

References mpcl::util::prefs::TConfigProcessor::tOptionVector, and mpcl::text::TString.

Referenced by processCommandLine().


The documentation for this class was generated from the following files:
Generated on Mon Oct 13 02:35:25 2003 for MPCL by doxygen1.2.18