1 /******************************************************************************
6 * Copyright (C) 1997-2012 by Dimitri van Heesch.
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
19 #include "cmdmapper.h"
21 /** Call representing a mapping from a command name to a command ID. */
30 { "a", CMD_EMPHASIS },
31 { "addindex", CMD_ADDINDEX },
32 { "anchor", CMD_ANCHOR },
34 { "attention", CMD_ATTENTION },
35 { "author", CMD_AUTHOR },
36 { "authors", CMD_AUTHORS },
40 { "code", CMD_STARTCODE },
41 { "copydoc", CMD_COPYDOC },
42 { "copybrief", CMD_COPYBRIEF },
43 { "copydetails", CMD_COPYDETAILS },
44 { "copyright", CMD_COPYRIGHT },
46 { "dontinclude", CMD_DONTINCLUDE },
47 { "dotfile", CMD_DOTFILE },
48 { "e", CMD_EMPHASIS },
49 { "em", CMD_EMPHASIS },
50 { "endcode", CMD_ENDCODE },
51 { "endhtmlonly", CMD_ENDHTMLONLY },
52 { "endlatexonly", CMD_ENDLATEXONLY },
53 { "endlink", CMD_ENDLINK },
54 { "endsecreflist", CMD_ENDSECREFLIST },
55 { "endverbatim", CMD_ENDVERBATIM },
56 { "endxmlonly", CMD_ENDXMLONLY },
57 { "exception", CMD_EXCEPTION },
58 { "form", CMD_FORMULA },
59 { "htmlinclude", CMD_HTMLINCLUDE },
60 { "htmlonly", CMD_HTMLONLY },
61 { "image", CMD_IMAGE },
62 { "include", CMD_INCLUDE },
63 { "internal", CMD_INTERNAL },
64 { "invariant", CMD_INVARIANT },
65 { "javalink", CMD_JAVALINK },
66 { "latexonly", CMD_LATEXONLY },
70 { "n", CMD_LINEBREAK },
74 { "param", CMD_PARAM },
78 { "refitem", CMD_SECREFITEM },
79 { "remark", CMD_REMARK },
80 { "remarks", CMD_REMARK },
81 { "result", CMD_RETURN },
82 { "return", CMD_RETURN },
83 { "returns", CMD_RETURN },
84 { "retval", CMD_RETVAL },
85 { "rtfonly", CMD_RTFONLY },
87 { "secreflist", CMD_SECREFLIST },
88 { "section", CMD_SECTION },
89 { "snippet", CMD_SNIPPET },
90 { "subpage", CMD_SUBPAGE },
91 { "subsection", CMD_SUBSECTION },
92 { "subsubsection", CMD_SUBSUBSECTION },
93 { "paragraph", CMD_PARAGRAPH },
95 { "since", CMD_SINCE },
97 { "skipline", CMD_SKIPLINE },
98 { "xmlonly", CMD_XMLONLY },
99 { "xrefitem", CMD_XREFITEM },
100 { "throw", CMD_EXCEPTION },
101 { "until", CMD_UNTIL },
102 { "verbatim", CMD_VERBATIM },
103 { "verbinclude", CMD_VERBINCLUDE },
104 { "version", CMD_VERSION },
105 { "warning", CMD_WARNING },
106 { "throws", CMD_EXCEPTION },
107 { "tparam", CMD_TPARAM },
108 { "\\", CMD_BSLASH },
111 { ">", CMD_GREATER },
115 { "%", CMD_PERCENT },
117 { "::", CMD_DCOLON },
119 { "_internalref", CMD_INTERNALREF },
122 { "enddot", CMD_ENDDOT },
123 { "endmsc", CMD_ENDMSC },
124 { "manonly", CMD_MANONLY },
125 { "endmanonly", CMD_ENDMANONLY },
126 { "includelineno", CMD_INCWITHLINES },
127 { "inheritdoc", CMD_INHERITDOC },
128 { "mscfile", CMD_MSCFILE },
129 { "rtfonly", CMD_RTFONLY },
130 { "endrtfonly", CMD_ENDRTFONLY },
134 //----------------------------------------------------------------------------
136 CommandMap htmlTagMap[] =
138 { "strong", HTML_BOLD },
139 { "center", HTML_CENTER },
140 { "table", HTML_TABLE },
141 { "caption", HTML_CAPTION },
142 { "small", HTML_SMALL },
143 { "code", HTML_CODE },
144 { "dfn", HTML_CODE },
145 { "var", HTML_EMPHASIS },
156 { "tt", XML_C /*HTML_CODE*/ },
157 { "kbd", XML_C /*HTML_CODE*/ },
158 { "em", HTML_EMPHASIS },
164 { "i", HTML_EMPHASIS },
174 { "span", HTML_SPAN },
176 { "blockquote", HTML_BLOCKQUOTE },
179 // { "code", XML_CODE }, <= ambiguous <code> is also a HTML tag
180 { "description", XML_DESCRIPTION },
181 { "example", XML_EXAMPLE },
182 { "exception", XML_EXCEPTION },
183 { "include", XML_INCLUDE },
184 { "item", XML_ITEM },
185 { "list", XML_LIST }, // type="table|bullet|number"
186 { "listheader", XML_LISTHEADER },
187 { "para", XML_PARA },
188 { "param", XML_PARAM },
189 { "paramref", XML_PARAMREF },
190 { "typeparam", XML_TYPEPARAM },
191 { "typeparamref", XML_TYPEPARAMREF },
192 { "permission", XML_PERMISSION },
193 { "remarks", XML_REMARKS },
194 { "returns", XML_RETURNS },
196 { "seealso", XML_SEEALSO },
197 { "summary", XML_SUMMARY },
198 { "term", XML_TERM },
199 { "value", XML_VALUE },
200 { "inheritdoc", XML_INHERITDOC },
204 //----------------------------------------------------------------------------
206 Mapper *Mappers::cmdMapper = new Mapper(cmdMap,TRUE);
207 Mapper *Mappers::htmlTagMapper = new Mapper(htmlTagMap,FALSE);
209 int Mapper::map(const char *n)
212 if (!m_cs) name=name.lower();
214 return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
217 Mapper::Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive)
219 m_map.setAutoDelete(TRUE);
220 const CommandMap *p = cm;
223 m_map.insert(p->cmdName,new int(p->cmdId));
228 void Mappers::freeMappers()
230 delete cmdMapper; cmdMapper = 0;
231 delete htmlTagMapper; htmlTagMapper = 0;