From 6d600214268e64e6bc83df61d8abfdf8963acdad Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 27 Jan 2016 12:14:12 +0000 Subject: Split out tag names from general string table and enum. Previously these were mixed in the the document's general memoised strings. This also gives us an enum by which HTML elements can be identified. --- include/dom/html/html_elements.h | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 include/dom/html/html_elements.h (limited to 'include') diff --git a/include/dom/html/html_elements.h b/include/dom/html/html_elements.h new file mode 100644 index 0000000..d4aec10 --- /dev/null +++ b/include/dom/html/html_elements.h @@ -0,0 +1,94 @@ +/* + * This file is part of libdom. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2016 Michael Drake + */ + +#if !defined(dom_html_elements_h_) || defined(DOM_HTML_ELEMENT_STRINGS_ENTRY) +#define dom_html_elements_h_ + +#define DOM_HTML_ELEMENT_LIST \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(_UNKNOWN) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(HTML) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(HEAD) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(LINK) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TITLE) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(META) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(BASE) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(ISINDEX) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(STYLE) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(BODY) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(FORM) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(SELECT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(OPTGROUP) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(OPTION) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(INPUT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TEXTAREA) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(BUTTON) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(LABEL) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(FIELDSET) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(LEGEND) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(UL) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(OL) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(DL) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(DIRECTORY) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(MENU) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(LI) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(BLOCKQUOTE) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(DIV) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(P) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(H1) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(H2) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(H3) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(H4) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(H5) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(H6) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(Q) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(PRE) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(BR) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(BASEFONT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(FONT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(HR) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(INS) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(DEL) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(A) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(IMG) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(OBJECT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(PARAM) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(APPLET) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(MAP) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(AREA) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(SCRIPT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TABLE) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(CAPTION) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(COL) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(COLGROUP) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(THEAD) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TFOOT) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TBODY) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TR) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TH) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(TD) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(FRAMESET) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(FRAME) \ + DOM_HTML_ELEMENT_STRINGS_ENTRY(IFRAME) + +/* Generate enum containing DOM_HTML_ELEMENT_ entries, + * unless the includer defined DOM_HTML_ELEMENT_STRINGS_ENTRY + * to do something else. + */ +#ifndef DOM_HTML_ELEMENT_STRINGS_ENTRY +#define DOM_HTML_ELEMENT_STRINGS_ENTRY(tag) \ + DOM_HTML_ELEMENT_TYPE_##tag, +typedef enum { +DOM_HTML_ELEMENT_LIST + DOM_HTML_ELEMENT_TYPE__COUNT +} dom_html_element_type; +#undef DOM_HTML_ELEMENT_STRINGS_ENTRY +#else +DOM_HTML_ELEMENT_LIST +#endif + +#undef DOM_HTML_ELEMENT_LIST +#endif \ No newline at end of file -- cgit v1.2.3