From 0234b0ae9ba19a37771a8e7d519137fa811c206c 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.
+ I am adding the component meta-syntax quick
+ reference.
site-C-ing quick reference
- <body>@@ -63,10 +65,12 @@ << expression into output stream (think c++).
- % for(int t=0;t<10;t++) {
- Here is the way we count.<br/>
- Just saying out loud: <% t %><br/>
- % }
- </body> +
- % for(int t=0;t<10;t++) {@@ -79,18 +83,21 @@
- Here is the way we count.<br/>
- Just saying out loud: <% t %><br/>
- % } +
<%output>
. Roughly the same as </%output> ... <%output>
(note the reverse order), but more self-explanatory and applies to more cases.
+
+ 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.
- <body>
- <%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> +
<%method ... %><%code> ... </%code></%method>
.
- <%codemethod std::string ua() %>@@ -131,10 +140,12 @@ Provide the code for constructor.
- return __CGI->get_meta("USER_AGENT");
- </%codemethod>
- The user agent is: <% ua() %>
++ <%codemethod std::string ua() %>
+ return __CGI->get_meta("USER_AGENT");
+ </%codemethod>
+ The user agent is: <% ua() %>
+
- %%var bool is_msie;@@ -159,14 +170,16 @@ class declaration.
- <%constructor>
- is_msie = (__CGI->get_meta("USER_AGENT").find("MSIE")!=string::npos);
- </%constructor>
++ %%var bool is_msie;
+ <%constructor>
+ is_msie = (__CGI->get_meta("USER_AGENT").find("MSIE")!=string::npos);
+ </%constructor>
+
- %%decl #include <string>@@ -181,8 +194,10 @@ Inherit what is there to be inherited from the base component specified.
- %%var std::string str = "default"
- <%decl>
- typedef int integer_t;
- </%decl>
- <%method void do_nothing(integer_t input) %>
- nothing is done
- </%method> +
- %%derive pagelayout = "/ancestry/page_layout.chtml";@@ -201,13 +216,15 @@ Provide the code for destructor.
- % pagelayout::member_function(); +
- %%var type_t *tmp = 0;@@ -232,25 +249,27 @@ before any members definitions.
- <%constructor>
- tmp = new type_t(type_t::option_1);
- </%constructor>
- <%destructor>
- delete tmp;
- </%destructor>
++ %%var type_t *tmp = 0;
+ <%constructor>
+ tmp = new type_t(type_t::option_1);
+ </%constructor>
+ <%destructor>
+ delete tmp;
+ </%destructor>
+
- %%impl #include <string.h>@@ -269,10 +288,12 @@ Define the member function. Essentially equivalent to
- <%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>
++ %%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>
+
<%codemethod ... %><%output> ... </%output></%codemethod>
.
- <%method void emphasized(const char *t) %>@@ -289,14 +310,16 @@ Escape from the code mode to output mode. Opposite to
- <em><% t %></em>
- </%method>
- % emphasized("emphasized text"); +
<%code>
. Roughly the same as </%code> ... <%code>
(note the reverse order), but more self-explanatory and applies to more cases.
- <%codemethod void count() %>@@ -315,16 +338,18 @@ the 'main' member that would be generated for the component and call the
- for(int t=0;t<10;t++) {
- <%output>
- Here is the way we count.<br/>
- Just saying out loud: <% t %><br/>
- </%output>
- </%codemethod>
- % count(); ++ <%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(); +
main
member of the named base class.
- %%derive pagelayout = "/ancestry/page_layout.chtml";% /* %%var */
- %%pragma main=pagelayout +
%%var type_t varname;
- %%var type_t varname = initalizer;
+ %%var type_t varname;
+ %%var type_t varname = initalizer;
- %%var std::string strval = "default value";
- %%var int usecount = 0;
- %%var int whatnot; +