CGIParser Class Reference

This class is used to parse 'Post'-Parameters, submitted by a HTML-form. More...

#include <CGIParser.hpp>

List of all members.


Public Member Functions

 CGIParser (string data)
 default constructor
 ~CGIParser ()
 default destructor
string getFieldValue (string name)
string createRefreshForm (string action, string method)
string createOpenForm (string name, string action, string method, string ignoreFields)

Detailed Description

This class is used to parse 'Post'-Parameters, submitted by a HTML-form.

Author:
Klaus Schoeffmann

Definition at line 70 of file CGIParser.hpp.


Member Function Documentation

string CGIParser::createOpenForm string  name,
string  action,
string  method,
string  ignoreFields
 

Returns:
code of an open HTML form (no end tag), containing all passed form fields except the parameters specified in ignoreParams
Definition at line 204 of file CGIParser.cpp.

Referenced by createRefreshForm(), and SessionList::writeHTMLRepresentation().

00205 { 00206 ostringstream str; 00207 00208 str << "\n<form name=\"" << name 00209 << "\" action=\"" << action 00210 << "\" method=\"" << method << "\">" << endl; 00211 00212 map<string, string>::iterator iter = formFields.begin(); 00213 for (; iter != formFields.end(); iter++) 00214 { 00215 //output every received parameters (but no the submit parameter) 00216 if (iter->first != "submit") 00217 { 00218 00219 //do only output field, if name is not in ignore-string 00220 if (ignoreFields.find(iter->first) == string::npos) 00221 { 00222 str << "<input type=\"hidden\" name=\"" 00223 << iter->first << "\" value=\"" 00224 << iter->second << "\">" << endl; 00225 } 00226 00227 } 00228 } 00229 00230 return str.str(); 00231 }

string CGIParser::createRefreshForm string  action,
string  method
 

Returns:
code of a HTML form, containing all passed form fields with corresponding values, which can be used for refreshing the current page.
Definition at line 193 of file CGIParser.cpp.

References createOpenForm().

00194 { 00195 ostringstream str; 00196 00197 str << createOpenForm("refreshForm", action, method, ""); 00198 str << "</form>" << endl; 00199 00200 return str.str(); 00201 }

string CGIParser::getFieldValue string  name  ) 
 

Returns:
the value of a specified field, which was parsed before through the method parseData().
Definition at line 186 of file CGIParser.cpp.

Referenced by MovieList::getHTMLRepresentation(), and SessionList::writeHTMLRepresentation().

00187 { 00188 string decoded = decode(formFields[name]); 00189 return decoded; 00190 }


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