libDwm-0.9.45
Dwm::Cgi Class Reference

This class encapsulates CGI input. More...

#include <DwmCgi.hh>

Public Types

typedef std::map< std::string, std::string > valueMap_t
 
typedef valueMap_t::iterator iterator
 
typedef valueMap_t::const_iterator const_iterator
 

Public Member Functions

 Cgi ()
 Constructor.
 
 ~Cgi ()
 destructor
 
const std::string & RequestMethod () const
 Returns the HTTP request method.
 
const std::string & RequestMethod (const std::string &requestMethod)
 Sets and returns the HTTP request method.
 
valueMap_t & QueryValues ()
 Returns a reference to the query values sent by the client.
 
valueMap_t & EnvValues ()
 

Static Public Member Functions

static void UrlEncode (const std::string &src, std::string &dst)
 Encodes a URL string src into a string dst, with special characters escaped.
 
static std::string UrlEncode (const std::string &src)
 Returns a URL-escaped version of src.
 
static void HtmlEncode (const std::string &src, std::string &dst)
 Encodes a string src into an HTML string dst, with special characters escaped.
 
static std::string HtmlEncode (const std::string &src)
 Returns an HTML-escaped version of src.
 

Detailed Description

This class encapsulates CGI input.

It is used for storing name/value pairs from CGI input (usually HTML forms) sent via an HTTP POST or GET operation. The constructor does the work of getting the data, hence you should likely only have a single Cgi object in a program. I haven't made this class a true singleton, but may do so in the future.

Under the hood... the implementation uses a trivial flex lexer to get CGI data from the environment (in the case of a GET operation) or stdin (in the case of a POST operation). It also unescapes any escape codes in the input values.

Constructor & Destructor Documentation

◆ Cgi()

Dwm::Cgi::Cgi ( )

Constructor.

Retrieves data from CGI and stores name/value pairs (as strings) in a map<string,string,less<string> >. The map is accessible via the QueryStrings() method.

Member Function Documentation

◆ QueryValues()

valueMap_t & Dwm::Cgi::QueryValues ( )

Returns a reference to the query values sent by the client.

These are the name/value pairs from CGI, typically from HTML form fields.


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