Utility:
A library written in C++ to make writing CGI programs for the web easier.
It does the parsing, data escaping and unescaping for you. It also sends
response headers in the correct format.
Instructions:
The following are the components (classes) of the library:
CCGIEnv:
The main class. It parses input and puts the name-value pairs into data
structures. It formats the output messages to be sent out from the CGI program.
CDataPair:
A class to simplify storage, manipulation and retrieval of name-value pairs.
One restriction is that names or values cannot be empty strings.
CTokenReplacer:
A class to prepare complete HTML (or any other format) output from a template
containing tokens to be replaced and the values that are to be replaced.
Along with the CGI library a GuestBook application is also included as an example.
The GuestBook is quite versatile. You can customize the guestbook, add new fields,
change the order and name of fields, without changing a single line of code! All
you need to change is the html template.
The following classes and files make the guest book:
CGBHandler:
A class that contains routines to read and add to a data file containing the
guestbook entries.
GuestBook:
A simple guest book for your home page. Implemented to demonstrate and test the
capabilities of the CGI library CGI++. It requires two html template files - one
partial html to format the appearance of each of the guest book entries as they
will be displayed, and the other to display the guest book page as a whole. This
application must be called with the mode (GBMODE) as a query parameter. Valid
values are "add" and "show". The show mode displays the last
10 entries in the guest book and the add mode adds a new entry to the guest book.
Platform compatibility:
The code has been compiled purified and tested on both Windows (NT) and UNIX
(Digital) platforms. Make sure UNIX is defined while compiling on UNIX platform.
Download:
cgicpp.zip (sources)