doxygen
htmlgen.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2020 by Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  */
15 
16 #ifndef HTMLGEN_H
17 #define HTMLGEN_H
18 
19 #include "outputgen.h"
20 
22 {
23  public:
24  HtmlCodeGenerator(TextStream &t,const QCString &relPath);
26  int id() const { return m_id; }
27  void setId(int id) { m_id = id; }
28  void setRelativePath(const QCString &path);
29  void codify(const QCString &text);
30  void writeCodeLink(CodeSymbolType type,
31  const QCString &ref,const QCString &file,
32  const QCString &anchor,const QCString &name,
33  const QCString &tooltip);
34  void writeTooltip(const QCString &id,
35  const DocLinkInfo &docInfo,
36  const QCString &decl,
37  const QCString &desc,
38  const SourceLinkInfo &defInfo,
39  const SourceLinkInfo &declInfo
40  );
41  void writeLineNumber(const QCString &,const QCString &,const QCString &,int, bool);
42  void startCodeLine(bool);
43  void endCodeLine();
44  void startFontClass(const QCString &s);
45  void endFontClass();
46  void writeCodeAnchor(const QCString &anchor);
47  void setCurrentDoc(const Definition *,const QCString &,bool) {}
48  void addWord(const QCString &,bool) {}
49  void startCodeFragment(const QCString &style);
50  void endCodeFragment(const QCString &);
51 
52  private:
53  void _writeCodeLink(const QCString &className,
54  const QCString &ref,const QCString &file,
55  const QCString &anchor,const QCString &name,
56  const QCString &tooltip);
57  void docify(const QCString &str);
58  TextStream &m_t;
59  int m_col = 0;
60  QCString m_relPath;
61  bool m_lineOpen = false;
62  int m_id = 0;
63 };
64 
67 {
68  public:
69  HtmlGenerator();
70  HtmlGenerator &operator=(const HtmlGenerator &g);
71  HtmlGenerator(const HtmlGenerator &g);
72  virtual ~HtmlGenerator();
73  virtual std::unique_ptr<OutputGenerator> clone() const;
74 
75  virtual OutputType type() const { return Html; }
76  static void init();
77  void cleanup();
78  static void writeStyleSheetFile(TextStream &t);
79  static void writeHeaderFile(TextStream &t, const QCString &cssname);
80  static void writeFooterFile(TextStream &t);
81  static void writeTabData();
82  static void writeSearchInfo(TextStream &t,const QCString &relPath);
83  static void writeSearchData(const QCString &dir);
84  static void writeSearchPage();
85  static void writeExternalSearchPage();
86  static QCString writeLogoAsString(const QCString &path);
87  static QCString writeSplitBarAsString(const QCString &name,const QCString &relpath);
88  static QCString getMathJaxMacros();
89 
90  // ---- CodeOutputInterface
91  void codify(const QCString &text)
92  { m_codeGen.codify(text); }
93  void writeCodeLink(CodeSymbolType type,
94  const QCString &ref,const QCString &file,
95  const QCString &anchor,const QCString &name,
96  const QCString &tooltip)
97  { m_codeGen.writeCodeLink(type,ref,file,anchor,name,tooltip); }
98  void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,int lineNumber, bool writeLineAnchor)
99  { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber,writeLineAnchor); }
100  void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl,
101  const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo
102  )
103  { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); }
104  void startCodeLine(bool hasLineNumbers)
105  { m_codeGen.startCodeLine(hasLineNumbers); }
106  void endCodeLine()
107  { m_codeGen.endCodeLine(); }
108  void startFontClass(const QCString &s)
109  { m_codeGen.startFontClass(s); }
111  { m_codeGen.endFontClass(); }
112  void writeCodeAnchor(const QCString &anchor)
113  { m_codeGen.writeCodeAnchor(anchor); }
114  void startCodeFragment(const QCString &style)
115  { m_codeGen.startCodeFragment(style); }
116  void endCodeFragment(const QCString &style)
117  { m_codeGen.endCodeFragment(style); }
118  // ---------------------------
119 
120  void setCurrentDoc(const Definition *context,const QCString &anchor,bool isSourceFile);
121  void addWord(const QCString &word,bool hiPriority);
122  void writeDoc(DocNode *,const Definition *,const MemberDef *,int id);
123 
124  void startFile(const QCString &name,const QCString &manName,const QCString &title,int id);
125  void writeFooter(const QCString &navPath);
126  void endFile();
127  void clearBuffer();
128  void writeSearchInfo();
129 
130  void startIndexSection(IndexSections) {}
131  void endIndexSection(IndexSections) {}
132  void writePageLink(const QCString &,bool) {}
133  void startProjectNumber();
134  void endProjectNumber();
135  void writeStyleInfo(int part);
136  void startTitleHead(const QCString &);
137  void endTitleHead(const QCString &,const QCString &);
138  void startTitle() { m_t << "<div class=\"title\">"; }
139  void endTitle() { m_t << "</div>"; }
140 
141  void startParagraph(const QCString &classDef);
142  void endParagraph();
143  void writeString(const QCString &text);
144  void startIndexListItem();
145  void endIndexListItem();
146  void startIndexList();
147  void endIndexList();
148  void startIndexKey();
149  void endIndexKey();
150  void startIndexValue(bool);
151  void endIndexValue(const QCString &,bool);
152  void startItemList() { m_t << "<ul>\n"; }
153  void endItemList() { m_t << "</ul>\n"; }
154  void startIndexItem(const QCString &ref,const QCString &file);
155  void endIndexItem(const QCString &ref,const QCString &file);
156  void docify(const QCString &text);
157 
158  void writeObjectLink(const QCString &ref,const QCString &file,
159  const QCString &anchor,const QCString &name);
160 
161  void startTextLink(const QCString &file,const QCString &anchor);
162  void endTextLink();
163  void startHtmlLink(const QCString &url);
164  void endHtmlLink();
165  void startTypewriter() { m_t << "<code>"; }
166  void endTypewriter() { m_t << "</code>"; }
167  void startGroupHeader(int);
168  void endGroupHeader(int);
169  void startItemListItem() { m_t << "<li>"; }
170  void endItemListItem() { m_t << "</li>\n"; }
171 
172  void startMemberSections();
173  void endMemberSections();
174  void startHeaderSection();
175  void endHeaderSection();
176  void startMemberHeader(const QCString &, int);
177  void endMemberHeader();
178  void startMemberSubtitle();
179  void endMemberSubtitle();
180  void startMemberDocList();
181  void endMemberDocList();
182  void startMemberList();
183  void endMemberList();
184  void startInlineHeader();
185  void endInlineHeader();
186  void startAnonTypeScope(int) {}
187  void endAnonTypeScope(int) {}
188  void startMemberItem(const QCString &anchor,int,const QCString &inheritId);
189  void endMemberItem();
190  void startMemberTemplateParams();
191  void endMemberTemplateParams(const QCString &anchor,const QCString &inheritId);
192  void startCompoundTemplateParams();
193  void endCompoundTemplateParams();
194 
195  void startMemberGroupHeader(bool);
196  void endMemberGroupHeader();
197  void startMemberGroupDocs();
198  void endMemberGroupDocs();
199  void startMemberGroup();
200  void endMemberGroup(bool);
201 
202  void insertMemberAlign(bool);
203  void insertMemberAlignLeft(int,bool);
204  void startMemberDescription(const QCString &anchor,const QCString &inheritId, bool typ);
205  void endMemberDescription();
206  void startMemberDeclaration() {}
207  void endMemberDeclaration(const QCString &anchor,const QCString &inheritId);
208  void writeInheritedSectionTitle(const QCString &id, const QCString &ref,
209  const QCString &file, const QCString &anchor,
210  const QCString &title,const QCString &name);
211 
212  void writeRuler() { m_t << "<hr/>"; }
213  void writeAnchor(const QCString &,const QCString &name)
214  { m_t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; }
215  void startEmphasis() { m_t << "<em>"; }
216  void endEmphasis() { m_t << "</em>"; }
217  void startBold() { m_t << "<b>"; }
218  void endBold() { m_t << "</b>"; }
219  void startDescription() { m_t << "\n<dl>\n"; }
220  void endDescription() { m_t << "\n</dl>\n\n"; }
221  void startDescItem() { m_t << "<dt>"; }
222  void endDescItem() { m_t << "</dt>"; }
223  void startDescForItem() { m_t << "<dd>"; }
224  void endDescForItem() { m_t << "</dd>\n"; }
225  void lineBreak(const QCString &style);
226  void writeChar(char c);
227  void startMemberDoc(const QCString &clName, const QCString &memName,
228  const QCString &anchor, const QCString &title,
229  int memCount, int memTotal, bool showInline);
230  void endMemberDoc(bool);
231  void startDoxyAnchor(const QCString &fName,const QCString &manName,
232  const QCString &anchor,const QCString &name,
233  const QCString &args);
234  void endDoxyAnchor(const QCString &fName,const QCString &anchor);
235  void writeLatexSpacing() {}
236  void writeStartAnnoItem(const QCString &type,const QCString &file,
237  const QCString &path,const QCString &name);
238  void writeEndAnnoItem(const QCString &) { m_t << "\n"; }
239  void startSubsection() { m_t << "<h2>"; }
240  void endSubsection() { m_t << "</h2>\n"; }
241  void startSubsubsection() { m_t << "<h3>"; }
242  void endSubsubsection() { m_t << "</h3>\n"; }
243  void startCenter() { m_t << "<center>\n"; }
244  void endCenter() { m_t << "</center>\n"; }
245  void startSmall() { m_t << "<small>\n"; }
246  void endSmall() { m_t << "</small>\n"; }
247  void startExamples();
248  void endExamples();
249  void startParamList(ParamListTypes,const QCString &);
250  void endParamList();
251  void startSection(const QCString &,const QCString &,SectionType);
252  void endSection(const QCString &,SectionType);
253  void addIndexItem(const QCString &,const QCString &);
254  void startIndent();
255  void endIndent();
256  void writeSynopsis() {}
257  void startClassDiagram();
258  void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &);
259  void startPageRef() {}
260  void endPageRef(const QCString &,const QCString &) {}
261  void startQuickIndices() {}
262  void endQuickIndices();
263  void writeSplitBar(const QCString &name);
264  void writeNavigationPath(const QCString &s);
265  void writeLogo();
266  void writeQuickLinks(bool compact,HighlightedItem hli,const QCString &file);
267  void writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first);
268  void startContents();
269  void endContents();
270  void startPageDoc(const QCString &pageTitle);
271  void endPageDoc();
272  void writeNonBreakableSpace(int);
273 
274  void startDescTable(const QCString &title);
275  void endDescTable();
276  void startDescTableRow();
277  void endDescTableRow();
278  void startDescTableTitle();
279  void endDescTableTitle();
280  void startDescTableData();
281  void endDescTableData();
282 
283  void startDotGraph();
284  void endDotGraph(DotClassGraph &g);
285  void startInclDepGraph();
286  void endInclDepGraph(DotInclDepGraph &g);
287  void startGroupCollaboration();
288  void endGroupCollaboration(DotGroupCollaboration &g);
289  void startCallGraph();
290  void endCallGraph(DotCallGraph &g);
291  void startDirDepGraph();
292  void endDirDepGraph(DotDirDeps &g);
293  void writeGraphicalHierarchy(DotGfxHierarchyTable &g);
294 
295  void startTextBlock(bool)
296  { m_t << "<div class=\"textblock\">"; }
297  void endTextBlock(bool)
298  { m_t << "</div>"; }
299  void lastIndexPage() {}
300 
301  void startMemberDocPrefixItem();
302  void endMemberDocPrefixItem();
303  void startMemberDocName(bool);
304  void endMemberDocName();
305  void startParameterType(bool first,const QCString &key);
306  void endParameterType();
307  void startParameterName(bool);
308  void endParameterName(bool last,bool emptyList,bool closeBracket);
309  void startParameterList(bool);
310  void endParameterList();
311  void exceptionEntry(const QCString &,bool);
312 
313  void startConstraintList(const QCString &);
314  void startConstraintParam();
315  void endConstraintParam();
316  void startConstraintType();
317  void endConstraintType();
318  void startConstraintDocs();
319  void endConstraintDocs();
320  void endConstraintList();
321 
322  void startMemberDocSimple(bool);
323  void endMemberDocSimple(bool);
324  void startInlineMemberType();
325  void endInlineMemberType();
326  void startInlineMemberName();
327  void endInlineMemberName();
328  void startInlineMemberDoc();
329  void endInlineMemberDoc();
330 
331  void startLabels();
332  void writeLabel(const QCString &l,bool isLast);
333  void endLabels();
334 
335  private:
336  static void writePageFooter(TextStream &t,const QCString &,const QCString &,const QCString &);
337  QCString m_lastTitle;
338  QCString m_lastFile;
339  QCString m_relPath;
340  void docify(const QCString &text,bool inHtmlComment);
341 
342  int m_sectionCount = 0;
343  bool m_emptySection = false;
344  HtmlCodeGenerator m_codeGen;
345 };
346 
347 #endif
void startEmphasis()
Definition: htmlgen.h:215
void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)
Definition: htmlgen.cpp:768
void startDescItem()
Definition: htmlgen.h:221
void endItemList()
Definition: htmlgen.h:153
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
Definition: htmlgen.cpp:727
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
void endEmphasis()
Definition: htmlgen.h:216
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
void writeCodeAnchor(const QCString &anchor)
Definition: htmlgen.cpp:884
void startCodeFragment(const QCString &style)
Definition: htmlgen.cpp:889
void codify(const QCString &text)
Definition: htmlgen.h:91
void endTypewriter()
Definition: htmlgen.h:166
void startTypewriter()
Definition: htmlgen.h:165
void startItemList()
Definition: htmlgen.h:152
Text streaming class that buffers data.
Definition: textstream.h:33
void endCodeLine()
Definition: htmlgen.h:106
void endCodeFragment(const QCString &)
Definition: htmlgen.cpp:894
Definition: htmlgen.h:21
Represents a graphical class hierarchy.
Definition: dotgfxhierarchytable.h:31
Generator for HTML output.
Definition: htmlgen.h:66
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
Definition: htmlgen.h:93
Representation of a group collaboration graph.
Definition: dotgroupcollaboration.h:28
void codify(const QCString &text)
Definition: htmlgen.cpp:587
void startItemListItem()
Definition: htmlgen.h:169
void startFontClass(const QCString &s)
Definition: htmlgen.h:108
void startCodeFragment(const QCString &style)
Definition: htmlgen.h:114
void endCodeFragment(const QCString &style)
Definition: htmlgen.h:116
void writeCodeAnchor(const QCString &anchor)
Definition: htmlgen.h:112
void endItemListItem()
Definition: htmlgen.h:170
void endDescItem()
Definition: htmlgen.h:222
void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)
Definition: htmlgen.h:100
void writeRuler()
Definition: htmlgen.h:212
Class representing a built-in class diagram.
Definition: diagram.h:29
void endFontClass()
Definition: htmlgen.cpp:879
void startFontClass(const QCString &s)
Definition: htmlgen.cpp:874
Representation of an call graph.
Definition: dotcallgraph.h:26
int id() const
Identifier for the output file.
Definition: htmlgen.h:26
void endBold()
Definition: htmlgen.h:218
Representation of a class inheritance or dependency graph.
Definition: dotclassgraph.h:28
Abstract node interface with type information.
Definition: docparser.h:96
void writeLineNumber(const QCString &ref, const QCString &file, const QCString &anchor, int lineNumber, bool writeLineAnchor)
Definition: htmlgen.h:98
Abstract output generator.
Definition: outputgen.h:330
void startDescription()
Definition: htmlgen.h:219
Representation of an include dependency graph.
Definition: dotincldepgraph.h:30
Representation of an directory dependency graph.
Definition: dotdirdeps.h:25
This is an alternative implementation of QCString.
Definition: qcstring.h:108
void startBold()
Definition: htmlgen.h:217
Output interface for code parser.
Definition: outputgen.h:61
void writeLineNumber(const QCString &, const QCString &, const QCString &, int, bool)
Definition: htmlgen.cpp:698
void endCodeLine()
Definition: htmlgen.cpp:860
Definition: outputgen.h:50
Definition: outputgen.h:42
void endDescription()
Definition: htmlgen.h:220
void endFontClass()
Definition: htmlgen.h:110