Previous Next Table of Contents

7. Syntax Overview

CGI++ is nothing more than a macro pre-processor that genarates C++ code. Therefore, the syntax is quite simple. You write your C++ code as you normally would and when you want to use a CGI++ macro, you embed it into your code.

There are two types of macros: #define style and START-END. #define style macros are invoked like they are in C and START-END will have an opening tag and a closing tag.

Most macros can incorporate references to C++ expressions that return a type for which there is an ostream& << operator , which covers most types used in C++. To reference a C++ expression inside a macro enclose it between two '$' characters. If you need to have a $ inside a macro, escape it with '\'.

If you have a <form> tag in between HTML_START and HTML_END, CGI++ will generate a class to parse the form input. The instance of the class will be named after the name of the form, and its public members of type string will be named after form inputs.

To use the SQL_ macros you must call SQL_DB_DRIVER and SQL_DECL_DBH in the global variables section of the code.

For details, see the listing of macro directives, html extenstions and the examples.


Previous Next Table of Contents