doxygen
latexgen.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  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 
18 #ifndef LATEXGEN_H
19 #define LATEXGEN_H
20 
21 #include "config.h"
22 #include "outputgen.h"
23 
24 #define LATEX_STYLE_EXTENSION ".sty"
25 
26 class TextStream;
27 
29 {
30  public:
31  LatexCodeGenerator(TextStream &t,const QCString &relPath,const QCString &sourceFile);
33  void setRelativePath(const QCString &path);
34  void setSourceFileName(const QCString &sourceFileName);
35  void codify(const QCString &text) override;
36  void writeCodeLink(CodeSymbolType type,
37  const QCString &ref,const QCString &file,
38  const QCString &anchor,const QCString &name,
39  const QCString &tooltip) override;
40  void writeTooltip(const QCString &,
41  const DocLinkInfo &,
42  const QCString &,
43  const QCString &,
44  const SourceLinkInfo &,
45  const SourceLinkInfo &
46  ) override{}
47  void writeLineNumber(const QCString &,const QCString &,const QCString &,int,bool) override;
48  void startCodeLine(bool) override;
49  void endCodeLine() override;
50  void startFontClass(const QCString &) override;
51  void endFontClass() override;
52  void writeCodeAnchor(const QCString &) override {}
53  void setCurrentDoc(const Definition *,const QCString &,bool) override {}
54  void addWord(const QCString &,bool) override {}
55  void startCodeFragment(const QCString &style) override;
56  void endCodeFragment(const QCString &style) override;
57 
58  // extra methods not part of CodeOutputInterface
59  void incUsedTableLevel() { m_usedTableLevel++; }
60  void decUsedTableLevel() { m_usedTableLevel--; }
61  int usedTableLevel() const { return m_usedTableLevel; }
62 
63  private:
64  void _writeCodeLink(const QCString &className,
65  const QCString &ref,const QCString &file,
66  const QCString &anchor,const QCString &name,
67  const QCString &tooltip);
68  void docify(const QCString &str);
69  bool m_streamSet = false;
70  TextStream &m_t;
71  QCString m_relPath;
72  QCString m_sourceFileName;
73  int m_col = 0;
74  bool m_doxyCodeLineOpen = false;
75  int m_usedTableLevel = 0;
76 };
77 
80 {
81  public:
84  LatexGenerator &operator=(const LatexGenerator &);
85  virtual ~LatexGenerator();
86  virtual std::unique_ptr<OutputGenerator> clone() const;
87 
88  static void init();
89  void cleanup();
90  static void writeStyleSheetFile(TextStream &t);
91  static void writeHeaderFile(TextStream &t);
92  static void writeFooterFile(TextStream &t);
93 
94  virtual OutputType type() const { return Latex; }
95 
96  // --- CodeOutputInterface
97  void codify(const QCString &text)
98  { m_codeGen.codify(text); }
99  void writeCodeLink(CodeSymbolType type,
100  const QCString &ref, const QCString &file,
101  const QCString &anchor,const QCString &name,
102  const QCString &tooltip)
103  { m_codeGen.writeCodeLink(type,ref,file,anchor,name,tooltip); }
104  void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,int lineNumber, bool writeLineAnchor)
105  { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber,writeLineAnchor); }
106  void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl,
107  const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo
108  )
109  { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); }
110  void startCodeLine(bool hasLineNumbers)
111  { m_codeGen.startCodeLine(hasLineNumbers); }
112  void endCodeLine()
113  { m_codeGen.endCodeLine(); }
114  void startFontClass(const QCString &s)
115  { m_codeGen.startFontClass(s); }
117  { m_codeGen.endFontClass(); }
118  void writeCodeAnchor(const QCString &anchor)
119  { m_codeGen.writeCodeAnchor(anchor); }
120  void startCodeFragment(const QCString &style)
121  { m_codeGen.startCodeFragment(style); }
122  void endCodeFragment(const QCString &style)
123  { m_codeGen.endCodeFragment(style); }
124  // ---------------------------
125 
126 
127  void writeDoc(DocNode *,const Definition *ctx,const MemberDef *,int id);
128 
129  void startFile(const QCString &name,const QCString &manName,const QCString &title,int id);
130  void writeSearchInfo() {}
131  void writeFooter(const QCString &) {}
132  void endFile();
133  void clearBuffer();
134 
135  void startIndexSection(IndexSections);
136  void endIndexSection(IndexSections);
137  void writePageLink(const QCString &,bool);
138  void startProjectNumber();
139  void endProjectNumber() {}
140  void writeStyleInfo(int part);
141  void startTitleHead(const QCString &);
142  void startTitle();
143  void endTitleHead(const QCString &,const QCString &name);
144  void endTitle() { m_t << "}"; }
145 
146  void newParagraph();
147  void startParagraph(const QCString &classDef);
148  void endParagraph();
149  void writeString(const QCString &text);
150  void startIndexListItem() {}
151  void endIndexListItem() {}
152  void startIndexList() { m_t << "\\begin{DoxyCompactList}\n"; }
153  void endIndexList() { m_t << "\\end{DoxyCompactList}\n"; }
154  void startIndexKey();
155  void endIndexKey();
156  void startIndexValue(bool);
157  void endIndexValue(const QCString &,bool);
158  void startItemList() { m_t << "\\begin{DoxyCompactItemize}\n"; }
159  void endItemList() { m_t << "\\end{DoxyCompactItemize}\n"; }
160  void startIndexItem(const QCString &ref,const QCString &file);
161  void endIndexItem(const QCString &ref,const QCString &file);
162  void docify(const QCString &text);
163  void writeObjectLink(const QCString &ref,const QCString &file,
164  const QCString &anchor,const QCString &name);
165 
166  void startTextLink(const QCString &,const QCString &);
167  void endTextLink();
168  void startHtmlLink(const QCString &url);
169  void endHtmlLink();
170  void startTypewriter() { m_t << "{\\ttfamily "; }
171  void endTypewriter() { m_t << "}"; }
172  void startGroupHeader(int);
173  void endGroupHeader(int);
174  void startItemListItem() { m_t << "\\item \n"; }
175  void endItemListItem() {}
176 
177  void startMemberSections() {}
178  void endMemberSections() {}
179  void startHeaderSection() {}
180  void endHeaderSection() {}
181  void startMemberHeader(const QCString &,int);
182  void endMemberHeader();
183  void startMemberSubtitle() {}
184  void endMemberSubtitle() {}
185  void startMemberDocList() {}
186  void endMemberDocList() {}
187  void startMemberList();
188  void endMemberList();
189  void startInlineHeader();
190  void endInlineHeader();
191  void startAnonTypeScope(int);
192  void endAnonTypeScope(int);
193  void startMemberItem(const QCString &,int,const QCString &);
194  void endMemberItem();
195  void startMemberTemplateParams();
196  void endMemberTemplateParams(const QCString &,const QCString &);
197  void startCompoundTemplateParams() { startSubsubsection(); }
198  void endCompoundTemplateParams() { endSubsubsection(); }
199 
200  void startMemberGroupHeader(bool);
201  void endMemberGroupHeader();
202  void startMemberGroupDocs();
203  void endMemberGroupDocs();
204  void startMemberGroup();
205  void endMemberGroup(bool);
206 
207  void insertMemberAlign(bool) {}
208  void insertMemberAlignLeft(int,bool){}
209 
210  void writeRuler() { m_t << "\n\n"; }
211  void writeAnchor(const QCString &fileName,const QCString &name);
212  void startEmphasis() { m_t << "{\\em "; }
213  void endEmphasis() { m_t << "}"; }
214  void startBold() { m_t << "{\\bfseries "; }
215  void endBold() { m_t << "}"; }
216  void startDescription();
217  void endDescription();
218  void startDescItem();
219  void endDescItem();
220  void lineBreak(const QCString &style=QCString());
221  void startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool);
222  void endMemberDoc(bool);
223  void startDoxyAnchor(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &);
224  void endDoxyAnchor(const QCString &,const QCString &);
225  void writeChar(char c);
226  void writeLatexSpacing() { m_t << "\\hspace{0.3cm}"; }
227  void writeStartAnnoItem(const QCString &type,const QCString &file,
228  const QCString &path,const QCString &name);
229  void writeEndAnnoItem(const QCString &name);
230  void startSubsection() { m_t << "\\subsection*{"; }
231  void endSubsection() { m_t << "}\n"; }
232  void startSubsubsection() { m_t << "\\subsubsection*{"; }
233  void endSubsubsection() { m_t << "}\n"; }
234  void startCenter() { m_t << "\\begin{center}\n"; }
235  void endCenter() { m_t << "\\end{center}\n"; }
236  void startSmall() { m_t << "\\footnotesize "; }
237  void endSmall() { m_t << "\\normalsize "; }
238  void startMemberDescription(const QCString &,const QCString &,bool);
239  void endMemberDescription();
240  void startMemberDeclaration() {}
241  void endMemberDeclaration(const QCString &,const QCString &) {}
242  void writeInheritedSectionTitle(const QCString &,const QCString &,const QCString &,
243  const QCString &,const QCString &,const QCString &) {}
244  void startDescList(SectionTypes) { m_t << "\\begin{Desc}\n\\item["; }
245  void endDescList() { m_t << "\\end{Desc}\n"; }
246  void startExamples();
247  void endExamples();
248  void startParamList(ParamListTypes,const QCString &title);
249  void endParamList();
250  void startDescForItem() { m_t << "\\par\n"; }
251  void endDescForItem() {}
252  void startSection(const QCString &,const QCString &,SectionType);
253  void endSection(const QCString &,SectionType);
254  void addIndexItem(const QCString &,const QCString &);
255  void startIndent() {}
256  void endIndent() {}
257  void writeSynopsis() {}
258  void startClassDiagram();
259  void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &);
260  void startPageRef();
261  void endPageRef(const QCString &,const QCString &);
262  void startQuickIndices() {}
263  void endQuickIndices() {}
264  void writeSplitBar(const QCString &) {}
265  void writeNavigationPath(const QCString &) {}
266  void writeLogo() {}
267  void writeQuickLinks(bool,HighlightedItem,const QCString &) {}
268  void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool) {}
269  void startContents() {}
270  void endContents() {}
271  void writeNonBreakableSpace(int);
272 
273  void startDescTable(const QCString &title);
274  void endDescTable();
275  void startDescTableRow();
276  void endDescTableRow();
277  void startDescTableTitle();
278  void endDescTableTitle();
279  void startDescTableData();
280  void endDescTableData();
281  void lastIndexPage();
282 
283  void startDotGraph();
284  void endDotGraph(DotClassGraph &);
285  void startInclDepGraph();
286  void endInclDepGraph(DotInclDepGraph &);
287  void startCallGraph();
288  void startGroupCollaboration();
289  void endGroupCollaboration(DotGroupCollaboration &g);
290  void endCallGraph(DotCallGraph &);
291  void startDirDepGraph();
292  void endDirDepGraph(DotDirDeps &g);
293  void writeGraphicalHierarchy(DotGfxHierarchyTable &) {}
294 
295  void startTextBlock(bool) {}
296  void endTextBlock(bool) {}
297 
298  void startMemberDocPrefixItem() {}
299  void endMemberDocPrefixItem() { m_t << "\\\\\n"; }
300  void startMemberDocName(bool) {}
301  void endMemberDocName() {}
302  void startParameterType(bool,const QCString &);
303  void endParameterType();
304  void startParameterName(bool);
305  void endParameterName(bool,bool,bool);
306  void startParameterList(bool);
307  void endParameterList();
308  void exceptionEntry(const QCString &,bool);
309 
310  void startConstraintList(const QCString &);
311  void startConstraintParam();
312  void endConstraintParam();
313  void startConstraintType();
314  void endConstraintType();
315  void startConstraintDocs();
316  void endConstraintDocs();
317  void endConstraintList();
318 
319  void startMemberDocSimple(bool);
320  void endMemberDocSimple(bool);
321  void startInlineMemberType();
322  void endInlineMemberType();
323  void startInlineMemberName();
324  void endInlineMemberName();
325  void startInlineMemberDoc();
326  void endInlineMemberDoc();
327 
328  void startLabels();
329  void writeLabel(const QCString &l,bool isLast);
330  void endLabels();
331 
332  void setCurrentDoc(const Definition *,const QCString &,bool) {}
333  void addWord(const QCString &,bool) {}
334 
335 
336  private:
337  bool m_insideTabbing = false;
338  bool m_firstDescItem = true;
339  bool m_disableLinks = false;
340  QCString m_relPath;
341  int m_indent = 0;
342  bool templateMemberItem = false;
343  LatexCodeGenerator m_codeGen;
344 };
345 
346 #endif
void writeRuler()
Definition: latexgen.h:210
void codify(const QCString &text)
Definition: latexgen.h:97
void endItemListItem()
Definition: latexgen.h:175
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
void startItemList()
Definition: latexgen.h:158
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
void endBold()
Definition: latexgen.h:215
void startCodeFragment(const QCString &style)
Definition: latexgen.h:120
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
Definition: latexgen.cpp:149
void endFontClass()
Definition: latexgen.h:116
Text streaming class that buffers data.
Definition: textstream.h:33
void writeLineNumber(const QCString &, const QCString &, const QCString &, int, bool) override
Definition: latexgen.cpp:174
void endFontClass() override
Definition: latexgen.cpp:242
void startEmphasis()
Definition: latexgen.h:212
void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)
Definition: latexgen.h:106
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
Definition: latexgen.h:99
void codify(const QCString &text) override
Definition: latexgen.cpp:71
Represents a graphical class hierarchy.
Definition: dotgfxhierarchytable.h:31
void startBold()
Definition: latexgen.h:214
Representation of a group collaboration graph.
Definition: dotgroupcollaboration.h:28
void endTypewriter()
Definition: latexgen.h:171
Definition: latexgen.h:28
void writeLineNumber(const QCString &ref, const QCString &file, const QCString &anchor, int lineNumber, bool writeLineAnchor)
Definition: latexgen.h:104
void endCodeFragment(const QCString &style)
Definition: latexgen.h:122
void startFontClass(const QCString &) override
Definition: latexgen.cpp:237
Class representing a built-in class diagram.
Definition: diagram.h:29
void endCodeLine()
Definition: latexgen.h:112
void startFontClass(const QCString &s)
Definition: latexgen.h:114
void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &) override
Definition: latexgen.h:40
Representation of an call graph.
Definition: dotcallgraph.h:26
Representation of a class inheritance or dependency graph.
Definition: dotclassgraph.h:28
Generator for LaTeX output.
Definition: latexgen.h:79
Abstract node interface with type information.
Definition: docparser.h:96
Abstract output generator.
Definition: outputgen.h:330
void endCodeFragment(const QCString &style) override
Definition: latexgen.cpp:252
void writeCodeAnchor(const QCString &anchor)
Definition: latexgen.h:118
void endEmphasis()
Definition: latexgen.h:213
Representation of an include dependency graph.
Definition: dotincldepgraph.h:30
void startTypewriter()
Definition: latexgen.h:170
void startItemListItem()
Definition: latexgen.h:174
Representation of an directory dependency graph.
Definition: dotdirdeps.h:25
void endItemList()
Definition: latexgen.h:159
This is an alternative implementation of QCString.
Definition: qcstring.h:108
Output interface for code parser.
Definition: outputgen.h:61
void endCodeLine() override
Definition: latexgen.cpp:227
void startCodeFragment(const QCString &style) override
Definition: latexgen.cpp:247
void writeCodeAnchor(const QCString &) override
Definition: latexgen.h:52
Definition: outputgen.h:50
Definition: outputgen.h:42