Example CPPSP Page

Declarations outside of the C++ class are denoted with "<%#".
<%# #include <vector> #include <string> vector<string> hello() { return {"hello", "world", "!"}; } %> <html> <body> <table> <%
Inline C++ code is enclosed by "<%" and "%>".
auto a = hello(); for(int i = 0; i < a.size(); i++) { %> <tr> <td><%=a[i] %></td>
"<%=" instructs CPPSP to evaluate the enclosed expression and write the result to the output stream.
</tr> <% } %> </table> </body> </html>

Demo

More examples can be found in the "www" subdirectory inside the cppsp source tarball.

Syntax Reference

Syntax Description Examples
<%! ... %> Specify a compiler option <%!-O3%>
<%@ ... %> Specify a cppsp option <%@ class myclass %>
<%@ class myclass inherits "public cppsp::Page" %>
<%# ... %> Insert C++ code before the class declaration <%#
#include <iostream>
%>
<%$ ... %> Insert C++ code inside the class declaration <%$
void foo() {}
%>
<% ... %> Insert C++ code inline <% foo(); %>

API Reference

The "this" pointer in cppsp pages points to the current instance of the derived cppsp::Page class generated from the page. A new instance of the class is created for each visit of the page.
The API documentation for each version can be found here: