00001 #ifndef hpp_CPP_GenericElements_CPP_hpp
00002 #define hpp_CPP_GenericElements_CPP_hpp
00003
00004
00005
00006 #include "DTDTypes.hpp"
00007
00008 #include <memory.h>
00009
00010 namespace HTML
00011 {
00012 struct GenericElement
00013 {
00014 enum ElementID
00015 {
00016 A = 0x01,
00017 ABBR = 0x02,
00018 ACRONYM = 0x03,
00019 ADDRESS = 0x04,
00020 APPLET = 0x05,
00021 AREA = 0x06,
00022 B = 0x07,
00023 BASE = 0x08,
00024 BASEFONT = 0x09,
00025 BDO = 0x0A,
00026 BIG = 0x0B,
00027 BLOCKQUOTE = 0x0C,
00028 BODY = 0x0D,
00029 BR = 0x0E,
00030 BUTTON = 0x0F,
00031 CAPTION = 0x10,
00032 CENTER = 0x11,
00033 CITE = 0x12,
00034 CODE = 0x13,
00035 COL = 0x14,
00036 COLGROUP = 0x15,
00037 DD = 0x16,
00038 DEL = 0x17,
00039 DFN = 0x18,
00040 DIR = 0x19,
00041 DIV = 0x1A,
00042 DL = 0x1B,
00043 DT = 0x1C,
00044 EM = 0x1D,
00045 FIELDSET = 0x1E,
00046 FONT = 0x1F,
00047 FORM = 0x20,
00048 FRAME = 0x21,
00049 FRAMESET = 0x22,
00050 H1 = 0x23,
00051 H2 = 0x24,
00052 H3 = 0x25,
00053 H4 = 0x26,
00054 H5 = 0x27,
00055 H6 = 0x28,
00056 HEAD = 0x29,
00057 HR = 0x2A,
00058 HTML = 0x2B,
00059 I = 0x2C,
00060 IFRAME = 0x2D,
00061 IMG = 0x2E,
00062 INPUT = 0x2F,
00063 INS = 0x30,
00064 ISINDEX = 0x31,
00065 KBD = 0x32,
00066 LABEL = 0x33,
00067 LEGEND = 0x34,
00068 LI = 0x35,
00069 LINK = 0x36,
00070 MAP = 0x37,
00071 MENU = 0x38,
00072 META = 0x39,
00073 NOFRAMES = 0x3A,
00074 NOSCRIPT = 0x3B,
00075 OBJECT = 0x3C,
00076 OL = 0x3D,
00077 OPTGROUP = 0x3E,
00078 OPTION = 0x3F,
00079 P = 0x40,
00080 PARAM = 0x41,
00081 PRE = 0x42,
00082 Q = 0x43,
00083 S = 0x44,
00084 SAMP = 0x45,
00085 SCRIPT = 0x46,
00086 SELECT = 0x47,
00087 SMALL = 0x48,
00088 SPAN = 0x49,
00089 STRIKE = 0x4A,
00090 STRONG = 0x4B,
00091 STYLE = 0x4C,
00092 SUB = 0x4D,
00093 SUP = 0x4E,
00094 TABLE = 0x4F,
00095 TBODY = 0x50,
00096 TD = 0x51,
00097 TEXTAREA = 0x52,
00098 TFOOT = 0x53,
00099 TH = 0x54,
00100 THEAD = 0x55,
00101 TITLE = 0x56,
00102 TR = 0x57,
00103 TT = 0x58,
00104 U = 0x59,
00105 UL = 0x5A,
00106 VAR = 0x5B,
00107 DOCTYPE = 0x5C,
00108 COMMENT = 0x5D,
00109 Unknown = 0x00,
00110 AllBut = -1,
00111 };
00112
00114 const tchar * name;
00116 const tchar * description;
00118 ElementID elementID;
00120 int endTagRequired;
00122 bool empty;
00124 bool deprecated;
00126 DTDType DTDtype;
00127
00128 enum
00129 {
00130 EndTagRequired = 1,
00131 EndTagOptional = 0,
00132 EndTagNotRequired = -1,
00133 MustBeEmpty = true,
00134 ShouldNotBeEmpty = false,
00135 Deprecated = true,
00136 NotDeprecated = false,
00137 };
00138
00141 enum Level
00142 {
00143 UnknownLevel = 0,
00144 InlineLevel = 1,
00145 BlockLevel = 2,
00146 BothLevel = 3,
00147 };
00148
00149
00150 };
00151
00152
00153
00155 const GenericElement allowedElements[] =
00156 {
00157 { "A", "anchor", GenericElement::A, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00158 { "ABBR", "abbreviated form (e.g., WWW, HTTP, etc.)", GenericElement::ABBR, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00159 { "ACRONYM", "acronym", GenericElement::ACRONYM, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00160 { "ADDRESS", "information on author", GenericElement::ADDRESS, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00161 { "APPLET", "Java applet", GenericElement::APPLET, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00162 { "AREA", "client-side image map area", GenericElement::AREA, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00163 { "B", "bold text style", GenericElement::B, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00164 { "BASE", "document base URI", GenericElement::BASE, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00165 { "BASEFONT", "base font size", GenericElement::BASEFONT, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::Deprecated , LooseDTD },
00166 { "BDO", "I18N BiDi over-ride", GenericElement::BDO, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00167 { "BIG", "large text style", GenericElement::BIG, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00168 { "BLOCKQUOTE", "long quotation", GenericElement::BLOCKQUOTE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00169 { "BODY", "document body", GenericElement::BODY, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00170 { "BR", "forced line break", GenericElement::BR, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00171 { "BUTTON", "push button", GenericElement::BUTTON, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00172 { "CAPTION", "table caption", GenericElement::CAPTION, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00173 { "CENTER", "shorthand for DIV align=center", GenericElement::CENTER, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00174 { "CITE", "citation", GenericElement::CITE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00175 { "CODE", "computer code fragment", GenericElement::CODE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00176 { "COL", "table column", GenericElement::COL, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00177 { "COLGROUP", "table column group", GenericElement::COLGROUP, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00178 { "DD", "definition description", GenericElement::DD, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00179 { "DEL", "deleted text", GenericElement::DEL, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00180 { "DFN", "instance definition", GenericElement::DFN, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00181 { "DIR", "directory list", GenericElement::DIR, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00182 { "DIV", "generic language/style container", GenericElement::DIV, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00183 { "DL", "definition list", GenericElement::DL, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00184 { "DT", "definition term", GenericElement::DT, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00185 { "EM", "emphasis", GenericElement::EM, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00186 { "FIELDSET", "form control group", GenericElement::FIELDSET, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00187 { "FONT", "local change to font", GenericElement::FONT, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00188 { "FORM", "interactive form", GenericElement::FORM, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00189 { "FRAME", "subwindow", GenericElement::FRAME, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, FramesetDTD },
00190 { "FRAMESET", "window subdivision", GenericElement::FRAMESET, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, FramesetDTD },
00191 { "H1", "heading level 1", GenericElement::H1, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00192 { "H2", "heading level 2", GenericElement::H2, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00193 { "H3", "heading level 3", GenericElement::H3, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00194 { "H4", "heading level 4", GenericElement::H4, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00195 { "H5", "heading level 5", GenericElement::H5, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00196 { "H6", "heading level 6", GenericElement::H6, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00197 { "HEAD", "document head", GenericElement::HEAD, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00198 { "HR", "horizontal rule", GenericElement::HR, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00199 { "HTML", "document root element", GenericElement::HTML, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00200 { "I", "italic text style", GenericElement::I, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00201 { "IFRAME", "inline subwindow", GenericElement::IFRAME, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, LooseDTD },
00202 { "IMG", "Embedded image", GenericElement::IMG, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00203 { "INPUT", "form control", GenericElement::INPUT, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00204 { "INS", "inserted text", GenericElement::INS, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00205 { "ISINDEX", "single line prompt", GenericElement::ISINDEX, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::Deprecated , LooseDTD },
00206 { "KBD", "text to be entered by the user", GenericElement::KBD, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00207 { "LABEL", "form field label text", GenericElement::LABEL, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00208 { "LEGEND", "fieldset legend", GenericElement::LEGEND, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00209 { "LI", "list item", GenericElement::LI, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00210 { "LINK", "a media-independent link", GenericElement::LINK, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00211 { "MAP", "client-side image map", GenericElement::MAP, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00212 { "MENU", "menu list", GenericElement::MENU, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00213 { "META", "generic metainformation", GenericElement::META, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00214 { "NOFRAMES", "alternate content container for no frame", GenericElement::NOFRAMES, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, FramesetDTD },
00215 { "NOSCRIPT", "alternate content container for no script",GenericElement::NOSCRIPT, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00216 { "OBJECT", "generic embedded object", GenericElement::OBJECT, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00217 { "OL", "ordered list", GenericElement::OL, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00218 { "OPTGROUP", "option group", GenericElement::OPTGROUP, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00219 { "OPTION", "selectable choice", GenericElement::OPTION, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00220 { "P", "paragraph", GenericElement::P, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00221 { "PARAM", "named property value", GenericElement::PARAM, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00222 { "PRE", "preformatted text", GenericElement::PRE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00223 { "Q", "short inline quotation", GenericElement::Q, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00224 { "S", "strike-through text style", GenericElement::S, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00225 { "SAMP", "sample program output, scripts, etc.", GenericElement::SAMP, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00226 { "SCRIPT", "script statements", GenericElement::SCRIPT, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00227 { "SELECT", "option selector", GenericElement::SELECT, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00228 { "SMALL", "small text style", GenericElement::SMALL, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00229 { "SPAN", "generic language/style container", GenericElement::SPAN, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00230 { "STRIKE", "strike-through text", GenericElement::STRIKE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00231 { "STRONG", "strong emphasis", GenericElement::STRONG, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00232 { "STYLE", "style info", GenericElement::STYLE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00233 { "SUB", "subscript", GenericElement::SUB, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00234 { "SUP", "superscript", GenericElement::SUP, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00235 { "TABLE", "table", GenericElement::TABLE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00236 { "TBODY", "table body", GenericElement::TBODY, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00237 { "TD", "table data cell", GenericElement::TD, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00238 { "TEXTAREA", "multi-line text field", GenericElement::TEXTAREA, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00239 { "TFOOT", "table footer", GenericElement::TFOOT, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00240 { "TH", "table header cell", GenericElement::TH, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00241 { "THEAD", "table header", GenericElement::THEAD, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00242 { "TITLE", "document title", GenericElement::TITLE, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00243 { "TR", "table row", GenericElement::TR, GenericElement::EndTagOptional, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00244 { "TT", "teletype or monospaced text style", GenericElement::TT, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00245 { "U", "underlined text style", GenericElement::U, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::Deprecated , LooseDTD },
00246 { "UL", "unordered list", GenericElement::UL, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00247 { "VAR", "instance of a var or program argument", GenericElement::VAR, GenericElement::EndTagRequired, GenericElement::ShouldNotBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00248 { "!DOCTYPE", "the document type", GenericElement::DOCTYPE, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00249 { "!--", "a comment", GenericElement::COMMENT, GenericElement::EndTagNotRequired, GenericElement::MustBeEmpty, GenericElement::NotDeprecated, StandardDTD },
00250 };
00251 }
00252
00253
00254 #endif