summaryrefslogtreecommitdiffstats
path: root/src/outputgen.h
blob: 49bd7347791e8fb9239073b5be649d1ec2683dee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/******************************************************************************
 *
 * 
 *
 * Copyright (C) 1997-2001 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#ifndef OUTPUTGEN_H
#define OUTPUTGEN_H

#include "qtbc.h"
#include <qtextstream.h>
#include <qbuffer.h>
#include <qfile.h>
#include <qstack.h>
#include "index.h"

class ClassDiagram;
class DotClassGraph;
class DotInclDepGraph;
class DotGfxHierarchyTable;

class OutputGenerator
{
  public:
    enum OutputType { Html, Latex, Man, RTF, XML };

    OutputGenerator();
    virtual ~OutputGenerator();

    virtual OutputGenerator *copy() = 0;
    virtual void append(const OutputGenerator *) = 0;
    virtual void enable() = 0;
    virtual void disable() = 0;
    virtual void enableIf(OutputType o) = 0;
    virtual void disableIf(OutputType o) = 0;
    virtual void disableIfNot(OutputType o) = 0;
    virtual bool isEnabled(OutputType o) = 0;
    virtual OutputGenerator *get(OutputType o) = 0;

    virtual void startFile(const char *name,const char *title,bool ext) = 0;
    virtual void writeFooter(int,bool) = 0;
    virtual void endFile() = 0;
    virtual void startIndexSection(IndexSections) = 0;
    virtual void endIndexSection(IndexSections) = 0;
    virtual void startProjectNumber() = 0;
    virtual void endProjectNumber() = 0;
    virtual void writeStyleInfo(int part) = 0;
    virtual void startTitleHead(const char *) = 0;
    virtual void endTitleHead(const char *fileName,const char *name) = 0;
    virtual void startTitle() = 0;
    virtual void endTitle()   = 0;
    virtual void newParagraph()   = 0;
    virtual void writeString(const char *text) = 0;
    virtual void startIndexList() = 0;
    virtual void endIndexList()   = 0;
    virtual void startItemList()  = 0;
    virtual void endItemList()    = 0;
    virtual void startEnumList()  = 0;
    virtual void endEnumList()    = 0;
    virtual void startBold()      = 0;
    virtual void endBold()        = 0;
    virtual void startAlphabeticalIndexList() = 0;
    virtual void endAlphabeticalIndexList() = 0;
    virtual void writeIndexHeading(const char *s) = 0;
    virtual void writeIndexItem(const char *ref,const char *file,
                                const char *text) = 0;
    virtual void docify(const char *s) = 0;
    virtual void codify(const char *s) = 0;
    virtual void writeObjectLink(const char *ref,const char *file,
                                 const char *anchor, const char *text) = 0;
    virtual void writeCodeLink(const char *ref,const char *file,
                               const char *anchor,const char *text) = 0;
    virtual void startTextLink(const char *file,const char *anchor) = 0;
    virtual void endTextLink() = 0;
    virtual void writeHtmlLink(const char *url,const char *text) = 0;
    virtual void writeMailLink(const char *url) = 0;
    virtual void startTypewriter() = 0;
    virtual void endTypewriter() = 0;
    virtual void startGroupHeader() = 0;
    virtual void endGroupHeader() = 0;
    virtual void writeListItem() = 0;

    virtual void startMemberSections() = 0;
    virtual void endMemberSections() = 0;
    virtual void startMemberHeader() = 0;
    virtual void endMemberHeader() = 0;
    virtual void startMemberSubtitle() = 0;
    virtual void endMemberSubtitle() = 0;
    virtual void startMemberList()  = 0;
    virtual void endMemberList()    = 0;
    virtual void startMemberItem(int) = 0;
    virtual void endMemberItem(bool) = 0;
    virtual void startMemberGroupHeader(bool) = 0;
    virtual void endMemberGroupHeader() = 0;
    virtual void startMemberGroupDocs() = 0;
    virtual void endMemberGroupDocs() = 0;
    virtual void startMemberGroup() = 0;
    virtual void endMemberGroup(bool) = 0;
    virtual void insertMemberAlign() = 0;

    virtual void writeRuler() = 0;
    virtual void writeAnchor(const char *fileName,const char *name) = 0;
    virtual void startCodeFragment() = 0;
    virtual void endCodeFragment() = 0;
    virtual void startPreFragment() = 0;
    virtual void endPreFragment() = 0;
    virtual void startCodeLine() = 0;
    virtual void endCodeLine() = 0;
    virtual void writeBoldString(const char *text) = 0;
    virtual void startEmphasis() = 0;
    virtual void endEmphasis() = 0;
    virtual void writeChar(char c) = 0;
    virtual void startMemberDoc(const char *,const char *,
                                const char *,const char *) = 0;
    virtual void endMemberDoc() = 0;
    virtual void startDoxyAnchor(const char *fName,const char *anchor,
                                 const char *name) = 0;
    virtual void endDoxyAnchor(const char *fileName,const char *anchor) = 0;
    virtual void startCodeAnchor(const char *label) = 0;
    virtual void endCodeAnchor() = 0;
    virtual void writeLatexSpacing() = 0;
    virtual void writeStartAnnoItem(const char *type,const char *file,
                                    const char *path,const char *name) = 0;
    virtual void writeEndAnnoItem(const char *name) = 0;
    virtual void startDescription() = 0;
    virtual void endDescription() = 0;
    virtual void startDescItem() = 0;
    virtual void endDescItem() = 0;
    virtual void startSubsection() = 0;
    virtual void endSubsection() = 0;
    virtual void startSubsubsection() = 0;
    virtual void endSubsubsection() = 0;
    virtual void startCenter() = 0;
    virtual void endCenter() = 0;
    virtual void startSmall() = 0;
    virtual void endSmall() = 0;
    virtual void startSubscript() = 0;
    virtual void endSubscript() = 0;
    virtual void startSuperscript() = 0;
    virtual void endSuperscript() = 0;
    virtual void startTable(int cols) = 0;
    virtual void endTable() = 0;
    virtual void nextTableRow() = 0;
    virtual void endTableRow() = 0;
    virtual void nextTableColumn() = 0;
    virtual void endTableColumn() = 0;
    virtual void writeQuote() = 0;
    virtual void writeCopyright() = 0;
    virtual void writeUmlaut(char) = 0;
    virtual void writeAcute(char) = 0;
    virtual void writeGrave(char) = 0;
    virtual void writeCirc(char) = 0;
    virtual void writeTilde(char) = 0;
    virtual void writeRing(char) = 0;
    virtual void writeSharpS() = 0;
    virtual void startMemberDescription() = 0;
    virtual void endMemberDescription() = 0;
    virtual void startDescList() = 0;
    virtual void endDescTitle() = 0;
    virtual void writeDescItem() = 0;
    virtual void endDescList() = 0;
    virtual void startSection(const char *,const char *,bool) = 0;
    virtual void endSection(const char *,bool) = 0;
    virtual void writeSectionRef(const char *,const char *,const char *) = 0;
    virtual void writeSectionRefItem(const char *,const char *,const char *) = 0;
    virtual void writeSectionRefAnchor(const char *,const char *,const char *) = 0;
    virtual void lineBreak() = 0;
    virtual void addIndexItem(const char *s1,const char *s2) = 0;
    virtual void startIndent() = 0;
    virtual void endIndent() = 0;
    virtual void writeSynopsis() = 0;
    virtual void startClassDiagram() = 0;
    virtual void endClassDiagram(ClassDiagram &,const char *,const char *) = 0;
    virtual void startColorFont(uchar r,uchar g,uchar b) = 0;
    virtual void endColorFont() = 0;
    virtual void startPageRef() = 0;
    virtual void endPageRef(const char *,const char *) = 0;
    virtual void startQuickIndexItem(const char *s,const char *l) = 0;
    virtual void endQuickIndexItem() = 0;
    virtual void writeFormula(const char *,const char *) = 0;
    virtual void writeNonBreakableSpace() = 0;
    virtual void startImage(const char *,const char *,bool) = 0;
    virtual void endImage(bool) = 0;
    
    virtual void startDescTable() = 0;
    virtual void endDescTable() = 0;
    virtual void startDescTableTitle() = 0;
    virtual void endDescTableTitle() = 0;
    virtual void startDescTableData() = 0;
    virtual void endDescTableData() = 0;

    virtual void startDotGraph() = 0;
    virtual void endDotGraph(DotClassGraph &g) = 0;
    virtual void startInclDepGraph() = 0;
    virtual void endInclDepGraph(DotInclDepGraph &g) = 0;
    virtual void writeGraphicalHierarchy(DotGfxHierarchyTable &g) = 0;

    virtual void startTextBlock(bool) = 0;
    virtual void endTextBlock() = 0;
    virtual void lastIndexPage() = 0;

    virtual void startMemberDocPrefixItem() = 0;
    virtual void endMemberDocPrefixItem() = 0;
    virtual void startMemberDocName() = 0;
    virtual void endMemberDocName() = 0;
    virtual void startParameter(bool) = 0;
    virtual void endParameter(bool) = 0;

    virtual void startFontClass(const char *) = 0;
    virtual void endFontClass() = 0;

    
    void clear() { b.close(); a.resize(0); b.setBuffer(a); 
                   b.open(IO_WriteOnly); t.setDevice(&b); }
    void startPlainFile(const char *name);
    void endPlainFile();
    QCString getContents() const;
    bool isEnabled() const { return active; }
    void pushGeneratorState();
    void popGeneratorState();
  protected:
    QTextStream fs;
    QByteArray a;
    QBuffer b;
    QTextStream t;
    QFile *file;
    QCString dir;
    bool active;

  private:
    OutputGenerator(const OutputGenerator &o);
    OutputGenerator &operator=(const OutputGenerator &o);
    QStack<bool> *genStack;
};

#endif