Doxygen
Loading...
Searching...
No Matches
outputgen.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2022 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 OUTPUTGEN_H
17#define OUTPUTGEN_H
18
19#include <memory>
20#include <stack>
21#include <iostream>
22#include <fstream>
23
24#include "types.h"
25#include "index.h"
26#include "section.h"
27#include "textstream.h"
28#include "docparser.h"
29#include "construct.h"
30
31class ClassDiagram;
32class DotClassGraph;
33class DotInclDepGraph;
34class DotCallGraph;
35class DotDirDeps;
38class MemberDef;
39class Definition;
40class OutputCodeList;
41
43{
44 QCString name;
45 QCString ref;
46 QCString url;
47 QCString anchor;
48};
49
51{
52 QCString file;
53 int line;
54 QCString ref;
55 QCString url;
56 QCString anchor;
57};
58
60
61
62/** Base class for code generators
63 */
65{
66 public:
67 OutputCodeIntf() = default;
69
70 virtual OutputType type() const = 0;
71 virtual std::unique_ptr<OutputCodeIntf> clone() = 0;
72 virtual void codify(const QCString &s) = 0;
73 virtual void stripCodeComments(bool b) = 0;
74 virtual void startSpecialComment() = 0;
75 virtual void endSpecialComment() = 0;
76 virtual void setStripIndentAmount(size_t) = 0;
78 const QCString &ref,const QCString &file,
79 const QCString &anchor,const QCString &name,
80 const QCString &tooltip) = 0;
81 virtual void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,
82 int lineNumber, bool writeLineAnchor) = 0;
83 virtual void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl,
84 const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo) = 0;
85 virtual void startCodeLine(int lineNr) = 0;
86 virtual void endCodeLine()= 0;
87 virtual void startFontClass(const QCString &c) = 0;
88 virtual void endFontClass() = 0;
89 virtual void writeCodeAnchor(const QCString &name) = 0;
90 virtual void startCodeFragment(const QCString &style) = 0;
91 virtual void endCodeFragment(const QCString &style) = 0;
92 virtual void startFold(int lineNr,const QCString &startMarker,const QCString &endMarker) = 0;
93 virtual void endFold() = 0;
94};
95
96/** Base class for shared implementation for all output generators.
97 */
98class OutputGenerator
99{
100 public:
101 OutputGenerator() : m_t(40*1024) {}
102
103 enum class ParamListTypes { Param, RetVal, Exception };
104 enum class MemberItemType { Normal, AnonymousStart, AnonymousEnd, Templated };
105
106 OutputGenerator(const QCString &dir);
107 virtual ~OutputGenerator() = default;
108 ONLY_DEFAULT_MOVABLE(OutputGenerator)
109
110 QCString dir() const;
111 QCString fileName() const;
112
113 void startPlainFile(const QCString &name);
114 void endPlainFile();
115 protected:
116 TextStream m_t;
117 QCString m_dir;
118 private:
119 QCString m_fileName;
120 FILE *m_file = nullptr;
121};
122
123
124/** Abstract interface for output generators
125 */
126class OutputGenIntf
127{
128 public:
129 ABSTRACT_BASE_CLASS(OutputGenIntf)
130
131 virtual OutputType type() const = 0;
132 virtual std::unique_ptr<OutputGenIntf> clone() = 0;
133 virtual void addCodeGen(OutputCodeList &list) = 0;
134 virtual void writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *md, int id) = 0;
135 virtual void startIndexSection(IndexSection is) = 0;
136 virtual void endIndexSection(IndexSection is) = 0;
137 virtual void writePageLink(const QCString &name,bool first) = 0;
138 virtual void startProjectNumber() = 0;
139 virtual void endProjectNumber() = 0;
140 virtual void writeStyleInfo(int part) = 0;
141 virtual void writeSearchInfo() = 0;
142 virtual void writeFooter(const QCString &navPath) = 0;
143 virtual void startFile(const QCString &name,const QCString &manName,const QCString &title,int id, int hierarchyLevel) = 0;
144 virtual void endFile() = 0;
145 virtual void startTitleHead(const QCString &fileName) = 0;
146 virtual void endTitleHead(const QCString &fileName,const QCString &name) = 0;
147 virtual void startParagraph(const QCString &classDef=QCString()) = 0;
148 virtual void endParagraph() = 0;
149 virtual void writeString(const QCString &text) = 0;
150 virtual void startIndexListItem() = 0;
151 virtual void endIndexListItem() = 0;
152 virtual void startIndexList() = 0;
153 virtual void endIndexList() = 0;
154 virtual void startIndexKey() = 0;
155 virtual void endIndexKey() = 0;
156 virtual void startIndexValue(bool b) = 0;
157 virtual void endIndexValue(const QCString &name,bool b) = 0;
158 virtual void startItemList() = 0;
159 virtual void endItemList() = 0;
160 virtual void startIndexItem(const QCString &ref,const QCString &file) = 0;
161 virtual void endIndexItem(const QCString &ref,const QCString &file) = 0;
162 virtual void docify(const QCString &s) = 0;
163 virtual void writeObjectLink(const QCString &ref,const QCString &file,
164 const QCString &anchor, const QCString &name) = 0;
165 virtual void startTextLink(const QCString &file,const QCString &anchor) = 0;
166 virtual void endTextLink() = 0;
167 virtual void writeStartAnnoItem(const QCString &type,const QCString &file,
168 const QCString &path,const QCString &name) = 0;
169 virtual void startTypewriter() = 0;
170 virtual void endTypewriter() = 0;
171 virtual void startGroupHeader(int extraLevels=0) = 0;
172 virtual void endGroupHeader(int extraLevels=0) = 0;
173 virtual void startItemListItem() = 0;
174 virtual void endItemListItem() = 0;
175 virtual void startMemberSections() = 0;
176 virtual void endMemberSections() = 0;
177 virtual void startHeaderSection() = 0;
178 virtual void endHeaderSection() = 0;
179 virtual void startMemberHeader(const QCString &anchor, int typ = 2) = 0;
180 virtual void endMemberHeader() = 0;
181 virtual void startMemberSubtitle() = 0;
182 virtual void endMemberSubtitle() = 0;
183 virtual void startMemberDocList() = 0;
184 virtual void endMemberDocList() = 0;
185 virtual void startMemberList() = 0;
186 virtual void endMemberList() = 0;
187 virtual void startInlineHeader() = 0;
188 virtual void endInlineHeader() = 0;
189 virtual void startAnonTypeScope(int i1) = 0;
190 virtual void endAnonTypeScope(int i1) = 0;
191 virtual void startMemberItem(const QCString &anchor,OutputGenerator::MemberItemType type,const QCString &id=QCString()) = 0;
192 virtual void endMemberItem(OutputGenerator::MemberItemType type) = 0;
193 virtual void startMemberTemplateParams() = 0;
194 virtual void endMemberTemplateParams(const QCString &anchor,const QCString &inheritId) = 0;
195 virtual void startCompoundTemplateParams() = 0;
196 virtual void endCompoundTemplateParams() = 0;
197 virtual void startMemberGroupHeader(bool b) = 0;
198 virtual void endMemberGroupHeader() = 0;
199 virtual void startMemberGroupDocs() = 0;
200 virtual void endMemberGroupDocs() = 0;
201 virtual void startMemberGroup() = 0;
202 virtual void endMemberGroup(bool last) = 0;
203 virtual void insertMemberAlign(bool templ=FALSE) = 0;
204 virtual void insertMemberAlignLeft(OutputGenerator::MemberItemType typ=OutputGenerator::MemberItemType::Normal, bool templ=FALSE) = 0;
205 virtual void writeRuler() = 0;
206 virtual void writeAnchor(const QCString &fileName,const QCString &name) = 0;
207 virtual void startEmphasis() = 0;
208 virtual void endEmphasis() = 0;
209 virtual void writeChar(char c) = 0;
210 virtual void startMemberDoc(const QCString &clName,const QCString &memName,
211 const QCString &anchor,const QCString &title,
212 int memCount,int memTotal,bool showInline) = 0;
213 virtual void endMemberDoc(bool hasArgs) = 0;
214 virtual void startDoxyAnchor(const QCString &fName,const QCString &manName,
215 const QCString &anchor, const QCString &name,
216 const QCString &args) = 0;
217 virtual void endDoxyAnchor(const QCString &fn,const QCString &anchor) = 0;
218 virtual void addLabel(const QCString &fName,const QCString &anchor) = 0;
219 virtual void writeLatexSpacing() = 0;
220 virtual void startDescForItem() = 0;
221 virtual void endDescForItem() = 0;
222 virtual void startCenter() = 0;
223 virtual void endCenter() = 0;
224 virtual void startSmall() = 0;
225 virtual void endSmall() = 0;
226 virtual void lineBreak(const QCString &style=QCString()) = 0;
227 virtual void startBold() = 0;
228 virtual void endBold() = 0;
229 virtual void startMemberDescription(const QCString &anchor,const QCString &inheritId=QCString(), bool typ = false) = 0;
230 virtual void endMemberDescription() = 0;
231 virtual void startMemberDeclaration() = 0;
232 virtual void endMemberDeclaration(const QCString &anchor,const QCString &inheritId) = 0;
233 virtual void writeInheritedSectionTitle(const QCString &id, const QCString &ref,
234 const QCString &file, const QCString &anchor,
235 const QCString &title,const QCString &name) = 0;
236 virtual void startExamples() = 0;
237 virtual void endExamples() = 0;
238 virtual void startIndent() = 0;
239 virtual void endIndent() = 0;
240 virtual void startSection(const QCString &lab,const QCString &title,SectionType t) = 0;
241 virtual void endSection(const QCString &lab,SectionType t) = 0;
242 virtual void addIndexItem(const QCString &s1,const QCString &s2) = 0;
243 virtual void writeSynopsis() = 0;
244 virtual void startClassDiagram() = 0;
245 virtual void endClassDiagram(const ClassDiagram &d,const QCString &f,const QCString &n) = 0;
246 virtual void startPageRef() = 0;
247 virtual void endPageRef(const QCString &c,const QCString &a) = 0;
248 virtual void startQuickIndices() = 0;
249 virtual void endQuickIndices() = 0;
250 virtual void writeSplitBar(const QCString &name) = 0;
251 virtual void writeNavigationPath(const QCString &s) = 0;
252 virtual void writeLogo() = 0;
253 virtual void writeQuickLinks(HighlightedItem hli,const QCString &file) = 0;
254 virtual void writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first) = 0;
255 virtual void startContents() = 0;
256 virtual void endContents() = 0;
257 virtual void startPageDoc(const QCString &pageTitle) = 0;
258 virtual void endPageDoc() = 0;
259 virtual void writeNonBreakableSpace(int num) = 0;
260 virtual void startDescTable(const QCString &title,const bool hasInits) = 0;
261 virtual void endDescTable() = 0;
262 virtual void startDescTableRow() = 0;
263 virtual void endDescTableRow() = 0;
264 virtual void startDescTableTitle() = 0;
265 virtual void endDescTableTitle() = 0;
266 virtual void startDescTableInit() = 0;
267 virtual void endDescTableInit() = 0;
268 virtual void startDescTableData() = 0;
269 virtual void endDescTableData() = 0;
270 virtual void startDotGraph() = 0;
271 virtual void endDotGraph(DotClassGraph &g) = 0;
272 virtual void startInclDepGraph() = 0;
273 virtual void endInclDepGraph(DotInclDepGraph &g) = 0;
274 virtual void startCallGraph() = 0;
275 virtual void endCallGraph(DotCallGraph &g) = 0;
276 virtual void startDirDepGraph() = 0;
277 virtual void endDirDepGraph(DotDirDeps &g) = 0;
278 virtual void startGroupCollaboration() = 0;
279 virtual void endGroupCollaboration(DotGroupCollaboration &g) = 0;
280 virtual void writeGraphicalHierarchy(DotGfxHierarchyTable &g) = 0;
281 virtual void startTextBlock(bool dense=FALSE) = 0;
282 virtual void endTextBlock(bool paraBreak=FALSE) = 0;
283 virtual void lastIndexPage() = 0;
284 virtual void startMemberDocPrefixItem() = 0;
285 virtual void endMemberDocPrefixItem() = 0;
286 virtual void startMemberDocName(bool align) = 0;
287 virtual void endMemberDocName() = 0;
288 virtual void startParameterType(bool first,const QCString &key) = 0;
289 virtual void endParameterType() = 0;
290 virtual void startParameterName(bool one) = 0;
291 virtual void endParameterName() = 0;
292 virtual void startParameterExtra() = 0;
293 virtual void endParameterExtra(bool last,bool one,bool bracket) = 0;
294 virtual void startParameterDefVal(const char *separator) = 0;
295 virtual void endParameterDefVal() = 0;
296 virtual void startParameterList(bool openBracket) = 0;
297 virtual void endParameterList() = 0;
298 virtual void exceptionEntry(const QCString &prefix,bool closeBracket) = 0;
299 virtual void startConstraintList(const QCString &header) = 0;
300 virtual void startConstraintParam() = 0;
301 virtual void endConstraintParam() = 0;
302 virtual void startConstraintType() = 0;
303 virtual void endConstraintType() = 0;
304 virtual void startConstraintDocs() = 0;
305 virtual void endConstraintDocs() = 0;
306 virtual void endConstraintList() = 0;
307 virtual void startMemberDocSimple(bool b) = 0;
308 virtual void endMemberDocSimple(bool b) = 0;
309 virtual void startInlineMemberType() = 0;
310 virtual void endInlineMemberType() = 0;
311 virtual void startInlineMemberName() = 0;
312 virtual void endInlineMemberName() = 0;
313 virtual void startInlineMemberDoc() = 0;
314 virtual void endInlineMemberDoc() = 0;
315 virtual void startLabels() = 0;
316 virtual void writeLabel(const QCString &l,bool isLast) = 0;
317 virtual void endLabels() = 0;
318 virtual void writeLocalToc(const SectionRefs &refs,const LocalToc &lt) = 0;
319 virtual void cleanup() = 0;
320 virtual void startPlainFile(const QCString &name) = 0;
321 virtual void endPlainFile() = 0;
322};
323
324
325#endif
constexpr auto prefix
Definition anchor.cpp:44
Class representing a built-in class diagram.
Definition diagram.h:31
The common base class of all entity definitions found in the sources.
Definition definition.h:76
Representation of an call graph.
Representation of a class inheritance or dependency graph.
Representation of an directory dependency graph.
Definition dotdirdeps.h:26
Represents a graphical class hierarchy.
Representation of a group collaboration graph.
Representation of an include dependency graph.
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
virtual void writeLineNumber(const QCString &ref, const QCString &file, const QCString &anchor, int lineNumber, bool writeLineAnchor)=0
virtual std::unique_ptr< OutputCodeIntf > clone()=0
virtual void endFold()=0
virtual void startSpecialComment()=0
virtual OutputType type() const =0
virtual void writeCodeAnchor(const QCString &name)=0
virtual void startCodeLine(int lineNr)=0
virtual void startCodeFragment(const QCString &style)=0
virtual void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)=0
virtual void startFold(int lineNr, const QCString &startMarker, const QCString &endMarker)=0
virtual void endCodeLine()=0
virtual void startFontClass(const QCString &c)=0
virtual void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)=0
virtual void endSpecialComment()=0
virtual void endFontClass()=0
virtual void endCodeFragment(const QCString &style)=0
OutputCodeIntf()=default
virtual void stripCodeComments(bool b)=0
virtual void codify(const QCString &s)=0
virtual void setStripIndentAmount(size_t)=0
Class representing a list of different code generators.
Definition outputlist.h:164
virtual ~OutputGenerator()=default
#define DEFAULT_COPYABLE(cls)
Macro to help implementing the rule of 5 for a default copyable & movable class.
Definition construct.h:29
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
Definition construct.h:20
#define ONLY_DEFAULT_MOVABLE(cls)
Macro to help implementing the rule of 5 for a class that can be moved but not copied.
Definition construct.h:44
void endFile(OutputList &ol, bool skipNavIndex, bool skipEndContents, const QCString &navPath)
Definition index.cpp:421
void startFile(OutputList &ol, const QCString &name, const QCString &manName, const QCString &title, HighlightedItem hli, bool additionalIndices, const QCString &altSidebarName, int hierarchyLevel)
Definition index.cpp:402
HighlightedItem
Definition index.h:59
IndexSection
Definition index.h:32
OutputType
Definition outputgen.h:59
#define FALSE
Definition qcstring.h:34
static QCString align(const DocHtmlCell &cell)
static void writeString(std::ostream &f, const QCString &s)
This file contains a number of basic enums and types.
CodeSymbolType
Definition types.h:319
@ Normal
Definition types.h:29