HTMLClasses.h
Go to the documentation of this file.
1/* -*-mode:c++; c-file-style: "gnu";-*- */
2/*
3 * $Id: HTMLClasses.h,v 1.17 2014/04/23 20:55:05 sebdiaz Exp $
4 *
5 * Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
6 * 2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
7 * Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 3 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
22 */
23
24#ifndef _HTMLCLASSES_H_
25#define _HTMLCLASSES_H_ 1
26
33#include "CgiDefs.h"
34#include "HTMLAtomicElement.h"
35#include "HTMLBooleanElement.h"
36#include "HTMLDoctype.h"
37
38// ============================================================
39// Macros defining types of elements
40// ============================================================
41
48#define TAG(name, tag) \
49class name##Tag \
50{ public: inline static const char* getName() { return tag; } }
51
60#define ATOMIC_ELEMENT(name, tag) \
61TAG(name, tag); typedef HTMLAtomicElement<name##Tag> name
62
72#define BOOLEAN_ELEMENT(name, tag) \
73TAG(name, tag); typedef HTMLBooleanElement<name##Tag> name
74
75
76// ============================================================
77// HTML 4.0 elements - for details see http://www.w3.org/
78// ============================================================
79
80namespace cgicc {
81
82 // ============================================================
83 // Class comment - needs special render function
84 // ============================================================
85
86 class nullTag
87 { public: inline static const char* getName() { return 0; } };
88
92 class comment : public HTMLBooleanElement<nullTag>
93 {
94 virtual void render(std::ostream& out) const
95 {
96 if(getData().empty() && false == dataSpecified()) {
97 swapState();
98 out << (getState() ? "<!-- " : " -->");
99 }
100 else
101 out << "<!-- " << getData() << " -->";
102 }
103 };
104
105 BOOLEAN_ELEMENT (html, "html"); // HTML document
106 BOOLEAN_ELEMENT (head, "head"); // document head
107 BOOLEAN_ELEMENT (title, "title"); // document title
108 ATOMIC_ELEMENT (meta, "meta"); // meta data
109 BOOLEAN_ELEMENT (style, "style"); // style sheet
110 BOOLEAN_ELEMENT (body, "body"); // document body
111 BOOLEAN_ELEMENT (div, "div"); // block-level grouping
112 BOOLEAN_ELEMENT (span, "span"); // inline grouping
113 BOOLEAN_ELEMENT (h1, "h1"); // level 1 heading
114 BOOLEAN_ELEMENT (h2, "h2"); // level 2 heading
115 BOOLEAN_ELEMENT (h3, "h3"); // level 3 heading
116 BOOLEAN_ELEMENT (h4, "h4"); // level 4 heading
117 BOOLEAN_ELEMENT (h5, "h5"); // level 5 heading
118 BOOLEAN_ELEMENT (h6, "h6"); // level 6 heading
119 BOOLEAN_ELEMENT (address, "address"); // contact information
120
121 // text markup
122
123 BOOLEAN_ELEMENT (em, "em"); // emphasis
124 BOOLEAN_ELEMENT (strong, "strong"); // stronger emphasis
125 BOOLEAN_ELEMENT (cite, "cite"); // citation/reference
126 BOOLEAN_ELEMENT (dfn, "dfn"); // defining instance
127 BOOLEAN_ELEMENT (code, "code"); // computer code
128 BOOLEAN_ELEMENT (samp, "samp"); // sample output
129 BOOLEAN_ELEMENT (kbd, "kbd"); // user input
130 BOOLEAN_ELEMENT (var, "var"); // variable/argument
131 BOOLEAN_ELEMENT (abbr, "abbr"); // abbreviated form
132 BOOLEAN_ELEMENT (acronym, "acronym"); // acronym
133 BOOLEAN_ELEMENT (blockquote, "blockquote"); // block-level quotation
134 BOOLEAN_ELEMENT (q, "q"); // inline quotation
135 BOOLEAN_ELEMENT (sub, "sub"); // subscript
136 BOOLEAN_ELEMENT (sup, "sup"); // superscript
137 BOOLEAN_ELEMENT (p, "p"); // paragraph
138 ATOMIC_ELEMENT (br, "br"); // line break
139 BOOLEAN_ELEMENT (pre, "pre"); // preformatted text
140 BOOLEAN_ELEMENT (ins, "ins"); // inserted text
141 BOOLEAN_ELEMENT (del, "del"); // deleted text
142 BOOLEAN_ELEMENT (bdo, "bdo"); // overriding direction
143
144 // lists
145
146 BOOLEAN_ELEMENT (ul, "ul"); // unordered list
147 BOOLEAN_ELEMENT (ol, "ol"); // ordered list
148 BOOLEAN_ELEMENT (li, "li"); // list item
149 BOOLEAN_ELEMENT (dl, "dl"); // definition list
150 BOOLEAN_ELEMENT (dt, "dt"); // term to be defined
151 BOOLEAN_ELEMENT (dd, "dd"); // definition of term
152
153 // tables
154
155 BOOLEAN_ELEMENT (table, "table"); // table element
156 BOOLEAN_ELEMENT (caption, "caption"); // table caption
157 BOOLEAN_ELEMENT (thead, "thead"); // table head section
158 BOOLEAN_ELEMENT (tfoot, "tfoot"); // table foot section
159 BOOLEAN_ELEMENT (tbody, "tbody"); // table body section
160 BOOLEAN_ELEMENT (colgroup, "colgroup"); // vertical section
161 ATOMIC_ELEMENT (col, "col"); // column attributes
162 BOOLEAN_ELEMENT (tr, "tr"); // table row
163 BOOLEAN_ELEMENT (th, "th"); // table header cell
164 BOOLEAN_ELEMENT (td, "td"); // table data cell
165
166 // links
167
168 BOOLEAN_ELEMENT (a, "a"); // anchor
169 ATOMIC_ELEMENT (link, "link"); // document link
170 ATOMIC_ELEMENT (base, "base"); // path information
171
172 // objects
173
174 ATOMIC_ELEMENT (img, "img"); // inline image
175 BOOLEAN_ELEMENT (object, "object"); // generic object
176 ATOMIC_ELEMENT (param, "param"); // object parameters
177 BOOLEAN_ELEMENT (map, "map"); // client image map
178 ATOMIC_ELEMENT (area, "area"); // image map region
179 ATOMIC_ELEMENT (hr, "hr"); // horizontal rule
180
181 // fonts - preferably use stylesheets
182
183 BOOLEAN_ELEMENT (tt, "tt"); // monospaced text
184 BOOLEAN_ELEMENT (i, "i"); // italic text style
185 BOOLEAN_ELEMENT (b, "b"); // bold text style
186 BOOLEAN_ELEMENT (big, "big"); // large font
187 BOOLEAN_ELEMENT (small, "small"); // small font
188
189 // frames - not part of the strict DTD
190
191 BOOLEAN_ELEMENT (frameset, "frameset"); // frame layout
192 ATOMIC_ELEMENT (frame, "frame"); // frame contents
193 BOOLEAN_ELEMENT (noframes, "noframes"); // alternative text
194 BOOLEAN_ELEMENT (iframe, "iframe"); // inline frame
195
196 // forms
197
198 BOOLEAN_ELEMENT (form, "form"); // form element
199 ATOMIC_ELEMENT (input, "input"); // generic input
200 BOOLEAN_ELEMENT (button, "button"); // special button
201 BOOLEAN_ELEMENT (select, "select"); // option menu
202 BOOLEAN_ELEMENT (optgroup, "optgroup"); // option group
203 BOOLEAN_ELEMENT (option, "option"); // option item
204 BOOLEAN_ELEMENT (textarea, "textarea"); // multi-line text input
205 BOOLEAN_ELEMENT (label, "label"); // input label
206 BOOLEAN_ELEMENT (fieldset, "fieldset"); // grouping input fields
207 BOOLEAN_ELEMENT (legend, "legend"); // caption for field set
208
209 // scripts
210
211 BOOLEAN_ELEMENT (script, "script"); // script element
212 BOOLEAN_ELEMENT (noscript, "noscript"); // alternative text
213
214} // namespace cgicc
215
216#endif /* ! _HTMLCLASSES_H_ */
Platform and operating system specific macro definitions.
Template class for concrete atomic HTMLElement subclasses.
Template class for concrete boolean HTMLElement subclasses.
#define ATOMIC_ELEMENT(name, tag)
Create an atomic HTML element.
Definition HTMLClasses.h:60
#define BOOLEAN_ELEMENT(name, tag)
An HTML element maintaining an internal on/off state.
Definition HTMLClasses.h:72
Class which specifies the DTD of the HTML 4 document.
Template for concrete atomic HTMLElement subclasses.
Template for concrete boolean HTMLElement subclasses.
virtual bool getState() const
Get the state of this boolean element.
virtual void swapState() const
Swap the state of this boolean element.
std::string getData() const
Get the data contained in this element, if any.
bool dataSpecified() const
For subclasses only.
An HTML comment.
Definition HTMLClasses.h:93
The namespace containing the cgicc library.
Definition Cgicc.h:52

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 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 Mon Apr 22 2024 09:44:00 for cgicc by doxygen 1.9.8