ClearSilver::CGI Class Reference

Encapsulation of CGI environment. More...

#include <CGI.h>

Inheritance diagram for ClearSilver::CGI:

ClearSilver::TraceObject List of all members.

Public Member Functions

Constructors and assignment operators
 CGI ()
 Default constructor.
 CGI (const HDF &)
 Constructor from an HDF dataset.
 CGI (const CGI &)
 Copy constructor.
 ~CGI () throw ()
 Destructor.
CGIoperator= (const CGI &)
 Assignment operator.
void swap (CGI &) throw ()
 Swap contents with another object.
 operator bool () const
 Is a CGI environment defined?
Accessors
ConstHDF hdf () const
 Retrieve the HDF dataset.
HDF hdf ()
 Retrieve the HDF dataset.
std::string DocumentRoot () const
 Retrieve the DocumentRoot value.
std::string ScriptFilename () const
 Retrieve the ScriptFilename value.
std::string ScriptDirectory () const
 Retrieve the directory portion of the ScriptFilename value.
std::string ScriptBasename () const
 Retrieve the basename portion of the ScriptFilename value.
std::string ScriptBasename (const char *suffix) const
 Retrieve the basename portion of the ScriptFilename value.
std::string ScriptBasename (const std::string &suffix) const
 Retrieve the basename portion of the ScriptFilename value.
Display methods
Interpret the HDF dataset with the named ClearSilver template file and display the contents to the standard output.

void display (const char *cs_file) const
void display (const std::string &cs_file) const
URI redirection
void redirect (const URL &)
 Redirect to a full URI.
void redirect_path (const URL &)
 Redirect to a new path within the same protocol/host/port.
Cookie management
void set (const Cookie &)
 Set an HTTP cookie.
void clear (const Cookie &)
 Clear an HTTP cookie.
Cookie::Authority cookie_authority (const char *host) const
 Retrieve the cookie authority.
Cookie::Authority cookie_authority (const std::string &host) const
 Retrieve the cookie authority.
File upload handling
The file upload functions return a pointer to the C FILE associated with a file that was uploaded using multipart/form-data. The FILE is positioned at the start of the file when first available. The argument to these functions is the form name that the file was uploaded as, not the filename on the client system. If the argument is empty or NULL, the returned stream is associated with the PUT upload.

Note that the UploadIstream and basic_UploadIstream classes are available for converting the FILE* to C++ istream or basic_istream objects, respectively. This allows one to manage the uploaded file using the standard C++ stream API.

std::FILE * upload () const
std::FILE * upload (const char *) const
std::FILE * upload (const std::string &) const

Static Public Member Functions

static bool & debug ()
 Access the debug flag.

Detailed Description

Encapsulation of CGI environment.

This class encapsulates the ClearSilver (http://www.clearsilver.net/) CGI environment. It largely manages pointers to the ClearSilver CGI structure and the enclosed HDF dataset. Members provide access to the enclosed HDF structure, to HTTP cookie management, and to file upload capabilities. Additionally, direct access is provided to a few commonly used elements from the CGI environment, which are particularly useful for creating paths to likely locations of other datasets or ClearSilver templates.

Note that all copies of a CGI object share the enclosed HDF dataset. Likewise, a CGI object constructed from an HDF dataset shares its enclosed dataset with the original.

Definition at line 80 of file CGI.h.


Member Function Documentation

bool & ClearSilver::CGI::debug  )  [static]
 

Access the debug flag.

If the debug flag is true, syslog(3) messages with priority LOG_DEBUG will be logged.

Definition at line 296 of file CGI.cc.

std::string ClearSilver::CGI::ScriptBasename const std::string suffix  )  const
 

Retrieve the basename portion of the ScriptFilename value.

This method is analogous to the Unix function of the same name, basename(1). It deletes any prefix ending with the last slash '/' character present in the ScriptFilename value and any matching suffix, if given.

string ClearSilver::CGI::ScriptBasename const char *  suffix  )  const
 

Retrieve the basename portion of the ScriptFilename value.

This method is analogous to the Unix function of the same name, basename(1). It deletes any prefix ending with the last slash '/' character present in the ScriptFilename value and any matching suffix, if given.

Definition at line 192 of file CGI.cc.

References ScriptBasename().

string ClearSilver::CGI::ScriptBasename  )  const
 

Retrieve the basename portion of the ScriptFilename value.

This method is analogous to the Unix function of the same name, basename(1). It deletes any prefix ending with the last slash '/' character present in the ScriptFilename value.

Definition at line 183 of file CGI.cc.

References ClearSilver::ConstHDFNode::get_value(), hdf(), and std::basic_string< _CharT, _Traits, _Alloc >::rfind().

Referenced by ScriptBasename().

void ClearSilver::CGI::set const Cookie  ) 
 

Set an HTTP cookie.

This function includes the contents of a cookie in a Set-Cookie: HTTP header.

Definition at line 248 of file CGI.cc.


The documentation for this class was generated from the following files:
Generated on Tue May 16 14:50:53 2006 for ClearSilver C++ Library by  doxygen 1.4.5