From 8e7ab6661815e333ee9377c2655a03aee89372c2 Mon Sep 17 00:00:00 2001
From: Michael Krelin
+ I am hoping to put together some quick reference documentation here. For now,
+ I am adding the component meta-syntax quick reference.
+ site-C-ing quick reference
+ site-C-ing meta syntax quick reference
+
+ Table of Contents
+
+
+
+
+
+ <body>+ + +% /* %codemethod */ +
+ <%code>
+ for(int t=0;t<10;t++) {
+ <%output>
+ Here is the way we count.<br/>
+ Just saying out loud: <% t %><br/>
+ </%output>
+ </%code>
+ </body> +
+ <%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. +
++ %%decl #include <string>+
+ %%var std::string str = "default"
+ <%decl>
+ typedef int integer_t;
+ </%decl>
+ <%method void do_nothing(integer_t input) %>
+ nothing is done
+ </%method> +
%%derive name = "base-component";
+
+ + Inherit what is there to be inherited from the base component specified. +
++ %%derive pagelayout = "/ancestry/page_layout.chtml";+
+ % pagelayout::member_function(); +
+ <%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>
.
+
+ <%method void emphasized(const char *t) %>+
+ <em><% t %></em>
+ </%method>
+ % emphasized("emphasized text"); +
+ <%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.
+ %%derive pagelayout = "/ancestry/page_layout.chtml";+
+ %%pragma main=pagelayout +
%%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.
+
+ %%var std::string strval = "default value";+
+ %%var int usecount = 0;
+ %%var int whatnot; +