Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

HTMLClasses.h

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /*
00003  *  $Id: HTMLClasses.h,v 1.9 2002/03/06 02:49:55 sbooth Exp $
00004  *
00005  *  Copyright (C) 1996 - 2002 Stephen F. Booth
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Lesser General Public
00009  *  License as published by the Free Software Foundation; either
00010  *  version 2.1 of the License, or (at your option) any later version.
00011  *
00012  *  This library is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  Lesser General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU Lesser General Public
00018  *  License along with this library; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 // Macros defining types of elements
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 // HTML 4.0 elements - for details see http://www.w3.org/
00076 // ============================================================
00077 
00078 CGICC_BEGIN_NAMESPACE
00079 
00080 // ============================================================
00081 // Class comment - needs special render function
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(STDNS 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");       // HTML document
00104 BOOLEAN_ELEMENT (head,       "head");       // document head
00105 BOOLEAN_ELEMENT (title,      "title");      // document title
00106 ATOMIC_ELEMENT  (meta,       "meta");       // meta data
00107 BOOLEAN_ELEMENT (style,      "style");      // style sheet
00108 BOOLEAN_ELEMENT (body,       "body");       // document body
00109 #if CGICC_USE_NAMESPACES
00110 BOOLEAN_ELEMENT (div,        "div");        // block-level grouping
00111 #else
00112 BOOLEAN_ELEMENT (div_,       "div");        // block-level grouping
00113 #endif
00114 BOOLEAN_ELEMENT (span,       "span");       // inline grouping
00115 BOOLEAN_ELEMENT (h1,         "h1");         // level 1 heading
00116 BOOLEAN_ELEMENT (h2,         "h2");         // level 2 heading
00117 BOOLEAN_ELEMENT (h3,         "h3");         // level 3 heading
00118 BOOLEAN_ELEMENT (h4,         "h4");         // level 4 heading
00119 BOOLEAN_ELEMENT (h5,         "h5");         // level 5 heading
00120 BOOLEAN_ELEMENT (h6,         "h6");         // level 6 heading
00121 BOOLEAN_ELEMENT (address,    "address");    // contact information
00122 
00123 // text markup
00124 
00125 BOOLEAN_ELEMENT (em,         "em");         // emphasis
00126 BOOLEAN_ELEMENT (strong,     "strong");     // stronger emphasis
00127 BOOLEAN_ELEMENT (cite,       "cite");       // citation/reference
00128 BOOLEAN_ELEMENT (dfn,        "dfn");        // defining instance
00129 BOOLEAN_ELEMENT (code,       "code");       // computer code
00130 BOOLEAN_ELEMENT (samp,       "samp");       // sample output
00131 BOOLEAN_ELEMENT (kbd,        "kbd");        // user input
00132 BOOLEAN_ELEMENT (var,        "var");        // variable/argument
00133 BOOLEAN_ELEMENT (abbr,       "abbr");       // abbreviated form
00134 BOOLEAN_ELEMENT (acronym,    "acronym");    // acronym
00135 BOOLEAN_ELEMENT (blockquote, "blockquote"); // block-level quotation
00136 BOOLEAN_ELEMENT (q,          "q");          // inline quotation
00137 BOOLEAN_ELEMENT (sub,        "sub");        // subscript
00138 BOOLEAN_ELEMENT (sup,        "sup");        // superscript
00139 BOOLEAN_ELEMENT (p,          "p");          // paragraph
00140 ATOMIC_ELEMENT  (br,         "br");         // line break
00141 BOOLEAN_ELEMENT (pre,        "pre");        // preformatted text
00142 BOOLEAN_ELEMENT (ins,        "ins");        // inserted text
00143 BOOLEAN_ELEMENT (del,        "del");        // deleted text
00144 BOOLEAN_ELEMENT (bdo,        "bdo");        // overriding direction
00145 
00146 // lists
00147 
00148 BOOLEAN_ELEMENT (ul,         "ul");         // unordered list
00149 BOOLEAN_ELEMENT (ol,         "ol");         // ordered list
00150 BOOLEAN_ELEMENT (li,         "li");         // list item 
00151 BOOLEAN_ELEMENT (dl,         "dl");         // definition list         
00152 BOOLEAN_ELEMENT (dt,         "dt");         // term to be defined
00153 BOOLEAN_ELEMENT (dd,         "dd");         // definition of term
00154 
00155 // tables
00156 
00157 BOOLEAN_ELEMENT (table,      "table");      // table element
00158 BOOLEAN_ELEMENT (caption,    "caption");    // table caption
00159 BOOLEAN_ELEMENT (thead,      "thead");      // table head section
00160 BOOLEAN_ELEMENT (tfoot,      "tfoot");      // table foot section
00161 BOOLEAN_ELEMENT (tbody,      "tbody");      // table body section
00162 BOOLEAN_ELEMENT (colgroup,   "colgroup");   // vertical section
00163 ATOMIC_ELEMENT  (col,        "col");        // column attributes
00164 BOOLEAN_ELEMENT (tr,         "tr");         // table row
00165 BOOLEAN_ELEMENT (th,         "th");         // table header cell
00166 BOOLEAN_ELEMENT (td,         "td");         // table data cell
00167 
00168 // links
00169 
00170 BOOLEAN_ELEMENT (a,          "a");          // anchor
00171 #if CGICC_USE_NAMESPACES
00172 ATOMIC_ELEMENT  (link,       "link");       // document link
00173 #else
00174 ATOMIC_ELEMENT  (link_,      "link");       // document link
00175 #endif
00176 ATOMIC_ELEMENT  (base,       "base");       // path information
00177 
00178 // objects
00179 
00180 ATOMIC_ELEMENT  (img,        "img");        // inline image
00181 BOOLEAN_ELEMENT (object,     "object");     // generic object
00182 ATOMIC_ELEMENT  (param,      "param");      // object parameters
00183 BOOLEAN_ELEMENT (map,        "map");        // client image map
00184 ATOMIC_ELEMENT  (area,       "area");       // image map region
00185 ATOMIC_ELEMENT  (hr,         "hr");         // horizontal rule
00186 
00187 // fonts - preferably use stylesheets
00188 
00189 BOOLEAN_ELEMENT (tt,         "tt");         // monospaced text
00190 BOOLEAN_ELEMENT (i,          "i");          // italic text style
00191 BOOLEAN_ELEMENT (b,          "b");          // bold text style
00192 BOOLEAN_ELEMENT (big,        "big");        // large font
00193 BOOLEAN_ELEMENT (small,      "small");      // small font
00194 
00195 // frames - not part of the strict DTD
00196 
00197 BOOLEAN_ELEMENT (frameset,   "frameset");   // frame layout
00198 ATOMIC_ELEMENT  (frame,      "frame");      // frame contents
00199 BOOLEAN_ELEMENT (noframes,   "noframes");   // alternative text
00200 BOOLEAN_ELEMENT (iframe,     "iframe");     // inline frame
00201 
00202 // forms
00203 
00204 BOOLEAN_ELEMENT (form,       "form");       // form element
00205 ATOMIC_ELEMENT  (input,      "input");      // generic input
00206 BOOLEAN_ELEMENT (button,     "button");     // special button
00207 #if CGICC_USE_NAMESPACES
00208 BOOLEAN_ELEMENT (select,     "select");     // option menu
00209 #else
00210 BOOLEAN_ELEMENT (select_,    "select");     // option menu
00211 #endif
00212 BOOLEAN_ELEMENT (optgroup,   "optgroup");   // option group
00213 BOOLEAN_ELEMENT (option,     "option");     // option item
00214 BOOLEAN_ELEMENT (textarea,   "textarea");   // multi-line text input
00215 BOOLEAN_ELEMENT (label,      "label");      // input label
00216 BOOLEAN_ELEMENT (fieldset,   "fieldset");   // grouping input fields
00217 BOOLEAN_ELEMENT (legend,     "legend");     // caption for field set
00218 
00219 // scripts
00220 
00221 BOOLEAN_ELEMENT (script,     "script");     // script element
00222 BOOLEAN_ELEMENT (noscript,   "noscript");   // alternative text
00223 
00224 CGICC_END_NAMESPACE
00225 
00226 #endif /* ! _HTMLCLASSES_H_ */

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2002 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Sun Mar 17 16:40:57 2002 for cgicc by doxygen 1.2.13.1