% /* vim:set ft=sitecing: */ %%derive layout = "/ancestry/layout.chtml"; %%pragma main=page <%constructor> PN_PREV("/quickref/","quick reference","quick reference"); PN_NEXT("/sources","sources","source browser"); %constructor> <%codemethod string title() %> return "meta syntax quick reference"; %codemethod> <%method void content() %>
% line of code
Break out into the code mode for just one line.
<% expression %>
<< expression into output stream (think c++).
<%code> ... </%code>
Escape from the output mode to code mode. Opposite to <%output>
. Roughly the same as </%output> ... <%output>
(note the reverse order), but more self-explanatory and applies to more cases.
<%codemethod return_type_t member_name(args,...) %>
code
</%codemethod>
Define the member function. Essentially equivalent to <%method ... %><%code> ... </%code></%method>
.
<%codemethod std::string ua() %>
return __CGI->get_meta("USER_AGENT");
</%codemethod>
The user agent is: <% ua() %>
<%constructor>
code
</%constructor>
Provide the code for constructor.
%%var bool is_msie;
<%constructor>
is_msie = (__CGI->get_meta("USER_AGENT").find("MSIE")!=string::npos);
</%constructor>
%%decl line of code
<%decl>
lines of code
</%decl>
Put the line(s) of code into the resulting .h file before the class declaration.
%%derive name = "base-component";
Inherit what is there to be inherited from the base component specified.
<%destructor>
code
</%destructor>
Provide the code for destructor.
%%var type_t *tmp = 0;
<%constructor>
tmp = new type_t(type_t::option_1);
</%constructor>
<%destructor>
delete tmp;
</%destructor>
%%impl line of code
<%impl>
lines of code
</%impl>
Put the line(s) of code into the resulting .cc implementation file before any members definitions.
%%impl #include <string.h>
<%method void output_if_contains(const char *haystack,const char *needle) %>
% if(strstr(haystack,needle)) {
<% haystack %>
% }
</%method>
<%impl>
#include <konforka/exception.h> static const char *tokens[] = {
"token 1", "token 2", "token 3"
};
</%impl>
<%method void output_token(int toknum) %>
<%code>
if(toknum<0 || toknum>=(sizeof(tokens)/sizeof(*tokens)))
throw konforka::exception(CODEPOINT,"out of bounds");
</%code>
<% tokens[toknum] %>
</%method>
<%method return_type_t member_name(args,...) %>
code
</%method>
Define the member function. Essentially equivalent to <%codemethod ... %><%output> ... </%output></%codemethod>
.
<%output> ... </%output>
Escape from the code mode to output mode. Opposite to <%code>
. Roughly the same as </%code> ... <%code>
(note the reverse order), but more self-explanatory and applies to more cases.
<%codemethod void count() %>
for(int t=0;t<10;t++) {
<%output>
Here is the way we count.<br/>
Just saying out loud: <% t %><br/>
</%output>
</%codemethod>
% count();
%%pragma pragma_name
%%pragma pragma_name=pragma_value
provide pseudo instructions to the preprocessor. At this time only pragma
named main
is defined, which instructs preprocessor to discard
the 'main' member that would be generated for the component and call the
main
member of the named base class.
%%var type_t varname;
%%var type_t varname = initalizer;
Define the member variable with optional default value (suitable for
putting into the : varname(initializer)
part of the c++ constructor.