Fix for UBSan build
[platform/upstream/doxygen.git] / src / latexgen.h
1 /******************************************************************************
2  *
3  * $Id: latexgen.h,v 1.50 2001/03/19 19:27:41 root Exp $
4  *
5  * Copyright (C) 1997-2012 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 /** Generator for LaTeX output. */
26 class LatexGenerator : public OutputGenerator
27 {
28   public:
29     LatexGenerator();
30    ~LatexGenerator();
31     static void init();
32     static void writeStyleSheetFile(QFile &f);
33     static void writeHeaderFile(QFile &f);
34     static void writeFooterFile(QFile &f);
35
36     //OutputGenerator *copy();
37     //OutputGenerator *clone() { return new LatexGenerator(*this); }
38     //void append(const OutputGenerator *o);
39     void enable() 
40     { if (genStack->top()) active=*genStack->top(); else active=TRUE; }
41     void disable() { active=FALSE; }
42     void enableIf(OutputType o)  { if (o==Latex) enable();  }
43     void disableIf(OutputType o) { if (o==Latex) disable(); }
44     void disableIfNot(OutputType o) { if (o!=Latex) disable(); }
45     bool isEnabled(OutputType o) { return (o==Latex && active); } 
46     OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; }
47
48     void writeDoc(DocNode *,Definition *ctx,MemberDef *);
49
50     void startFile(const char *name,const char *manName,const char *title);
51     void writeSearchInfo() {}
52     void writeFooter(const char *) {}
53     void endFile();
54     void clearBuffer();
55     
56     void startIndexSection(IndexSections);
57     void endIndexSection(IndexSections);
58     void writePageLink(const char *,bool);
59     void startProjectNumber();
60     void endProjectNumber() {}
61     void writeStyleInfo(int part);
62     void startTitleHead(const char *);
63     void startTitle();
64     void endTitleHead(const char *,const char *name);
65     void endTitle()   { t << "}"; }
66
67     void newParagraph();
68     void startParagraph();
69     void endParagraph();
70     void writeString(const char *text);
71     void startIndexListItem() {}
72     void endIndexListItem() {}
73     void startIndexList() { t << "\\begin{DoxyCompactList}"    << endl; }
74     void endIndexList()   { t << "\\end{DoxyCompactList}"      << endl; }
75     void startIndexKey();
76     void endIndexKey();
77     void startIndexValue(bool);
78     void endIndexValue(const char *,bool);
79     void startItemList()  { t << "\\begin{DoxyCompactItemize}" << endl; }
80     void endItemList()    { t << "\\end{DoxyCompactItemize}"   << endl; }
81     void startIndexItem(const char *ref,const char *file);
82     void endIndexItem(const char *ref,const char *file);
83     void docify(const char *text);
84     void codify(const char *text);
85     void writeObjectLink(const char *ref,const char *file,
86                          const char *anchor,const char *name);
87     void writeCodeLink(const char *ref, const char *file,
88                        const char *anchor,const char *name,
89                        const char *tooltip);
90     void startTextLink(const char *,const char *);
91     void endTextLink();
92     void startHtmlLink(const char *url);
93     void endHtmlLink();
94     void startTypewriter() { t << "{\\ttfamily "; }
95     void endTypewriter()   { t << "}";      }
96     void startGroupHeader(int);
97     void endGroupHeader(int);
98     void startItemListItem() { t << "\\item " << endl; }
99     void endItemListItem()   {}
100
101     void startMemberSections() {}
102     void endMemberSections() {} 
103     void startHeaderSection() {}
104     void endHeaderSection() {}
105     void startMemberHeader(const char *);
106     void endMemberHeader();
107     void startMemberSubtitle() {}
108     void endMemberSubtitle() {}
109     void startMemberDocList() {}
110     void endMemberDocList() {}
111     void startMemberList();
112     void endMemberList();
113     void startInlineHeader();
114     void endInlineHeader();
115     void startAnonTypeScope(int);
116     void endAnonTypeScope(int);
117     void startMemberItem(const char *,int,const char *);
118     void endMemberItem();
119     void startMemberTemplateParams();
120     void endMemberTemplateParams(const char *,const char *);
121
122     void startMemberGroupHeader(bool);
123     void endMemberGroupHeader();
124     void startMemberGroupDocs();
125     void endMemberGroupDocs();
126     void startMemberGroup();
127     void endMemberGroup(bool);
128     
129     void insertMemberAlign(bool) {}
130
131     void writeRuler() { t << endl << endl; }
132     void writeAnchor(const char *fileName,const char *name);
133     void startCodeFragment();
134     void endCodeFragment();
135     void writeLineNumber(const char *,const char *,const char *,int l);
136     void startCodeLine(bool hasLineNumbers);
137     void endCodeLine();
138     void startEmphasis() { t << "{\\em ";  }
139     void endEmphasis()   { t << "}"; }
140     void startBold()     { t << "{\\bfseries "; }
141     void endBold()       { t << "}"; }
142     void startDescription();
143     void endDescription();
144     void startDescItem();
145     void endDescItem();
146     void lineBreak(const char *style=0);
147     void startMemberDoc(const char *,const char *,const char *,const char *,bool);
148     void endMemberDoc(bool);
149     void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
150     void endDoxyAnchor(const char *,const char *);
151     void startCodeAnchor(const char *);
152     void endCodeAnchor();
153     void writeChar(char c);
154     void writeLatexSpacing() { t << "\\hspace{0.3cm}"; }
155     void writeStartAnnoItem(const char *type,const char *file, 
156                             const char *path,const char *name);
157     void writeEndAnnoItem(const char *name);
158     void startSubsection() { t << "\\subsection*{"; }
159     void endSubsection() { t << "}" << endl; }
160     void startSubsubsection() { t << "\\subsubsection*{"; }
161     void endSubsubsection() { t << "}" << endl; }
162     void startCenter()      { t << "\\begin{center}" << endl; }
163     void endCenter()        { t << "\\end{center}" << endl; }
164     void startSmall()       { t << "\\footnotesize "; }
165     void endSmall()         { t << "\\normalsize "; }
166     void startMemberDescription(const char *,const char *);
167     void endMemberDescription();
168     void startMemberDeclaration() {} 
169     void endMemberDeclaration(const char *,const char *) {}
170     void writeInheritedSectionTitle(const char *,const char *,const char *,
171                       const char *,const char *,const char *) {}
172     void startDescList(SectionTypes)     { t << "\\begin{Desc}\n\\item["; }
173     void endDescList()       { t << "\\end{Desc}" << endl; }
174     void startSimpleSect(SectionTypes,const char *,const char *,const char *);
175     void endSimpleSect();
176     void startParamList(ParamListTypes,const char *title);
177     void endParamList();
178     void startDescForItem()     { t << "\\par" << endl; }
179     void endDescForItem()       {}
180     void startSection(const char *,const char *,SectionInfo::SectionType);
181     void endSection(const char *,SectionInfo::SectionType);
182     void addIndexItem(const char *,const char *);
183     void startIndent()       {}
184     void endIndent()         {}
185     void writeSynopsis()     {}
186     void startClassDiagram();
187     void endClassDiagram(const ClassDiagram &,const char *,const char *);
188     void startPageRef();
189     void endPageRef(const char *,const char *);
190     void startQuickIndices() {}
191     void endQuickIndices() {}
192     void writeSplitBar(const char *) {}
193     void writeNavigationPath(const char *) {}
194     void writeLogo() {}
195     void writeQuickLinks(bool,HighlightedItem,const char*) {}
196     void writeSummaryLink(const char *,const char *,const char *,bool) {}
197     void startContents() {}
198     void endContents() {}
199     void writeNonBreakableSpace(int);
200     
201     void startDescTable()
202     { t << "\\begin{description}" << endl; }
203     void endDescTable()
204     { t << "\\end{description}" << endl; }
205     void startDescTableTitle()
206     { t << "\\item[{\\em " << endl; }
207     void endDescTableTitle()
208     { t << "}]"; }
209     void startDescTableData() {}
210     void endDescTableData() {}
211     void lastIndexPage() {}
212
213     void startDotGraph();
214     void endDotGraph(const DotClassGraph &);
215     void startInclDepGraph();
216     void endInclDepGraph(const DotInclDepGraph &);
217     void startCallGraph();
218     void startGroupCollaboration();
219     void endGroupCollaboration(const DotGroupCollaboration &g);
220     void endCallGraph(const DotCallGraph &);
221     void startDirDepGraph();
222     void endDirDepGraph(const DotDirDeps &g);
223     void writeGraphicalHierarchy(const DotGfxHierarchyTable &) {}
224
225     void startTextBlock(bool) {}
226     void endTextBlock(bool) {}
227
228     void startMemberDocPrefixItem() {}
229     void endMemberDocPrefixItem() {}
230     void startMemberDocName(bool) {}
231     void endMemberDocName() {}
232     void startParameterType(bool,const char *);
233     void endParameterType();
234     void startParameterName(bool);
235     void endParameterName(bool,bool,bool);
236     void startParameterList(bool);
237     void endParameterList();
238
239     void startConstraintList(const char *);
240     void startConstraintParam();
241     void endConstraintParam();
242     void startConstraintType();
243     void endConstraintType();
244     void startConstraintDocs();
245     void endConstraintDocs();
246     void endConstraintList();
247
248     void startMemberDocSimple();
249     void endMemberDocSimple();
250     void startInlineMemberType();
251     void endInlineMemberType();
252     void startInlineMemberName();
253     void endInlineMemberName();
254     void startInlineMemberDoc();
255     void endInlineMemberDoc();
256
257     void startLabels();
258     void writeLabel(const char *l,bool isLast);
259     void endLabels();
260
261     void startFontClass(const char *); // {}
262     void endFontClass(); // {}
263
264     void writeCodeAnchor(const char *) {}
265     void linkableSymbol(int,const char *,Definition *,Definition *) {}
266
267   private:
268     LatexGenerator(const LatexGenerator &);
269     LatexGenerator &operator=(const LatexGenerator &);
270     void escapeLabelName(const char *s);
271     void escapeMakeIndexChars(const char *s);
272     int col;
273     bool insideTabbing;
274     bool firstDescItem;
275     bool disableLinks;
276     QCString relPath;
277     QCString sourceFileName;
278     int m_indent;
279     bool templateMemberItem;
280     bool m_prettyCode;
281 };
282
283 #endif