example.cpp

00001 /*
00002  * $Id: example_8cpp-source.html,v 1.1 2007/07/03 21:34:43 sebdiaz Exp $ 
00003  *
00004  * Skeleton of a CGI application written using the GNU cgicc library
00005  */
00006 
00007 #include <exception>
00008 #include <iostream>
00009 
00010 #include "cgicc/Cgicc.h"
00011 #include "cgicc/HTTPHTMLHeader.h"
00012 #include "cgicc/HTMLClasses.h"
00013 
00014 using namespace std;
00015 using namespace cgicc;
00016 
00017 int
00018 main(int argc, 
00019      char **argv)
00020 {
00021   try {
00022     Cgicc cgi;
00023     
00024     // Output the HTTP headers for an HTML document, and the HTML 4.0 DTD info
00025     cout << HTTPHTMLHeader() << HTMLDoctype(HTMLDoctype::eStrict) << endl;
00026     cout << html().set("lang", "en").set("dir", "ltr") << endl;
00027 
00028     // Set up the page's header and title.
00029     cout << head() << endl;
00030     cout << title() << "GNU cgicc v" << cgi.getVersion() << title() << endl;
00031     cout << head() << endl;
00032     
00033     // Start the HTML body
00034     cout << body() << endl;
00035 
00036     // Print out a message
00037     cout << h1("Hello, world from GNU cgicc") << endl;
00038 
00039     // Close the document
00040     cout << body() << html();
00041   }
00042   
00043   catch(const exception& e) {
00044     // handle error condition
00045   }
00046   
00047   return 0;
00048 }

Generated on Tue Jul 3 15:44:29 2007 for GNUCgicc by  doxygen 1.5.1