doxygen
docbookgen.h
1 /******************************************************************************
2 *
3 *
4 *
5 * Copyright (C) 1997-2015 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 */
14 
15 #ifndef DOCBOOKGEN_H
16 #define DOCBOOKGEN_H
17 
18 #include <iostream>
19 
20 #include "config.h"
21 #include "outputgen.h"
22 
24 {
25  public:
27  virtual ~DocbookCodeGenerator();
28  void setRelativePath(const QCString &path) { m_relPath = path; }
29  void setSourceFileName(const QCString &sourceFileName) { m_sourceFileName = sourceFileName; }
30  QCString sourceFileName() { return m_sourceFileName; }
31 
32  void codify(const QCString &text);
33  void writeCodeLink(CodeSymbolType type,
34  const QCString &ref,const QCString &file,
35  const QCString &anchor,const QCString &name,
36  const QCString &tooltip);
37  void writeCodeLinkLine(CodeSymbolType type,
38  const QCString &ref,const QCString &file,
39  const QCString &anchor,const QCString &name,
40  const QCString &tooltip, bool);
41  void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &,
42  const QCString &, const SourceLinkInfo &, const SourceLinkInfo &
43  );
44  void startCodeLine(bool);
45  void endCodeLine();
46  void startFontClass(const QCString &colorClass);
47  void endFontClass();
48  void writeCodeAnchor(const QCString &);
49  void writeLineNumber(const QCString &extRef,const QCString &compId,
50  const QCString &anchorId,int l, bool writeLineAnchor);
51  void setCurrentDoc(const Definition *,const QCString &,bool);
52  void addWord(const QCString &,bool);
53  void finish();
54  void startCodeFragment(const QCString &style);
55  void endCodeFragment(const QCString &style);
56 
57  private:
58  TextStream &m_t;
59  QCString m_refId;
60  QCString m_external;
61  int m_lineNumber = -1;
62  int m_col = 0;
63  bool m_insideCodeLine = false;
64  bool m_insideSpecialHL = false;
65  QCString m_relPath;
66  QCString m_sourceFileName;
67 };
68 
69 
70 #if 0
71 // define for cases that have been implemented with an empty body
72 #define DB_GEN_EMPTY m_t << "<!-- DBG_GEN_head_check " << __LINE__ << " -->\n";
73 #else
74 #define DB_GEN_EMPTY
75 #endif
76 
77 #if 0
78 // Generic debug statements
79 #define DB_GEN_H DB_GEN_H1(m_t)
80 #define DB_GEN_H1(x) x << "<!-- DBG_GEN_head " << __LINE__ << " -->\n";
81 #define DB_GEN_H2(y) DB_GEN_H2a(m_t,y)
82 #define DB_GEN_H2a(x,y) x << "<!-- DBG_GEN_head " << __LINE__ << " " << y << " -->\n";
83 // define for cases that have NOT yet been implemented / considered
84 #define DB_GEN_NEW fprintf(stderr,"DBG_GEN_head %d\n",__LINE__); DB_GEN_H
85 #else
86 #define DB_GEN_H
87 #define DB_GEN_H1(x)
88 #define DB_GEN_H2(y)
89 #define DB_GEN_H2a(x,y)
90 #define DB_GEN_NEW
91 #endif
92 
94 {
95  public:
98  DocbookGenerator &operator=(const DocbookGenerator &o);
99  virtual ~DocbookGenerator();
100  virtual std::unique_ptr<OutputGenerator> clone() const;
101 
102  static void init();
103  void cleanup();
104 
105  OutputType type() const { return Docbook; }
106 
107  // --- CodeOutputInterface
108  void codify(const QCString &text)
109  { m_codeGen.codify(text); }
110  void writeCodeLink(CodeSymbolType type,
111  const QCString &ref, const QCString &file,
112  const QCString &anchor,const QCString &name,
113  const QCString &tooltip)
114  { m_codeGen.writeCodeLink(type,ref,file,anchor,name,tooltip); }
115  void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,int lineNumber, bool writeLineAnchor)
116  { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber,writeLineAnchor); }
117  void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl,
118  const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo
119  )
120  { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); }
121  void startCodeLine(bool hasLineNumbers)
122  { m_codeGen.startCodeLine(hasLineNumbers); }
123  void endCodeLine()
124  { m_codeGen.endCodeLine(); }
125  void startFontClass(const QCString &s)
126  { m_codeGen.startFontClass(s); }
128  { m_codeGen.endFontClass(); }
129  void writeCodeAnchor(const QCString &anchor)
130  { m_codeGen.writeCodeAnchor(anchor); }
131  void startCodeFragment(const QCString &style)
132  { m_codeGen.startCodeFragment(style); }
133  void endCodeFragment(const QCString &style)
134  { m_codeGen.endCodeFragment(style); }
135  // ---------------------------
136 
137  void writeDoc(DocNode *,const Definition *ctx,const MemberDef *md,int id);
138 
140  // structural output interface
142  void startFile(const QCString &name,const QCString &manName,
143  const QCString &title,int id);
144  void writeSearchInfo(){DB_GEN_EMPTY};
145  void writeFooter(const QCString &){DB_GEN_NEW};
146  void endFile();
147  void startIndexSection(IndexSections);
148  void endIndexSection(IndexSections);
149  void writePageLink(const QCString &,bool);
150  void startProjectNumber(){DB_GEN_NEW};
151  void endProjectNumber(){DB_GEN_NEW};
152  void writeStyleInfo(int){DB_GEN_EMPTY};
153  void startTitleHead(const QCString &);
154  void endTitleHead(const QCString &fileName,const QCString &name);
155  void startIndexListItem(){DB_GEN_NEW};
156  void endIndexListItem(){DB_GEN_NEW};
157  void startIndexList(){DB_GEN_NEW};
158  void endIndexList(){DB_GEN_NEW};
159  void startIndexKey(){DB_GEN_NEW};
160  void endIndexKey(){DB_GEN_NEW};
161  void startIndexValue(bool){DB_GEN_NEW};
162  void endIndexValue(const QCString &,bool){DB_GEN_NEW};
163  void startItemList() {DB_GEN_EMPTY};
164  void endItemList() {DB_GEN_EMPTY};
165 
166  void startIndexItem(const QCString &,const QCString &){DB_GEN_NEW};
167  void endIndexItem(const QCString &,const QCString &){DB_GEN_NEW};
168  void startItemListItem() {DB_GEN_EMPTY};
169  void endItemListItem() {DB_GEN_EMPTY};
170  void docify(const QCString &text);
171  void writeChar(char);
172  void writeString(const QCString &);
173  void startParagraph(const QCString &);
174  void endParagraph();
175  void writeObjectLink(const QCString &,const QCString &,const QCString &,const QCString &);
176  void startHtmlLink(const QCString &){DB_GEN_NEW};
177  void endHtmlLink(){DB_GEN_NEW};
178  void startBold();
179  void endBold();
180  void startTypewriter();
181  void endTypewriter();
182  void startEmphasis(){DB_GEN_NEW};
183  void endEmphasis(){DB_GEN_NEW};
184  void writeRuler();
185  void startDescription(){DB_GEN_NEW};
186  void endDescription(){DB_GEN_NEW};
187  void startDescItem(){DB_GEN_NEW};
188  void startDescForItem(){DB_GEN_EMPTY};
189  void endDescForItem(){DB_GEN_EMPTY};
190  void endDescItem(){DB_GEN_NEW};
191  void startCenter(){DB_GEN_NEW};
192  void endCenter(){DB_GEN_NEW};
193  void startSmall(){DB_GEN_NEW};
194  void endSmall(){DB_GEN_NEW};
195  void startExamples();
196  void endExamples();
197  void startParamList(BaseOutputDocInterface::ParamListTypes,const QCString &){DB_GEN_NEW};
198  void endParamList(){DB_GEN_NEW};
199  void startTitle(){DB_GEN_NEW};
200  void endTitle(){DB_GEN_NEW};
201  void writeAnchor(const QCString &,const QCString &){DB_GEN_EMPTY};
202  void startSection(const QCString &,const QCString &,SectionType);
203  void endSection(const QCString &,SectionType);
204  void lineBreak(const QCString &);
205  void addIndexItem(const QCString &,const QCString &);
206  void writeNonBreakableSpace(int);
207  void startDescTable(const QCString &);
208  void endDescTable();
209  void startDescTableRow();
210  void endDescTableRow();
211  void startDescTableTitle();
212  void endDescTableTitle();
213  void startDescTableData();
214  void endDescTableData();
215  void startTextLink(const QCString &,const QCString &){DB_GEN_NEW};
216  void endTextLink(){DB_GEN_NEW};
217  void startPageRef(){DB_GEN_NEW};
218  void endPageRef(const QCString &,const QCString &){DB_GEN_NEW};
219  void startSubsection(){DB_GEN_NEW};
220  void endSubsection(){DB_GEN_NEW};
221  void startSubsubsection();
222  void endSubsubsection();
223 
224 
225  void startGroupHeader(int);
226  void endGroupHeader(int);
227  void startMemberSections(){DB_GEN_EMPTY};
228  void endMemberSections(){DB_GEN_EMPTY};
229  void startHeaderSection(){DB_GEN_EMPTY};
230  void endHeaderSection(){DB_GEN_EMPTY};
231  void startMemberHeader(const QCString &anchor, int typ);
232  void endMemberHeader();
233  void startMemberSubtitle(){DB_GEN_EMPTY};
234  void endMemberSubtitle(){DB_GEN_EMPTY};
235  void startMemberDocList();
236  void endMemberDocList();
237  void startMemberList();
238  void endMemberList();
239  void startInlineHeader(){DB_GEN_NEW};
240  void endInlineHeader(){DB_GEN_NEW};
241  void startAnonTypeScope(int){DB_GEN_EMPTY};
242  void endAnonTypeScope(int){DB_GEN_EMPTY};
243  void startMemberItem(const QCString &,int,const QCString &);
244  void endMemberItem();
245  void startMemberTemplateParams();
246  void endMemberTemplateParams(const QCString &,const QCString &);
247  void startCompoundTemplateParams() { startSubsubsection(); }
248  void endCompoundTemplateParams() { endSubsubsection(); }
249  void startMemberGroupHeader(bool);
250  void endMemberGroupHeader();
251  void startMemberGroupDocs(){DB_GEN_EMPTY};
252  void endMemberGroupDocs(){DB_GEN_EMPTY};
253  void startMemberGroup();
254  void endMemberGroup(bool);
255  void insertMemberAlign(bool){DB_GEN_EMPTY};
256  void insertMemberAlignLeft(int,bool){DB_GEN_EMPTY};
257  void startMemberDoc(const QCString &,const QCString &,
258  const QCString &,const QCString &,int,int,bool);
259  void endMemberDoc(bool);
260  void startDoxyAnchor(const QCString &fName,const QCString &manName,
261  const QCString &anchor,const QCString &name,
262  const QCString &args);
263  void endDoxyAnchor(const QCString &fileName,const QCString &anchor);
264  void writeLatexSpacing(){DB_GEN_EMPTY}
265  void writeStartAnnoItem(const QCString &,const QCString &,
266  const QCString &,const QCString &){DB_GEN_NEW};
267  void writeEndAnnoItem(const QCString &){DB_GEN_NEW};
268  void startMemberDescription(const QCString &,const QCString &,bool){DB_GEN_EMPTY};
269  void endMemberDescription(){DB_GEN_EMPTY};
270  void startMemberDeclaration(){DB_GEN_EMPTY};
271  void endMemberDeclaration(const QCString &,const QCString &){DB_GEN_EMPTY};
272  void writeInheritedSectionTitle(const QCString &,const QCString &,
273  const QCString &,const QCString &,
274  const QCString &,const QCString &){DB_GEN_NEW};
275  void startIndent(){DB_GEN_EMPTY};
276  void endIndent(){DB_GEN_EMPTY};
277  void writeSynopsis(){DB_GEN_EMPTY};
278  void startClassDiagram();
279  void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &);
280  void startDotGraph();
281  void endDotGraph(DotClassGraph &g);
282  void startInclDepGraph();
283  void endInclDepGraph(DotInclDepGraph &g);
284  void startGroupCollaboration();
285  void endGroupCollaboration(DotGroupCollaboration &g);
286  void startCallGraph();
287  void endCallGraph(DotCallGraph &g);
288  void startDirDepGraph();
289  void endDirDepGraph(DotDirDeps &g);
290  void writeGraphicalHierarchy(DotGfxHierarchyTable &){DB_GEN_NEW};
291  void startQuickIndices(){DB_GEN_EMPTY};
292  void endQuickIndices(){DB_GEN_EMPTY};
293  void writeSplitBar(const QCString &){DB_GEN_EMPTY};
294  void writeNavigationPath(const QCString &){DB_GEN_NEW};
295  void writeLogo(){DB_GEN_NEW};
296  void writeQuickLinks(bool,HighlightedItem,const QCString &){DB_GEN_EMPTY};
297  void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool){DB_GEN_EMPTY};
298  void startContents(){DB_GEN_EMPTY};
299  void endContents(){DB_GEN_EMPTY};
300  void startPageDoc(const QCString &){DB_GEN_EMPTY}
301  void endPageDoc() {DB_GEN_EMPTY}
302  void startTextBlock(bool);
303  void endTextBlock(bool);
304  void lastIndexPage(){DB_GEN_EMPTY};
305  void startMemberDocPrefixItem();
306  void endMemberDocPrefixItem();
307  void startMemberDocName(bool);
308  void endMemberDocName();
309  void startParameterType(bool,const QCString &){DB_GEN_EMPTY};
310  void endParameterType(){DB_GEN_EMPTY};
311  void startParameterName(bool);
312  void endParameterName(bool,bool,bool);
313  void startParameterList(bool);
314  void endParameterList();
315  void exceptionEntry(const QCString &,bool);
316 
317  void startConstraintList(const QCString &);
318  void startConstraintParam();
319  void endConstraintParam();
320  void startConstraintType();
321  void endConstraintType();
322  void startConstraintDocs();
323  void endConstraintDocs();
324  void endConstraintList();
325 
326  void startMemberDocSimple(bool);
327  void endMemberDocSimple(bool);
328  void startInlineMemberType();
329  void endInlineMemberType();
330  void startInlineMemberName();
331  void endInlineMemberName();
332  void startInlineMemberDoc();
333  void endInlineMemberDoc();
334 
335  void startLabels();
336  void writeLabel(const QCString &,bool);
337  void endLabels();
338 
339  void setCurrentDoc(const Definition *,const QCString &,bool) {DB_GEN_EMPTY}
340  void addWord(const QCString &,bool) {DB_GEN_EMPTY}
341 
342 private:
343  void openSection(const QCString &attr=QCString());
344  void closeSection();
345  void closeAllSections();
346 
347  QCString relPath;
348  DocbookCodeGenerator m_codeGen;
349  bool m_denseText = false;
350  bool m_inGroup = false;
351  int m_levelListItem = 0;
352  bool m_inListItem[20] = { false, };
353  bool m_inSimpleSect[20] = { false, };
354  bool m_descTable = false;
355  bool m_simpleTable = false;
356  int m_inLevel = -1;
357  bool m_firstMember = false;
358  int m_openSectionCount = 0;
359 };
360 
361 #endif
void writeLineNumber(const QCString &extRef, const QCString &compId, const QCString &anchorId, int l, bool writeLineAnchor)
Definition: docbookgen.cpp:225
void startEmphasis()
Definition: docbookgen.h:182
void writeCodeAnchor(const QCString &anchor)
Definition: docbookgen.h:129
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
void codify(const QCString &text)
Definition: docbookgen.cpp:152
Text streaming class that buffers data.
Definition: textstream.h:33
void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)
Definition: docbookgen.h:117
void startCodeFragment(const QCString &style)
Definition: docbookgen.h:131
Represents a graphical class hierarchy.
Definition: dotgfxhierarchytable.h:31
Representation of a group collaboration graph.
Definition: dotgroupcollaboration.h:28
Definition: docbookgen.h:93
void endEmphasis()
Definition: docbookgen.h:183
void endFontClass()
Definition: docbookgen.h:127
void endCodeFragment(const QCString &style)
Definition: docbookgen.h:133
void endItemListItem()
Definition: docbookgen.h:169
void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &)
Definition: docbookgen.cpp:182
void endDescription()
Definition: docbookgen.h:186
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
Definition: docbookgen.cpp:158
void endItemList()
Definition: docbookgen.h:164
void startItemList()
Definition: docbookgen.h:163
void endCodeLine()
Definition: docbookgen.h:123
void writeLineNumber(const QCString &ref, const QCString &file, const QCString &anchor, int lineNumber, bool writeLineAnchor)
Definition: docbookgen.h:115
void endHtmlLink()
Definition: docbookgen.h:177
void endCodeFragment(const QCString &style)
Definition: docbookgen.cpp:275
void startFontClass(const QCString &s)
Definition: docbookgen.h:125
Class representing a built-in class diagram.
Definition: diagram.h:29
void endDescItem()
Definition: docbookgen.h:190
void startFontClass(const QCString &colorClass)
Definition: docbookgen.cpp:206
void writeCodeAnchor(const QCString &)
Definition: docbookgen.cpp:220
Representation of an call graph.
Definition: dotcallgraph.h:26
Representation of a class inheritance or dependency graph.
Definition: dotclassgraph.h:28
Definition: docbookgen.h:23
Abstract node interface with type information.
Definition: docparser.h:96
void startItemListItem()
Definition: docbookgen.h:168
Abstract output generator.
Definition: outputgen.h:330
Representation of an include dependency graph.
Definition: dotincldepgraph.h:30
Representation of an directory dependency graph.
Definition: dotdirdeps.h:25
void codify(const QCString &text)
Definition: docbookgen.h:108
void endCodeLine()
Definition: docbookgen.cpp:196
This is an alternative implementation of QCString.
Definition: qcstring.h:108
Output interface for code parser.
Definition: outputgen.h:61
void startDescription()
Definition: docbookgen.h:185
void endFontClass()
Definition: docbookgen.cpp:213
void startDescItem()
Definition: docbookgen.h:187
void startHtmlLink(const QCString &)
Definition: docbookgen.h:176
Definition: outputgen.h:50
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
Definition: docbookgen.h:110
void startCodeFragment(const QCString &style)
Definition: docbookgen.cpp:269
Definition: outputgen.h:42