latexgen.h
Go to the documentation of this file.
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 "outputgen.h"
22 
23 class QFile;
24 
25 static const char *latexStyleExtension = ".sty";
26 
28 {
29  public:
30  LatexCodeGenerator(FTextStream &t,const QCString &relPath,const QCString &sourceFile);
32  void setTextStream(FTextStream &t);
33  void setRelativePath(const QCString &path);
34  void setSourceFileName(const QCString &sourceFileName);
35  void codify(const char *text);
36  void writeCodeLink(const char *ref,const char *file,
37  const char *anchor,const char *name,
38  const char *tooltip);
39  void writeTooltip(const char *,
40  const DocLinkInfo &,
41  const char *,
42  const char *,
43  const SourceLinkInfo &,
44  const SourceLinkInfo &
45  ) {}
46  void writeLineNumber(const char *,const char *,const char *,int);
47  void startCodeLine(bool);
48  void endCodeLine();
49  void startFontClass(const char *);
50  void endFontClass();
51  void writeCodeAnchor(const char *) {}
52  void setCurrentDoc(Definition *,const char *,bool) {}
53  void addWord(const char *,bool) {}
54 
55  private:
56  void _writeCodeLink(const char *className,
57  const char *ref,const char *file,
58  const char *anchor,const char *name,
59  const char *tooltip);
60  void docify(const char *str);
65  int m_col;
67 };
68 
69 /** Generator for LaTeX output. */
71 {
72  public:
74  ~LatexGenerator();
75  static void init();
76  static void writeStyleSheetFile(QFile &f);
77  static void writeHeaderFile(QFile &f);
78  static void writeFooterFile(QFile &f);
79 
80  //OutputGenerator *copy();
81  //OutputGenerator *clone() { return new LatexGenerator(*this); }
82  //void append(const OutputGenerator *o);
83  void enable()
84  { if (genStack->top()) active=*genStack->top(); else active=TRUE; }
85  void disable() { active=FALSE; }
86  void enableIf(OutputType o) { if (o==Latex) enable(); }
87  void disableIf(OutputType o) { if (o==Latex) disable(); }
88  void disableIfNot(OutputType o) { if (o!=Latex) disable(); }
89  bool isEnabled(OutputType o) { return (o==Latex && active); }
90  OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; }
91 
92  // --- CodeOutputInterface
93  void codify(const char *text)
94  { m_codeGen.codify(text); }
95  void writeCodeLink(const char *ref, const char *file,
96  const char *anchor,const char *name,
97  const char *tooltip)
98  { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); }
99  void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber)
100  { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); }
101  void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl,
102  const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo
103  )
104  { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); }
105  void startCodeLine(bool hasLineNumbers)
106  { m_codeGen.startCodeLine(hasLineNumbers); }
107  void endCodeLine()
108  { m_codeGen.endCodeLine(); }
109  void startFontClass(const char *s)
110  { m_codeGen.startFontClass(s); }
112  { m_codeGen.endFontClass(); }
113  void writeCodeAnchor(const char *anchor)
114  { m_codeGen.writeCodeAnchor(anchor); }
115  // ---------------------------
116 
117 
118  void writeDoc(DocNode *,Definition *ctx,MemberDef *);
119 
120  void startFile(const char *name,const char *manName,const char *title);
121  void writeSearchInfo() {}
122  void writeFooter(const char *) {}
123  void endFile();
124  void clearBuffer();
125 
126  void startIndexSection(IndexSections);
127  void endIndexSection(IndexSections);
128  void writePageLink(const char *,bool);
129  void startProjectNumber();
131  void writeStyleInfo(int part);
132  void startTitleHead(const char *);
133  void startTitle();
134  void endTitleHead(const char *,const char *name);
135  void endTitle() { t << "}"; }
136 
137  void newParagraph();
138  void startParagraph();
139  void endParagraph();
140  void writeString(const char *text);
143  void startIndexList() { t << "\\begin{DoxyCompactList}" << endl; }
144  void endIndexList() { t << "\\end{DoxyCompactList}" << endl; }
145  void startIndexKey();
146  void endIndexKey();
147  void startIndexValue(bool);
148  void endIndexValue(const char *,bool);
149  void startItemList() { t << "\\begin{DoxyCompactItemize}" << endl; }
150  void endItemList() { t << "\\end{DoxyCompactItemize}" << endl; }
151  void startIndexItem(const char *ref,const char *file);
152  void endIndexItem(const char *ref,const char *file);
153  void docify(const char *text);
154  void writeObjectLink(const char *ref,const char *file,
155  const char *anchor,const char *name);
156 
157  void startTextLink(const char *,const char *);
158  void endTextLink();
159  void startHtmlLink(const char *url);
160  void endHtmlLink();
161  void startTypewriter() { t << "{\\ttfamily "; }
162  void endTypewriter() { t << "}"; }
163  void startGroupHeader(int);
164  void endGroupHeader(int);
165  void startItemListItem() { t << "\\item " << endl; }
166  void endItemListItem() {}
167 
169  void endMemberSections() {}
172  void startMemberHeader(const char *);
173  void endMemberHeader();
178  void startMemberList();
179  void endMemberList();
180  void startInlineHeader();
181  void endInlineHeader();
182  void startAnonTypeScope(int);
183  void endAnonTypeScope(int);
184  void startMemberItem(const char *,int,const char *);
185  void endMemberItem();
186  void startMemberTemplateParams();
187  void endMemberTemplateParams(const char *,const char *);
188 
189  void startMemberGroupHeader(bool);
190  void endMemberGroupHeader();
191  void startMemberGroupDocs();
192  void endMemberGroupDocs();
193  void startMemberGroup();
194  void endMemberGroup(bool);
195 
196  void insertMemberAlign(bool) {}
197 
198  void writeRuler() { t << endl << endl; }
199  void writeAnchor(const char *fileName,const char *name);
200  void startCodeFragment();
201  void endCodeFragment();
202  void startEmphasis() { t << "{\\em "; }
203  void endEmphasis() { t << "}"; }
204  void startBold() { t << "{\\bfseries "; }
205  void endBold() { t << "}"; }
206  void startDescription();
207  void endDescription();
208  void startDescItem();
209  void endDescItem();
210  void lineBreak(const char *style=0);
211  void startMemberDoc(const char *,const char *,const char *,const char *,bool);
212  void endMemberDoc(bool);
213  void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
214  void endDoxyAnchor(const char *,const char *);
215  void writeChar(char c);
216  void writeLatexSpacing() { t << "\\hspace{0.3cm}"; }
217  void writeStartAnnoItem(const char *type,const char *file,
218  const char *path,const char *name);
219  void writeEndAnnoItem(const char *name);
220  void startSubsection() { t << "\\subsection*{"; }
221  void endSubsection() { t << "}" << endl; }
222  void startSubsubsection() { t << "\\subsubsection*{"; }
223  void endSubsubsection() { t << "}" << endl; }
224  void startCenter() { t << "\\begin{center}" << endl; }
225  void endCenter() { t << "\\end{center}" << endl; }
226  void startSmall() { t << "\\footnotesize "; }
227  void endSmall() { t << "\\normalsize "; }
228  void startMemberDescription(const char *,const char *);
229  void endMemberDescription();
231  void endMemberDeclaration(const char *,const char *) {}
232  void writeInheritedSectionTitle(const char *,const char *,const char *,
233  const char *,const char *,const char *) {}
234  void startDescList(SectionTypes) { t << "\\begin{Desc}\n\\item["; }
235  void endDescList() { t << "\\end{Desc}" << endl; }
236  void startSimpleSect(SectionTypes,const char *,const char *,const char *);
237  void endSimpleSect();
238  void startParamList(ParamListTypes,const char *title);
239  void endParamList();
240  void startDescForItem() { t << "\\par" << endl; }
241  void endDescForItem() {}
242  void startSection(const char *,const char *,SectionInfo::SectionType);
243  void endSection(const char *,SectionInfo::SectionType);
244  void addIndexItem(const char *,const char *);
245  void startIndent() {}
246  void endIndent() {}
247  void writeSynopsis() {}
248  void startClassDiagram();
249  void endClassDiagram(const ClassDiagram &,const char *,const char *);
250  void startPageRef();
251  void endPageRef(const char *,const char *);
253  void endQuickIndices() {}
254  void writeSplitBar(const char *) {}
255  void writeNavigationPath(const char *) {}
256  void writeLogo() {}
257  void writeQuickLinks(bool,HighlightedItem,const char*) {}
258  void writeSummaryLink(const char *,const char *,const char *,bool) {}
259  void startContents() {}
260  void endContents() {}
261  void writeNonBreakableSpace(int);
262 
263  void startDescTable(const char *title)
264  { startSimpleSect(EnumValues,0,0,title);
265  startDescForItem();
266  t << "\\begin{description}" << endl; }
268  { t << "\\end{description}" << endl;
269  endDescForItem();
270  endSimpleSect();
271  }
273  { t << "\\item[{\\em " << endl; }
275  { t << "}]"; }
278  void lastIndexPage() {}
279 
280  void startDotGraph();
281  void endDotGraph(const DotClassGraph &);
282  void startInclDepGraph();
283  void endInclDepGraph(const DotInclDepGraph &);
284  void startCallGraph();
285  void startGroupCollaboration();
286  void endGroupCollaboration(const DotGroupCollaboration &g);
287  void endCallGraph(const DotCallGraph &);
288  void startDirDepGraph();
289  void endDirDepGraph(const DotDirDeps &g);
291 
292  void startTextBlock(bool) {}
293  void endTextBlock(bool) {}
294 
297  void startMemberDocName(bool) {}
299  void startParameterType(bool,const char *);
300  void endParameterType();
301  void startParameterName(bool);
302  void endParameterName(bool,bool,bool);
303  void startParameterList(bool);
304  void endParameterList();
305  void exceptionEntry(const char*,bool);
306 
307  void startConstraintList(const char *);
308  void startConstraintParam();
309  void endConstraintParam();
310  void startConstraintType();
311  void endConstraintType();
312  void startConstraintDocs();
313  void endConstraintDocs();
314  void endConstraintList();
315 
316  void startMemberDocSimple();
317  void endMemberDocSimple();
318  void startInlineMemberType();
319  void endInlineMemberType();
320  void startInlineMemberName();
321  void endInlineMemberName();
322  void startInlineMemberDoc();
323  void endInlineMemberDoc();
324 
325  void startLabels();
326  void writeLabel(const char *l,bool isLast);
327  void endLabels();
328 
329  void setCurrentDoc(Definition *,const char *,bool) {}
330  void addWord(const char *,bool) {}
331 
332 
333  private:
335  LatexGenerator &operator=(const LatexGenerator &);
340  int m_indent;
344 };
345 
346 #endif
static QCString name
Definition: declinfo.cpp:673
void setCurrentDoc(Definition *, const char *, bool)
Definition: latexgen.h:329
void writeTooltip(const char *, const DocLinkInfo &, const char *, const char *, const SourceLinkInfo &, const SourceLinkInfo &)
Definition: latexgen.h:39
void writeRuler()
Definition: latexgen.h:198
void setCurrentDoc(Definition *, const char *, bool)
Definition: latexgen.h:52
void endFile(OutputList &ol, bool skipNavIndex, bool skipEndContents, const QCString &navPath)
Definition: index.cpp:263
void endCenter()
Definition: latexgen.h:225
void endItemListItem()
Definition: latexgen.h:166
void startTextBlock(bool)
Definition: latexgen.h:292
void endSubsection()
Definition: latexgen.h:221
void startSubsubsection()
Definition: latexgen.h:222
static constexpr double g
Definition: Units.h:144
void startFile(OutputList &ol, const char *name, const char *manName, const char *title, HighlightedItem hli, bool additionalIndices, const char *altSidebarName)
Definition: index.cpp:244
void endContents()
Definition: latexgen.h:260
void disable()
Definition: latexgen.h:85
void startItemList()
Definition: latexgen.h:149
void setSourceFileName(const QCString &sourceFileName)
Definition: latexgen.cpp:66
void endMemberDocList()
Definition: latexgen.h:177
void enableIf(OutputType o)
Definition: latexgen.h:86
void startFontClass(const char *)
Definition: latexgen.cpp:233
void startDescTableData()
Definition: latexgen.h:276
void writeCodeLink(const char *ref, const char *file, const char *anchor, const char *name, const char *tooltip)
Definition: latexgen.cpp:160
void endBold()
Definition: latexgen.h:205
bool templateMemberItem
Definition: latexgen.h:341
void startFontClass(const char *s)
Definition: latexgen.h:109
void setTextStream(FTextStream &t)
Definition: latexgen.cpp:55
void endIndent()
Definition: latexgen.h:246
void endMemberDocName()
Definition: latexgen.h:298
void writeLatexSpacing()
Definition: latexgen.h:216
void writeSearchInfo()
Definition: latexgen.h:121
void writeCodeLink(const char *ref, const char *file, const char *anchor, const char *name, const char *tooltip)
Definition: latexgen.h:95
IndexSections
Definition: index.h:157
const bool FALSE
Definition: qglobal.h:370
void startHeaderSection()
Definition: latexgen.h:170
void endFontClass()
Definition: latexgen.h:111
void endSmall()
Definition: latexgen.h:227
void writeSummaryLink(const char *, const char *, const char *, bool)
Definition: latexgen.h:258
static QCString className
Definition: declinfo.cpp:669
void startCodeLine(bool hasLineNumbers)
Definition: latexgen.h:105
void endHeaderSection()
Definition: latexgen.h:171
QCString m_sourceFileName
Definition: latexgen.h:64
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
void startSubsection()
Definition: latexgen.h:220
init
Definition: train.py:42
void writeLineNumber(const char *, const char *, const char *, int)
Definition: latexgen.cpp:189
void endQuickIndices()
Definition: latexgen.h:253
void codify(const char *text)
Definition: latexgen.h:93
void setRelativePath(const QCString &path)
Definition: latexgen.cpp:61
static QStrList * l
Definition: config.cpp:1044
void startEmphasis()
Definition: latexgen.h:202
void startSmall()
Definition: latexgen.h:226
void startDescTableTitle()
Definition: latexgen.h:272
void startContents()
Definition: latexgen.h:259
bool disableLinks
Definition: latexgen.h:338
static void writeString(QFile &f, const char *s)
void writeCodeAnchor(const char *)
Definition: latexgen.h:51
bool isEnabled(OutputType o)
Definition: latexgen.h:89
void startMemberDocList()
Definition: latexgen.h:176
void endDescTableData()
Definition: latexgen.h:277
void endMemberSubtitle()
Definition: latexgen.h:175
void startBold()
Definition: latexgen.h:204
void endDescList()
Definition: latexgen.h:235
void endMemberSections()
Definition: latexgen.h:169
void _writeCodeLink(const char *className, const char *ref, const char *file, const char *anchor, const char *name, const char *tooltip)
void writeSynopsis()
Definition: latexgen.h:247
void endTitle()
Definition: latexgen.h:135
QCString m_relPath
Definition: latexgen.h:63
void startCodeLine(bool)
Definition: latexgen.cpp:223
void startMemberSections()
Definition: latexgen.h:168
fileName
Definition: dumpTree.py:9
void endMemberDocPrefixItem()
Definition: latexgen.h:296
void writeNavigationPath(const char *)
Definition: latexgen.h:255
void startMemberDocPrefixItem()
Definition: latexgen.h:295
void codify(const char *text)
Definition: latexgen.cpp:71
void addWord(const char *, bool)
Definition: latexgen.h:330
bool insideTabbing
Definition: latexgen.h:336
void endTextBlock(bool)
Definition: latexgen.h:293
void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)
Definition: latexgen.h:101
LatexCodeGenerator m_codeGen
Definition: latexgen.h:343
QCString relPath
Definition: latexgen.h:339
void endIndexListItem()
Definition: latexgen.h:142
void endTypewriter()
Definition: latexgen.h:162
void writeQuickLinks(bool, HighlightedItem, const char *)
Definition: latexgen.h:257
void startMemberDeclaration()
Definition: latexgen.h:230
void startDescList(SectionTypes)
Definition: latexgen.h:234
void endProjectNumber()
Definition: latexgen.h:130
void endIndexList()
Definition: latexgen.h:144
void docify(const char *str)
void addWord(const char *, bool)
Definition: latexgen.h:53
void endSubsubsection()
Definition: latexgen.h:223
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
void writeInheritedSectionTitle(const char *, const char *, const char *, const char *, const char *, const char *)
Definition: latexgen.h:232
void insertMemberAlign(bool)
Definition: latexgen.h:196
void writeCodeAnchor(const char *anchor)
Definition: latexgen.h:113
void startTitle(OutputList &ol, const char *fileName, Definition *def)
Definition: index.cpp:228
void endCodeLine()
Definition: latexgen.h:107
void startQuickIndices()
Definition: latexgen.h:252
void startDescForItem()
Definition: latexgen.h:240
void startIndexList()
Definition: latexgen.h:143
FTextStream m_t
Definition: latexgen.h:62
void writeSplitBar(const char *)
Definition: latexgen.h:254
void startCenter()
Definition: latexgen.h:224
static const char * latexStyleExtension
Definition: latexgen.h:25
void startDescTable(const char *title)
Definition: latexgen.h:263
void lastIndexPage()
Definition: latexgen.h:278
void disableIfNot(OutputType o)
Definition: latexgen.h:88
void endEmphasis()
Definition: latexgen.h:203
HighlightedItem
Definition: index.h:180
void startTypewriter()
Definition: latexgen.h:161
void startItemListItem()
Definition: latexgen.h:165
void endItemList()
Definition: latexgen.h:150
void writeLineNumber(const char *ref, const char *file, const char *anchor, int lineNumber)
Definition: latexgen.h:99
void endDescTable()
Definition: latexgen.h:267
void startIndexListItem()
Definition: latexgen.h:141
void endDescTableTitle()
Definition: latexgen.h:274
void startMemberSubtitle()
Definition: latexgen.h:174
void endMemberDeclaration(const char *, const char *)
Definition: latexgen.h:231
bool firstDescItem
Definition: latexgen.h:337
void endDescForItem()
Definition: latexgen.h:241
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
void writeFooter(const char *)
Definition: latexgen.h:122
static QCString str
void enable()
Definition: latexgen.h:83
QTextStream & endl(QTextStream &s)
void disableIf(OutputType o)
Definition: latexgen.h:87
void startMemberDocName(bool)
Definition: latexgen.h:297
void writeGraphicalHierarchy(const DotGfxHierarchyTable &)
Definition: latexgen.h:290
void startIndent()
Definition: latexgen.h:245
bool m_prettyCode
Definition: latexgen.h:342
void writeLogo()
Definition: latexgen.h:256