1 /******************************************************************************
6 * Copyright (C) 1997-2015 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 { "latexinclude", CMD_LATEXINCLUDE },
67 { "latexonly", CMD_LATEXONLY },
71 { "n", CMD_LINEBREAK },
75 { "param", CMD_PARAM },
79 { "refitem", CMD_SECREFITEM },
80 { "remark", CMD_REMARK },
81 { "remarks", CMD_REMARK },
82 { "result", CMD_RETURN },
83 { "return", CMD_RETURN },
84 { "returns", CMD_RETURN },
85 { "retval", CMD_RETVAL },
86 { "rtfonly", CMD_RTFONLY },
88 { "secreflist", CMD_SECREFLIST },
89 { "section", CMD_SECTION },
90 { "snippet", CMD_SNIPPET },
91 { "snippetdoc", CMD_SNIPPETDOC },
92 { "snippetlineno", CMD_SNIPWITHLINES },
93 { "subpage", CMD_SUBPAGE },
94 { "subsection", CMD_SUBSECTION },
95 { "subsubsection", CMD_SUBSUBSECTION },
96 { "paragraph", CMD_PARAGRAPH },
98 { "since", CMD_SINCE },
100 { "skipline", CMD_SKIPLINE },
101 { "xmlonly", CMD_XMLONLY },
102 { "xrefitem", CMD_XREFITEM },
103 { "throw", CMD_EXCEPTION },
104 { "until", CMD_UNTIL },
105 { "verbatim", CMD_VERBATIM },
106 { "verbinclude", CMD_VERBINCLUDE },
107 { "version", CMD_VERSION },
108 { "warning", CMD_WARNING },
109 { "throws", CMD_EXCEPTION },
110 { "tparam", CMD_TPARAM },
111 { "\\", CMD_BSLASH },
115 { ">", CMD_GREATER },
119 { "%", CMD_PERCENT },
124 { "::", CMD_DCOLON },
126 { "_internalref", CMD_INTERNALREF },
129 { "startuml", CMD_STARTUML },
130 { "enddot", CMD_ENDDOT },
131 { "endmsc", CMD_ENDMSC },
132 { "enduml", CMD_ENDUML },
133 { "manonly", CMD_MANONLY },
134 { "endmanonly", CMD_ENDMANONLY },
135 { "includelineno", CMD_INCWITHLINES },
136 { "includedoc", CMD_INCLUDEDOC },
137 { "inheritdoc", CMD_INHERITDOC },
138 { "mscfile", CMD_MSCFILE },
139 { "rtfonly", CMD_RTFONLY },
140 { "endrtfonly", CMD_ENDRTFONLY },
141 { "vhdlflow", CMD_VHDLFLOW },
142 { "docbookonly", CMD_DBONLY },
143 { "enddocbookonly",CMD_ENDDBONLY },
144 { "endinternal", CMD_ENDINTERNAL },
145 { "parblock", CMD_PARBLOCK },
146 { "endparblock", CMD_ENDPARBLOCK },
147 { "diafile", CMD_DIAFILE },
149 { "---", CMD_MDASH },
150 { "_setscope", CMD_SETSCOPE },
151 { "emoji", CMD_EMOJI },
155 //----------------------------------------------------------------------------
157 CommandMap htmlTagMap[] =
159 { "strong", HTML_BOLD },
160 { "center", HTML_CENTER },
161 { "table", HTML_TABLE },
162 { "caption", HTML_CAPTION },
163 { "small", HTML_SMALL },
164 { "code", HTML_CODE },
165 { "dfn", HTML_CODE },
166 { "var", HTML_EMPHASIS },
177 { "tt", XML_C /*HTML_CODE*/ },
178 { "kbd", XML_C /*HTML_CODE*/ },
179 { "em", HTML_EMPHASIS },
185 { "i", HTML_EMPHASIS },
195 { "span", HTML_SPAN },
197 { "blockquote", HTML_BLOCKQUOTE },
198 { "strike", HTML_STRIKE },
199 { "u", HTML_UNDERLINE },
202 // { "code", XML_CODE }, <= ambiguous <code> is also a HTML tag
203 { "description", XML_DESCRIPTION },
204 { "example", XML_EXAMPLE },
205 { "exception", XML_EXCEPTION },
206 { "include", XML_INCLUDE },
207 { "item", XML_ITEM },
208 { "list", XML_LIST }, // type="table|bullet|number"
209 { "listheader", XML_LISTHEADER },
210 { "para", XML_PARA },
211 { "param", XML_PARAM },
212 { "paramref", XML_PARAMREF },
213 { "typeparam", XML_TYPEPARAM },
214 { "typeparamref", XML_TYPEPARAMREF },
215 { "permission", XML_PERMISSION },
216 { "remarks", XML_REMARKS },
217 { "returns", XML_RETURNS },
219 { "seealso", XML_SEEALSO },
220 { "summary", XML_SUMMARY },
221 { "term", XML_TERM },
222 { "value", XML_VALUE },
223 { "inheritdoc", XML_INHERITDOC },
227 //----------------------------------------------------------------------------
229 Mapper *Mappers::cmdMapper = new Mapper(cmdMap,TRUE);
230 Mapper *Mappers::htmlTagMapper = new Mapper(htmlTagMap,FALSE);
232 int Mapper::map(const char *n)
235 if (!m_cs) name=name.lower();
237 return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
240 QString Mapper::find(const int n)
242 QDictIterator<int> mapIterator(m_map);
243 for (int *curVal = mapIterator.toFirst();(curVal = mapIterator.current());++mapIterator)
245 if (*curVal == n || (*curVal == (n | SIMPLESECT_BIT))) return mapIterator.currentKey();
250 Mapper::Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive)
252 m_map.setAutoDelete(TRUE);
253 const CommandMap *p = cm;
256 m_map.insert(p->cmdName,new int(p->cmdId));
261 void Mappers::freeMappers()
263 delete cmdMapper; cmdMapper = 0;
264 delete htmlTagMapper; htmlTagMapper = 0;