00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _HTMLCLASSES_H_
00023 #define _HTMLCLASSES_H_ 1
00024
00031 #include "cgicc/CgiDefs.h"
00032 #include "cgicc/HTMLAtomicElement.h"
00033 #include "cgicc/HTMLBooleanElement.h"
00034 #include "cgicc/HTMLDoctype.h"
00035
00036
00037
00038
00039
00046 #define TAG(name, tag) \
00047 class name##Tag \
00048 { public: inline static const char* getName() { return tag; } }
00049
00058 #define ATOMIC_ELEMENT(name, tag) \
00059 TAG(name, tag); typedef HTMLAtomicElement<name##Tag> name
00060
00070 #define BOOLEAN_ELEMENT(name, tag) \
00071 TAG(name, tag); typedef HTMLBooleanElement<name##Tag> name
00072
00073
00074
00075
00076
00077
00078 namespace cgicc {
00079
00080
00081
00082
00083
00084 class nullTag
00085 { public: inline static const char* getName() { return 0; } };
00086
00090 class comment : public HTMLBooleanElement<nullTag>
00091 {
00092 virtual void render(std::ostream& out) const
00093 {
00094 if(getData().empty() && dataSpecified() == false) {
00095 swapState();
00096 out << (getState() ? "<!-- " : " -->");
00097 }
00098 else
00099 out << "<!-- " << getData() << " -->";
00100 }
00101 };
00102
00103 BOOLEAN_ELEMENT (html, "html");
00104 BOOLEAN_ELEMENT (head, "head");
00105 BOOLEAN_ELEMENT (title, "title");
00106 ATOMIC_ELEMENT (meta, "meta");
00107 BOOLEAN_ELEMENT (style, "style");
00108 BOOLEAN_ELEMENT (body, "body");
00109 BOOLEAN_ELEMENT (div, "div");
00110 BOOLEAN_ELEMENT (span, "span");
00111 BOOLEAN_ELEMENT (h1, "h1");
00112 BOOLEAN_ELEMENT (h2, "h2");
00113 BOOLEAN_ELEMENT (h3, "h3");
00114 BOOLEAN_ELEMENT (h4, "h4");
00115 BOOLEAN_ELEMENT (h5, "h5");
00116 BOOLEAN_ELEMENT (h6, "h6");
00117 BOOLEAN_ELEMENT (address, "address");
00118
00119
00120
00121 BOOLEAN_ELEMENT (em, "em");
00122 BOOLEAN_ELEMENT (strong, "strong");
00123 BOOLEAN_ELEMENT (cite, "cite");
00124 BOOLEAN_ELEMENT (dfn, "dfn");
00125 BOOLEAN_ELEMENT (code, "code");
00126 BOOLEAN_ELEMENT (samp, "samp");
00127 BOOLEAN_ELEMENT (kbd, "kbd");
00128 BOOLEAN_ELEMENT (var, "var");
00129 BOOLEAN_ELEMENT (abbr, "abbr");
00130 BOOLEAN_ELEMENT (acronym, "acronym");
00131 BOOLEAN_ELEMENT (blockquote, "blockquote");
00132 BOOLEAN_ELEMENT (q, "q");
00133 BOOLEAN_ELEMENT (sub, "sub");
00134 BOOLEAN_ELEMENT (sup, "sup");
00135 BOOLEAN_ELEMENT (p, "p");
00136 ATOMIC_ELEMENT (br, "br");
00137 BOOLEAN_ELEMENT (pre, "pre");
00138 BOOLEAN_ELEMENT (ins, "ins");
00139 BOOLEAN_ELEMENT (del, "del");
00140 BOOLEAN_ELEMENT (bdo, "bdo");
00141
00142
00143
00144 BOOLEAN_ELEMENT (ul, "ul");
00145 BOOLEAN_ELEMENT (ol, "ol");
00146 BOOLEAN_ELEMENT (li, "li");
00147 BOOLEAN_ELEMENT (dl, "dl");
00148 BOOLEAN_ELEMENT (dt, "dt");
00149 BOOLEAN_ELEMENT (dd, "dd");
00150
00151
00152
00153 BOOLEAN_ELEMENT (table, "table");
00154 BOOLEAN_ELEMENT (caption, "caption");
00155 BOOLEAN_ELEMENT (thead, "thead");
00156 BOOLEAN_ELEMENT (tfoot, "tfoot");
00157 BOOLEAN_ELEMENT (tbody, "tbody");
00158 BOOLEAN_ELEMENT (colgroup, "colgroup");
00159 ATOMIC_ELEMENT (col, "col");
00160 BOOLEAN_ELEMENT (tr, "tr");
00161 BOOLEAN_ELEMENT (th, "th");
00162 BOOLEAN_ELEMENT (td, "td");
00163
00164
00165
00166 BOOLEAN_ELEMENT (a, "a");
00167 ATOMIC_ELEMENT (link, "link");
00168 ATOMIC_ELEMENT (base, "base");
00169
00170
00171
00172 ATOMIC_ELEMENT (img, "img");
00173 BOOLEAN_ELEMENT (object, "object");
00174 ATOMIC_ELEMENT (param, "param");
00175 BOOLEAN_ELEMENT (map, "map");
00176 ATOMIC_ELEMENT (area, "area");
00177 ATOMIC_ELEMENT (hr, "hr");
00178
00179
00180
00181 BOOLEAN_ELEMENT (tt, "tt");
00182 BOOLEAN_ELEMENT (i, "i");
00183 BOOLEAN_ELEMENT (b, "b");
00184 BOOLEAN_ELEMENT (big, "big");
00185 BOOLEAN_ELEMENT (small, "small");
00186
00187
00188
00189 BOOLEAN_ELEMENT (frameset, "frameset");
00190 ATOMIC_ELEMENT (frame, "frame");
00191 BOOLEAN_ELEMENT (noframes, "noframes");
00192 BOOLEAN_ELEMENT (iframe, "iframe");
00193
00194
00195
00196 BOOLEAN_ELEMENT (form, "form");
00197 ATOMIC_ELEMENT (input, "input");
00198 BOOLEAN_ELEMENT (button, "button");
00199 BOOLEAN_ELEMENT (select, "select");
00200 BOOLEAN_ELEMENT (optgroup, "optgroup");
00201 BOOLEAN_ELEMENT (option, "option");
00202 BOOLEAN_ELEMENT (textarea, "textarea");
00203 BOOLEAN_ELEMENT (label, "label");
00204 BOOLEAN_ELEMENT (fieldset, "fieldset");
00205 BOOLEAN_ELEMENT (legend, "legend");
00206
00207
00208
00209 BOOLEAN_ELEMENT (script, "script");
00210 BOOLEAN_ELEMENT (noscript, "noscript");
00211
00212 }
00213
00214 #endif