doxygen
htmldocvisitor.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2021 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 HTMLDOCVISITOR_H
17 #define HTMLDOCVISITOR_H
18 
19 #include "docvisitor.h"
20 #include "docnode.h"
21 #include "qcstring.h"
22 
23 class Definition;
24 class MemberDef;
25 class OutputCodeList;
26 class TextStream;
27 
29 class HtmlDocVisitor : public DocVisitor
30 {
31  public:
33 
34  //--------------------------------------
35  // visitor functions for leaf nodes
36  //--------------------------------------
37 
38  void operator()(const DocWord &);
39  void operator()(const DocLinkedWord &);
40  void operator()(const DocWhiteSpace &);
41  void operator()(const DocSymbol &);
42  void operator()(const DocEmoji &);
43  void operator()(const DocURL &);
44  void operator()(const DocLineBreak &);
45  void operator()(const DocHorRuler &);
46  void operator()(const DocStyleChange &);
47  void operator()(const DocVerbatim &);
48  void operator()(const DocAnchor &);
49  void operator()(const DocInclude &);
50  void operator()(const DocIncOperator &);
51  void operator()(const DocFormula &);
52  void operator()(const DocIndexEntry &);
53  void operator()(const DocSimpleSectSep &);
54  void operator()(const DocCite &);
55  void operator()(const DocSeparator &);
56 
57  //--------------------------------------
58  // visitor functions for compound nodes
59  //--------------------------------------
60 
61  void operator()(const DocAutoList &);
62  void operator()(const DocAutoListItem &);
63  void operator()(const DocPara &) ;
64  void operator()(const DocRoot &);
65  void operator()(const DocSimpleSect &);
66  void operator()(const DocTitle &);
67  void operator()(const DocSimpleList &);
68  void operator()(const DocSimpleListItem &);
69  void operator()(const DocSection &);
70  void operator()(const DocHtmlList &);
71  void operator()(const DocHtmlListItem &);
72  void operator()(const DocHtmlDescList &);
73  void operator()(const DocHtmlDescTitle &);
74  void operator()(const DocHtmlDescData &);
75  void operator()(const DocHtmlTable &);
76  void operator()(const DocHtmlRow &);
77  void operator()(const DocHtmlCell &);
78  void operator()(const DocHtmlCaption &);
79  void operator()(const DocInternal &);
80  void operator()(const DocHRef &);
81  void operator()(const DocHtmlSummary &);
82  void operator()(const DocHtmlDetails &);
83  void operator()(const DocHtmlHeader &);
84  void operator()(const DocImage &);
85  void operator()(const DocDotFile &);
86  void operator()(const DocMscFile &);
87  void operator()(const DocDiaFile &);
88  void operator()(const DocLink &);
89  void operator()(const DocRef &);
90  void operator()(const DocSecRefItem &);
91  void operator()(const DocSecRefList &);
92  void operator()(const DocParamSect &);
93  void operator()(const DocParamList &);
94  void operator()(const DocXRefItem &);
95  void operator()(const DocInternalRef &);
96  void operator()(const DocText &);
97  void operator()(const DocHtmlBlockQuote &);
98  void operator()(const DocVhdlFlow &);
99  void operator()(const DocParBlock &);
100 
101  private:
102 
103  template<class T>
104  void visitChildren(const T &t)
105  {
106  for (const auto &child : t.children())
107  {
108  std::visit(*this, child);
109  }
110  }
111  template<class T>
112  void visitCaption(TextStream &t,const T &n);
113 
114  //--------------------------------------
115  // helper functions
116  //--------------------------------------
117 
118  void writeObfuscatedMailAddress(const QCString &url);
119  void filter(const QCString &str, const bool retainNewline = false);
120  QCString filterQuotedCdataAttr(const QCString &str);
121  void startLink(const QCString &ref,const QCString &file,
122  const QCString &relPath,const QCString &anchor,
123  const QCString &tooltip = "");
124  void endLink();
125  void writeDotFile(const QCString &fileName,const QCString &relPath,const QCString &context,
126  const QCString &srcFile,int srcLine);
127  void writeMscFile(const QCString &fileName,const QCString &relPath,const QCString &context,
128  const QCString &srcFile,int srcLine);
129  void writeDiaFile(const QCString &fileName,const QCString &relPath,const QCString &context,
130  const QCString &srcFile,int srcLine);
131  void writePlantUMLFile(const QCString &fileName,const QCString &relPath,const QCString &context,
132  const QCString &srcFile,int srcLine);
133 
134  template<class DocNode>
135  void forceEndParagraph(const DocNode &n);
136  template<class DocNode>
137  void forceStartParagraph(const DocNode &n);
138 
139  //--------------------------------------
140  // state variables
141  //--------------------------------------
142 
143  TextStream &m_t;
144  OutputCodeList &m_ci;
145  bool m_insidePre = false;
146  bool m_hide = false;
147  bool m_insideTitle = false;
148  const Definition *m_ctx;
149  QCString m_langExt;
150 };
151 
152 #endif
Node representing a separator.
Definition: docnode.h:346
Node representing an HTML blockquote.
Definition: docnode.h:1251
Node representing a URL (or email address)
Definition: docnode.h:188
Node representing a word.
Definition: docnode.h:153
Node representing some amount of white space.
Definition: docnode.h:335
Node representing a Hypertext reference.
Definition: docnode.h:784
Root node of a text fragment.
Definition: docnode.h:1264
Node representing a horizontal ruler.
Definition: docnode.h:216
The common base class of all entity definitions found in the sources.
Definition: definition.h:74
Node representing a simple section title.
Definition: docnode.h:579
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
Node representing a reference to some item.
Definition: docnode.h:739
Concrete visitor implementation for HTML output.
Definition: htmldocvisitor.h:29
Node representing a style change.
Definition: docnode.h:265
Node representing an auto List.
Definition: docnode.h:550
Node representing an emoji.
Definition: docnode.h:322
Node representing a citation of some bibliographic reference.
Definition: docnode.h:245
Text streaming class that buffers data.
Definition: textstream.h:34
Node representing a HTML table caption.
Definition: docnode.h:1188
Root node of documentation tree.
Definition: docnode.h:1273
Node representing a HTML table cell.
Definition: docnode.h:1153
Node representing an entry in the index.
Definition: docnode.h:531
Node representing a simple section.
Definition: docnode.h:978
Node representing a paragraph in the documentation tree.
Definition: docnode.h:1040
Node representing a special symbol.
Definition: docnode.h:309
Helper base class for functionality shared by all visitors.
Definition: docvisitor.h:27
Node Html details.
Definition: docnode.h:818
Node representing a VHDL flow chart.
Definition: docnode.h:710
Node representing a Html description list.
Definition: docnode.h:862
Node representing a HTML list item.
Definition: docnode.h:1125
Node representing a msc file.
Definition: docnode.h:692
Node representing a verbatim, unparsed text fragment.
Definition: docnode.h:357
Node representing a Html description item.
Definition: docnode.h:849
Node Html heading.
Definition: docnode.h:834
Node representing a HTML table.
Definition: docnode.h:1229
Node representing a dia file.
Definition: docnode.h:701
Node representing a HTML table row.
Definition: docnode.h:1206
Node representing a line break.
Definition: docnode.h:202
Node representing a list of section references.
Definition: docnode.h:920
Class representing a list of different code generators.
Definition: outputlist.h:144
Node representing a reference to a section.
Definition: docnode.h:896
Node representing an item of a cross-referenced list.
Definition: docnode.h:508
Node representing a parameter section.
Definition: docnode.h:1013
Node representing an image.
Definition: docnode.h:612
Node representing a parameter list.
Definition: docnode.h:1085
Node representing a normal section.
Definition: docnode.h:875
Node representing a Html list.
Definition: docnode.h:961
Node representing an internal reference to some item.
Definition: docnode.h:768
Node representing an included text block from file.
Definition: docnode.h:416
Node representing an block of paragraphs.
Definition: docnode.h:940
Node representing an anchor.
Definition: docnode.h:229
Abstract node interface with type information.
Definition: docnode.h:77
Node representing a separator between two simple sections of the same type.
Definition: docnode.h:1004
Node representing a simple list item.
Definition: docnode.h:1113
Node representing a HTML description data.
Definition: docnode.h:1141
This is an alternative implementation of QCString.
Definition: qcstring.h:92
Node representing a word that can be linked to something.
Definition: docnode.h:165
Node representing a simple list.
Definition: docnode.h:951
Node representing a dot file.
Definition: docnode.h:683
Node representing an item of a auto list.
Definition: docnode.h:566
Node representing an internal section of documentation.
Definition: docnode.h:930
Node representing an item of a cross-referenced list.
Definition: docnode.h:591
Node representing a include/dontinclude operator block.
Definition: docnode.h:458
Node Html summary.
Definition: docnode.h:805