CGIParse
Public functionality:
The library is fairly simple in usage. The constructor CGIparse() parses all the form
contents and inserts the key value pairs into a linked list (a future implementation would be
done perhaps with a hash table). The body of any CGI program can then call a series of public
functions to inspect the data inside of the CGIparse object:
Public Inspectors of the class:
- defined( const char* key ) //returns 0 if key is not-found, and non-zero if key is found.
- const char* valueOf( const char* key, const UINT index = 0 ) //returns value of key, or NULL if not found.
- const char* getNextValue() //returns next value of last key looked up with valueOf, or NULL if only one value exists.
- unsigned int getSize() //returns the number of key/value pairs stored in the object.
- const char* getMethod() //returns either GET or POST depending on the form submission.
- const node* getHead() //returns a pointer to the front of the linked list of key/value pairs
- void formDump() //prints a formatted HTML table of all the key/value pairs in the object
Public modifiers of the class:
- void addKey( const char* key, const char* value ) //adds a key and value to the object.
- void replaceKey( const char* key, const char* newval ) //replaces a value of a key if found.
- void removeKey( const char* key ) //removes a key and it's value from the object.
Class wide functions (static functions):
- static void envDump() //displays all the environment variables available to object.
Note: WIN32 platforms list all enviornment variables apart from the ones defined in the header file.
- static void endMessage( const char* title, const char* mes ) //stops program with HTML message displayed in the clientbrowser.
- static void printMime( const char* mime = "text/html", bool isLast = false) //prints the CGI
- static bool mimeSent() //returns true if mime-type has already been sent to the browser (Note printMime() checks this before sending the mime type).
|