doxygen
outputgen.h
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 
30 class ClassDiagram;
31 class DotClassGraph;
32 class DotInclDepGraph;
33 class DotCallGraph;
34 class DotDirDeps;
37 class MemberDef;
38 class Definition;
39 
41 {
42  QCString name;
43  QCString ref;
44  QCString url;
45  QCString anchor;
46 };
47 
49 {
50  QCString file;
51  int line;
52  QCString ref;
53  QCString url;
54  QCString anchor;
55 };
56 
60 {
61  public:
62  virtual ~CodeOutputInterface() = default;
64  CodeOutputInterface(const CodeOutputInterface &) = delete;
65  CodeOutputInterface &operator=(const CodeOutputInterface &) = delete;
66 
68  virtual int id() const { return 0; }
69 
74  virtual void codify(const QCString &s) = 0;
75 
87  virtual void writeCodeLink(CodeSymbolType type,
88  const QCString &ref,const QCString &file,
89  const QCString &anchor,const QCString &name,
90  const QCString &tooltip) = 0;
91 
99  virtual void writeLineNumber(const QCString &ref,const QCString &file,
100  const QCString &anchor,int lineNumber, bool writeLineAnchor) = 0;
101 
110  virtual void writeTooltip(const QCString &id,
111  const DocLinkInfo &docInfo,
112  const QCString &decl,
113  const QCString &desc,
114  const SourceLinkInfo &defInfo,
115  const SourceLinkInfo &declInfo
116  ) = 0;
117 
118  virtual void startCodeLine(bool hasLineNumbers) = 0;
119 
121  virtual void endCodeLine() = 0;
122 
127  virtual void startFontClass(const QCString &clsName) = 0;
128 
130  virtual void endFontClass() = 0;
131 
135  virtual void writeCodeAnchor(const QCString &name) = 0;
136 
137  virtual void setCurrentDoc(const Definition *context,const QCString &anchor,bool isSourceFile) {}
138  virtual void addWord(const QCString &word,bool hiPriority) {}
139 
146  virtual void startCodeFragment(const QCString &style) = 0;
148  virtual void endCodeFragment(const QCString &style) = 0;
149 };
150 
160 {
161  public:
162  enum ParamListTypes { Param, RetVal, Exception };
163  enum SectionTypes { /*See, Return, Author, Version,
164  Since, Date, Bug, Note,
165  Warning, Par, Deprecated, Pre,
166  Post, Invar, Remark, Attention,
167  Todo, Test, RCS, */
168  EnumValues,
169  Examples
170  };
171 
172  virtual void parseText(const QCString &) {}
173 
177  virtual void startItemList() = 0;
178 
182  virtual void startItemListItem() = 0;
183 
187  virtual void endItemListItem() = 0;
188 
190  virtual void endItemList() = 0;
191 
195  virtual void docify(const QCString &s) = 0;
196 
200  virtual void writeChar(char c) = 0;
201 
205  virtual void writeString(const QCString &text) = 0;
206 
208  //virtual void newParagraph() = 0;
209 
211  virtual void startParagraph(const QCString &classDef) = 0;
213  virtual void endParagraph() = 0;
214 
223  virtual void writeObjectLink(const QCString &ref,const QCString &file,
224  const QCString &anchor, const QCString &name) = 0;
225 
226 
230  virtual void startHtmlLink(const QCString &url) = 0;
231 
234  virtual void endHtmlLink() = 0;
235 
236 
240  virtual void startBold() = 0;
241 
243  virtual void endBold() = 0;
244 
248  virtual void startTypewriter() = 0;
249 
251  virtual void endTypewriter() = 0;
252 
256  virtual void startEmphasis() = 0;
257 
259  virtual void endEmphasis() = 0;
260 
262  virtual void writeRuler() = 0;
263 
267  virtual void startDescription() = 0;
268 
270  virtual void endDescription() = 0;
271 
273  virtual void startDescItem() = 0;
274 
275  virtual void startDescForItem() = 0;
276  virtual void endDescForItem() = 0;
277 
281  virtual void endDescItem() = 0;
282 
283  virtual void startCenter() = 0;
284  virtual void endCenter() = 0;
285  virtual void startSmall() = 0;
286  virtual void endSmall() = 0;
287 
288  virtual void startExamples() = 0;
289  virtual void endExamples() = 0;
290  virtual void startParamList(ParamListTypes t,const QCString &title) = 0;
291  virtual void endParamList() = 0;
292 
293  //virtual void writeDescItem() = 0;
294  virtual void startTitle() = 0;
295  virtual void endTitle() = 0;
296 
297  virtual void writeAnchor(const QCString &fileName,const QCString &name) = 0;
298  virtual void startSection(const QCString &,const QCString &,SectionType) = 0;
299  virtual void endSection(const QCString &,SectionType) = 0;
300 
301  virtual void lineBreak(const QCString &style) = 0;
302  virtual void addIndexItem(const QCString &s1,const QCString &s2) = 0;
303 
304  virtual void writeNonBreakableSpace(int) = 0;
305  virtual void startDescTable(const QCString &title) = 0;
306  virtual void endDescTable() = 0;
307  virtual void startDescTableRow() = 0;
308  virtual void endDescTableRow() = 0;
309  virtual void startDescTableTitle() = 0;
310  virtual void endDescTableTitle() = 0;
311  virtual void startDescTableData() = 0;
312  virtual void endDescTableData() = 0;
313  virtual void startTextLink(const QCString &file,const QCString &anchor) = 0;
314  virtual void endTextLink() = 0;
315  virtual void startPageRef() = 0;
316  virtual void endPageRef(const QCString &,const QCString &) = 0;
317  virtual void startSubsection() = 0;
318  virtual void endSubsection() = 0;
319  virtual void startSubsubsection() = 0;
320  virtual void endSubsubsection() = 0;
321 };
322 
328 {
329  public:
330  enum OutputType { Html, Latex, Man, RTF, XML, DEF, Perl , Docbook};
331 
332  OutputGenerator(const QCString &dir);
334  OutputGenerator &operator=(const OutputGenerator &o);
335  virtual ~OutputGenerator();
336 
337  virtual OutputType type() const = 0;
338  virtual std::unique_ptr<OutputGenerator> clone() const = 0;
339 
341  // generic generator methods
343  void enable();
344  void disable();
345  void enableIf(OutputType o);
346  void disableIf(OutputType o);
347  void disableIfNot(OutputType o);
348  bool isEnabled(OutputType o);
349  OutputGenerator *get(OutputType o);
350  QCString dir() const;
351  QCString fileName() const;
352 
353  void startPlainFile(const QCString &name);
354  void endPlainFile();
355  bool isEnabled() const { return m_active; }
356  void pushGeneratorState();
357  void popGeneratorState();
358 
359  virtual void writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *md,int id) = 0;
360 
362  // structural output interface
364  virtual void startFile(const QCString &name,const QCString &manName,
365  const QCString &title,int id=0) = 0;
366  virtual void writeSearchInfo() = 0;
367  virtual void writeFooter(const QCString &navPath) = 0;
368  virtual void endFile() = 0;
369  virtual void startIndexSection(IndexSections) = 0;
370  virtual void endIndexSection(IndexSections) = 0;
371  virtual void writePageLink(const QCString &,bool) = 0;
372  virtual void startProjectNumber() = 0;
373  virtual void endProjectNumber() = 0;
374  virtual void writeStyleInfo(int part) = 0;
375  virtual void startTitleHead(const QCString &) = 0;
376  virtual void endTitleHead(const QCString &fileName,const QCString &name) = 0;
377  virtual void startIndexListItem() = 0;
378  virtual void endIndexListItem() = 0;
379  virtual void startIndexList() = 0;
380  virtual void endIndexList() = 0;
381  virtual void startIndexKey() = 0;
382  virtual void endIndexKey() = 0;
383  virtual void startIndexValue(bool) = 0;
384  virtual void endIndexValue(const QCString &,bool) = 0;
385  virtual void startIndexItem(const QCString &ref,const QCString &file) = 0;
386  virtual void endIndexItem(const QCString &ref,const QCString &file) = 0;
387  virtual void startGroupHeader(int) = 0;
388  virtual void endGroupHeader(int) = 0;
389  virtual void startMemberSections() = 0;
390  virtual void endMemberSections() = 0;
391  virtual void startHeaderSection() = 0;
392  virtual void endHeaderSection() = 0;
393  virtual void startMemberHeader(const QCString &anchor, int typ) = 0;
394  virtual void endMemberHeader() = 0;
395  virtual void startMemberSubtitle() = 0;
396  virtual void endMemberSubtitle() = 0;
397  virtual void startMemberDocList() = 0;
398  virtual void endMemberDocList() = 0;
399  virtual void startMemberList() = 0;
400  virtual void endMemberList() = 0;
401  virtual void startInlineHeader() = 0;
402  virtual void endInlineHeader() = 0;
403  virtual void startAnonTypeScope(int) = 0;
404  virtual void endAnonTypeScope(int) = 0;
405  virtual void startMemberItem(const QCString &,int,const QCString &) = 0;
406  virtual void endMemberItem() = 0;
407  virtual void startMemberTemplateParams() = 0;
408  virtual void endMemberTemplateParams(const QCString &,const QCString &) = 0;
409  virtual void startCompoundTemplateParams() = 0;
410  virtual void endCompoundTemplateParams() = 0;
411  virtual void startMemberGroupHeader(bool) = 0;
412  virtual void endMemberGroupHeader() = 0;
413  virtual void startMemberGroupDocs() = 0;
414  virtual void endMemberGroupDocs() = 0;
415  virtual void startMemberGroup() = 0;
416  virtual void endMemberGroup(bool) = 0;
417  virtual void insertMemberAlign(bool) = 0;
418  virtual void insertMemberAlignLeft(int,bool) = 0;
419  virtual void startMemberDoc(const QCString &,const QCString &,
420  const QCString &,const QCString &,int,int,bool) = 0;
421  virtual void endMemberDoc(bool) = 0;
422  virtual void startDoxyAnchor(const QCString &fName,const QCString &manName,
423  const QCString &anchor,const QCString &name,
424  const QCString &args) = 0;
425  virtual void endDoxyAnchor(const QCString &fileName,const QCString &anchor) = 0;
426  virtual void writeLatexSpacing() = 0;
427  virtual void writeStartAnnoItem(const QCString &type,const QCString &file,
428  const QCString &path,const QCString &name) = 0;
429  virtual void writeEndAnnoItem(const QCString &name) = 0;
430  virtual void startMemberDescription(const QCString &anchor,const QCString &inheritId, bool typ) = 0;
431  virtual void endMemberDescription() = 0;
432  virtual void startMemberDeclaration() = 0;
433  virtual void endMemberDeclaration(const QCString &anchor,const QCString &inheritId) = 0;
434  virtual void writeInheritedSectionTitle(const QCString &id,const QCString &ref,
435  const QCString &file,const QCString &anchor,
436  const QCString &title,const QCString &name) = 0;
437  virtual void startIndent() = 0;
438  virtual void endIndent() = 0;
439  virtual void writeSynopsis() = 0;
440  virtual void startClassDiagram() = 0;
441  virtual void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &) = 0;
442  virtual void startDotGraph() = 0;
443  virtual void endDotGraph(DotClassGraph &g) = 0;
444  virtual void startInclDepGraph() = 0;
445  virtual void endInclDepGraph(DotInclDepGraph &g) = 0;
446  virtual void startGroupCollaboration() = 0;
447  virtual void endGroupCollaboration(DotGroupCollaboration &g) = 0;
448  virtual void startCallGraph() = 0;
449  virtual void endCallGraph(DotCallGraph &g) = 0;
450  virtual void startDirDepGraph() = 0;
451  virtual void endDirDepGraph(DotDirDeps &g) = 0;
452  virtual void writeGraphicalHierarchy(DotGfxHierarchyTable &g) = 0;
453  virtual void startQuickIndices() = 0;
454  virtual void endQuickIndices() = 0;
455  virtual void writeSplitBar(const QCString &) = 0;
456  virtual void writeNavigationPath(const QCString &) = 0;
457  virtual void writeLogo() = 0;
458  virtual void writeQuickLinks(bool compact,HighlightedItem hli,const QCString &file) = 0;
459  virtual void writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first) = 0;
460  virtual void startContents() = 0;
461  virtual void endContents() = 0;
462  virtual void startPageDoc(const QCString &) {}
463  virtual void endPageDoc() {}
464  virtual void startTextBlock(bool) = 0;
465  virtual void endTextBlock(bool) = 0;
466  virtual void lastIndexPage() = 0;
467  virtual void startMemberDocPrefixItem() = 0;
468  virtual void endMemberDocPrefixItem() = 0;
469  virtual void startMemberDocName(bool) = 0;
470  virtual void endMemberDocName() = 0;
471  virtual void startParameterType(bool,const QCString &key) = 0;
472  virtual void endParameterType() = 0;
473  virtual void startParameterName(bool) = 0;
474  virtual void endParameterName(bool,bool,bool) = 0;
475  virtual void startParameterList(bool) = 0;
476  virtual void endParameterList() = 0;
477  virtual void exceptionEntry(const QCString &,bool) = 0;
478 
479  virtual void startConstraintList(const QCString &) = 0;
480  virtual void startConstraintParam() = 0;
481  virtual void endConstraintParam() = 0;
482  virtual void startConstraintType() = 0;
483  virtual void endConstraintType() = 0;
484  virtual void startConstraintDocs() = 0;
485  virtual void endConstraintDocs() = 0;
486  virtual void endConstraintList() = 0;
487 
488  virtual void startMemberDocSimple(bool) = 0;
489  virtual void endMemberDocSimple(bool) = 0;
490  virtual void startInlineMemberType() = 0;
491  virtual void endInlineMemberType() = 0;
492  virtual void startInlineMemberName() = 0;
493  virtual void endInlineMemberName() = 0;
494  virtual void startInlineMemberDoc() = 0;
495  virtual void endInlineMemberDoc() = 0;
496 
497  virtual void startLabels() = 0;
498  virtual void writeLabel(const QCString &,bool) = 0;
499  virtual void endLabels() = 0;
500 
501  virtual void cleanup() = 0;
502 
503  protected:
504  TextStream m_t;
505  private:
506  QCString m_dir;
507  QCString m_fileName;
508  FILE *m_file;
509  bool m_active = true;
510  std::stack<bool> m_genStack;
511 };
512 
513 #endif
This file contains a number of basic enums and types.
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
Base Interface used for generating output outside of the comment blocks.
Definition: outputgen.h:159
Text streaming class that buffers data.
Definition: textstream.h:34
Represents a graphical class hierarchy.
Definition: dotgfxhierarchytable.h:31
virtual int id() const
Identifier for the output file.
Definition: outputgen.h:68
Representation of a group collaboration graph.
Definition: dotgroupcollaboration.h:28
opaque representation of the abstract syntax tree (AST)
Definition: docparser.h:46
Class representing a built-in class diagram.
Definition: diagram.h:29
Representation of an call graph.
Definition: dotcallgraph.h:26
Representation of a class inheritance or dependency graph.
Definition: dotclassgraph.h:28
Abstract output generator.
Definition: outputgen.h:327
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
Output interface for code parser.
Definition: outputgen.h:59
Definition: outputgen.h:48
Definition: outputgen.h:40