class AStreamOutput : public ABase
Container object that routes all output to any ostream derived class. By default all output goes to cout. Provides operators found in ostream and adds functions for formatting output strings.
Method Description
void setOStream
(
   ostream *posNewOut
) public
Allows you to redirect the output of this class to a different ostream child, such as ofstream, ostrstream, etc.

Returns: Nothing
ostream *getOStream
(
void
) public
Access method.

Returns: A pointer to the currently used ostream derived class.
AStreamOutput &operator>>
(
{types used by ostream}
) public
Your basic redirection operator. {types used by ostream}={char, short, long, BYTE, WORD, DWORD, int, UINT, float, double, const char *, signed char, void *, streambuf *, ostream& (*fcn)(ostream&), ios& (*fcn)(ios&)}.

Returns: Reference to this object to allow multiple redirects in one line.
void outString
(
const char *pccOut
) public
A string output method. Checks if pccOut is NULL and if it is outputs "(null)".

Return: Nothing.
void outStringN
(
const char *pccOut
) public
A string output method. Performs NO checks on pccOut (for speed purposes).

Return: Nothing.
void outStringQ
(
const char *pccOut
) public
A string output method. Puts output in quotes. Checks if pccOut is NULL and if it is outputs "(null)".

Return: Nothing.
void outStringCR
(
const char *pccOut
) public
A string output method. Follows output with an endl. Checks if pccOut is NULL and if it is outputs "(null)".

Return: Nothing.
void outStringCRN
(
const char *pccOut
) public
A string output method. Follows output with an endl. Performs NO checks on pccOut (for speed purposes).

Return: Nothing.
class AHTML : public AStreamOutput
This is the main object for HTML based output. Much of HTML functionality has been wrapped up by methods.
Method Description
void htmlStartHTML
(
   void
) public
Start of the HTML page.

Output: <HTML>

Returns: Nothing.
void htmlEndHTML
(
   void
) public
End of the HTML page.

Output: </HTML>

Returns: Nothing.
void htmlStartHEAD
(
   void
) public
Start of the HEAD block.

Output: <HEAD>

Returns: Nothing.
void htmlEndHEAD
(
   void
) public
End of the HEAD block.

Output: </HEAD>

Returns: Nothing.
void htmlDoHEAD
(
   const char *pccTitle,
   const char *pccExtra=NULL
)
A quick warpper that generates the HEAD and TITLE tags.

Output: <HEAD><TITLE>{pccTitle}{pccExtra}</TITLE></HEAD>

Returns: Nothing.
void htmlStartTITLE
(
   void
) public
Start of the TITLE block, which must be inside the HEAD block to have effect.

Output: <TITLE>

Returns: Nothing.
void htmlEndTITLE
(
   void
) public
End of the TITLE block.

Output: </TITLE>

Returns: Nothing.
void htmlDoTITLE
(
   const char *pccTitle,
)
A quick warpper that generates the TITLE tags.

Output: <TITLE>{pccTitle}</TITLE>

Returns: Nothing.
void htmlDoMETA
(
   const char *pccName,
   const char *pccContent
)
A quick warpper that generates the META directives inside the HEAD block. Some useful directives are KEYWORD for spider search engines, AUTHOR for crediting, GENERATOR for specifying what generated this page, etc.

Output: <META NAME="{pccTitle}" CONTENT="{pccExtra}">

Returns: Nothing.
void htmlStartBODY
(
   COLORREF crBack=0x808080,
   COLORREF
crText=0xFFFFFF,
   COLORREF
crLink=0x00DDDD,
   COLORREF
crALink=0x00FFFF,
   COLORREF
crVLink=0x000000,
   const char *pccBack=NULL,
   const char *pccExtra=NULL
)
A wrapper for the start of the BODY block. Allows you to specify color properties and additional BODY elements in {pccExtra}.

Output: <BODY BGCOLOR="#{crBack}" TEXT="#{crText}" LINK="#{crLink}" ALINK="#{crALink}" VLINK="#{crVLink}" BACKGROUND="{pccBack}" {pccExtra}>

Returns: Nothing.
void htmlStartBODY
(
   AElementPairList &eplBody
)
Wrapper function for BODY that allows any number of parameters inside the tag. See also AElementPairList. This accounts for the expansion of HTML in the future and can be used for ONLOAD, ONUNLOAD, etc; now part of JavaScript.

Output: <BODY {E0="V0"} {E1="V1"} ...>

Returns: Nothing.
void htmlEndBODY
(
   void
) public
End of the BODY block.

Output: </BODY>

Returns: Nothing.
void htmlStartTag
(
   const char *pccTag,
   const char *pccExtra=NULL
) public
Start of an HTML tag.

Output: <{pccTag} {pccExtra}>

Returns: Nothing.
void htmlStartTag
(
   const char *pccTag,
   AElementPairList &eplBody
)
Wrapper function for a start of an HTML tag that allows any number of parameters inside the tag. See also AElementPairList. Here eplBody will output: {E0="V0"} {E1="V1"} ... (it's contents quoted).

Output: <{pccTag} {eplBody}>

Returns: Nothing.
void htmlEndTag
(
   const char *pccTag,
) public
Start of an HTML tag.

Output: </{pccTag}>

Returns: Nothing.
void htmlDoTag
(
   const char *pccTag,
   const char *pccText
) public
Wrapper for a simple HTML tag.

Output: <{pccTag}>{pccText}</{pccTag}>

Returns: Nothing.
void htmlDoTagEx
(
   const char *pccTag,
   const char *pccExtra
   const char *pccText
) public
Extended wrapper for a simple HTML tag.

Output: <{pccTag} {pccExtra}>{pccText}</{pccTag}>

Returns: Nothing.
void htmlDoTagEx
(
   const char *pccTag,
   AElementPairList &eplTag,
   const char *pccText
) public
Extended wrapper for a simple HTML tag that supports a variable parameter list using AElementPairList object.
void htmlStartSCRIPT
(
const char *pccLanguage=NULL
) public
Start of a SCRIPT block for embedding JavaScript, LiveScript, etc. scripts into your HTML page.
Output: <SCRIPT LANGUAGE="{pccLanguage}"><!--

Returns: Nothing.
void htmlEndSCRIPT
(
   void
) public
End of the SCRIPT block.

Output: --></SCRIPT>

Returns: Nothing.
void htmlDoSpace
(
   int iN=0x1
) public
A simple way to fill in {iN} hard spaces. White spaces are iignored by browsers.

Output: {iN} number of consequtive &nbsp;

Returns: Nothing.
void htmlDoComment
(
   const char *pcc1,
   const char *pcc2=NULL,
   const char *pcc3=NULL
) public
Wrapper to do an HTML comment.

Output: <!--{pcc1}{pcc2}{pcc3}-->

Returns: Nothing.
void htmlDateTime
(
   void
) public
A basic timestamp using RTL's ctime().

Output: Sample: Thu Aug 1 12:00:00 1996
void mimeOut
(
   const char *pccType,
   const char *pccSubType
   int iContentLength=-1
   ACookie *paCookie=NULL
   int iCookieCount=1
) public
Generic MIME directive to specify what type of document will follow. iContentLength will be added if it's >= 0, if content length is specified many browsers will display the page faster; however it is rarely known how long the content is of non-static content. paCookie is a pointer to a ACookie type to be set, if iCookieCount more than 1, this is a pointer to an array of ACookie's.

Output: Content-Type: {pccType}/{pccSubType}\r\r

Returns: Nothing.
void mimeHTML
(
   ACookie *paCookie=NULL
   int iCookieCount=1
) public
MIME directive to specify that the following output is HTML. paCookie is based on ElementPairList and contains HTTP_COOKIE pairs to be used on the clients page, this is an array of cookies if count is more than 1.

Output: Content-Type: text/html{*paCookie}\r\r

Returns: Nothing.
void mimeXBitmap
(
  void
)
Wrapper for a MIME directive for an X11 bitmap.

Output: Content-Type: image/x-xbitmap\r\r

Returns: Nothing.
class ACGI : RTTI_VIRTUAL public AHTML, RTTI_VIRTUAL public AFormList
This object uses the HTML output of AHTML object and form processing of AFormList. It adds ability to get environment variable, output FORMs, perform basic validation of user input, and other useful methods for CGIs.
Method Description
void cgiEnvironmentDump
(
   int iFullDump=0x0
) public
Dumps the contents of the server environment in an HTML <PRE> block. iFullDump when set to non-zero will do an object dump if everything was compiler with _DEBUG_DUMP_ (not applicable to the shareware version)

Returns: Nothing.
DWORD cgiGetIP
(
   const char *pccIP=NULL
) public
Returns a DWORD that contains the IP address in pccIP in a form of "aaa.bbb.ccc.ddd". If pccIP is NULL, the IP for the user from REMOTE_ADDR is used.

Returns: DWORD replesenting an IP (0xAABBCCDD)
void cgiStartFORM
(
   const char *pccAction=NULL,
   const char *pccMethod=NULL
) public
Starts a FORM submission block. If pccAction is NULL then default is SCRIPT_NAME (which is the current CGI) and if pccMethod is NULL default is POST.

Output: <FORM ACTION="{pccAction}|{SCRIPT_NAME}" METHOD="{pccMethod}|POST">

Returns: Nothing.
void cgiStartFORM
(
   AElementPairList &eplItems
) public
Starts a FORM submission block. Allows any number of parameters via AElementPaitList object.
Output: <FORM {eplItems}>

Returns: Nothing.
void cgiDoFORMInput
(
   int iType,
   AElementPairList &eplItems,
   const char *pccContent=NULL
) public
Used after the FORM block is started, this will generate INPUT types to be used in the FORMs submission.
Following types are valid:
  FORMINPUT_HIDDEN - 0x00 - Hidden item
  FORMINPUT_CHECKBOX - 0x01 - Checkbox control
  FORMINPUT_RADIO - 0x02 - Radio button control
  FORMINPUT_TEXT - 0x03 - Single line text input box
  FORMINPUT_PASSWORD - 0x04 - Same as above, echo *s back
  FORMINPUT_RANGE - 0x05 - Range specifier
  FORMINPUT_SUBMIT - 0x06 - FORM submission button
  FORMINPUT_RESET - 0x07 - FORM reset button
  FORMINPUT_TEXTAREA - 0x08 - Multi-line text edit box
  FORMINPUT_IMAGE - 0x09 - Clickable image
  FORMINPUT_SCRIBBLE - 0x0A - Scribble type (browsers may not support)
  FORMINPUT_FILE - 0x0B - File (browsers may not support)

Output: <INPUT TYPE="{iType}" {eplItems}>{pccContent}

Returns: Nothing.
void cgiEndFORM
(
   void
) public
End of the FORM block.

Output: </FORM>

Returns: Nothing.
int cgiGetFormItems
(
   istream *pisInput=NULL
) public
This is the main function for retrieving FORM submissions, one call to this function will get all pairs possible; POST is cin and QUERY_STRING, GET is QUERY_STRING only. Optionally it can use pisInput istream, if NULL then default is to use cin if POST and QUERY_STRING. AFormList parent object contains all form items after this call, use its (and its parents) methods to query the submissions.

Returns: Number of submitted items found.
int cgiGetFormItems
(
   const char *pccInput=NULL
) public
Retrieves FORM submissions using pccInput, if NULL then default is to use cin if POST and QUERY_STRING. AFormList parent object contains all form items after this call. Provided mainly to allow debugging of your CGI using a debugger.

Returns: Number of submitted items found.
int cgiGetQueryStringItems
(
   const char *pccInput=NULL
) public
Use this method when you only want to retrieve QUERY_STRING content and skip cin. This will also allow you to debug a string.

Returns: Number of submitted items found.
int cgiIsGET
(
   void
) public
Access to REQUEST_METHOD environment variable.

Returns: Non-zero if GET method was used in a FORM submission to this CGI.
int cgiIsPOST
(
   void
) public
Access to REQUEST_METHOD environment variable.

Returns: Non-zero if POST method was used in a FORM submission to this CGI.
int cgiIsValidEMail
(
   const char *pccTest
) public
Performs a basic check on an E-Mail address. Checks the presence of '@' and a '.' in the server's name.

Returns: Non-zero if the E-Mail is "valid-looking."
int cgiIsWithoutMetaChar (
   const char *pccTest,
   int iStrict=0x0
) public
Checks the string for existance of UNIX meta-characters. if iStrict is non-zero, a strict test is done which includes quotes which are valid HTML characters. Meta-characters are dangerous, since some may force you to accidentally execute shells or programs through redirection. If you are planning to use the user's input as a parameter to an executable, pass it through this for peace of mind.

Returns: Non-zero if the string is without any meta-characters.
int cgiIsValidHTMLTag
(
   const char *pccTest
) public
Checks if the string can possibly be a valid HTML tag. Checks for the presence of <, >, patching quotes, and no meta characters.

Returns: Non-zero if the string contains a valid HTML tag.
int cgiIsValidURLProtocol
(
   const char *pccTest
) public
Checks if a valid HTTP protocol is specified. {Protocol}={"http:", "ftp:", "file:", "gopher:", "mailto:", "news:", "telnet:", "tn3270:", "rlogin:", "wais:"}.

Returns: Non-zero if protocl is valid.
int cgiIsNotValidHTMLLine
(
   const char *pccTest
) public
Given a string, it will check to see if it contains any HTML directives or characters that may cause havoc if embedded into the page.

Returns: Zero if it is valid.
char *cgiValidateHTMLLine
(
   char *pcLine
) public
Takes a string and checks if it contains a valid HTML tag, quotes are paired and meta-characters are not present. If there is a problem it will replace the tag with a comment.

Returns: A pointer to the string for convenience.
void cgiEncodeAndOutputURL
(
  const char *pccSource,
  int iLength=-0x1
) public
A wrapper that takes a string, encodes it for URL transmission (hex to %XX) and ouputs it to the current ostream.

Output: {URLEncode(pccSource)}

Returns: Nothing.
const char *cgiGetSafeEnv
(
  const char *pEnvName
) public
Calls RTL's getenv(), but if a return is NULL a valid string "(null)" is returned instead.

Returns: A valid string that the environment variable called {pEnvName} is assigned to or "(null)" is none.
const char *cgiGet{ENV_VAR}
(
  int iOut=0x0
) public
Wrapper for environment variable retrieval, if iOut is non-zero, it is routed to the current ostream as well.
(See a_stream.h for the list of these wrappers)

Output: Environment variable's value or "(null)"

Returns: Returns environment variable's value or "(null)"
int cgiOutputBinary
(
  const char *pccMIMEType,
  const char *pccMIMESubType,
  const char *pccFilePath
) public
Wrapper fir outputing a binary file {pccFilePath} as Content-Type: {pccMIMEType}/{pccMIMESubType}. Useful for outputting images when inlined or non-HTML files from you CGI.

Output: Binary file specified in that MIME type/subtype

Returns: Returns non-zero if successful