|
1 /****************************************************************************** |
|
2 * |
|
3 * |
|
4 * |
|
5 * Copyright (C) 1997-2008 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 HTMLGEN_H |
|
19 #define HTMLGEN_H |
|
20 |
|
21 #include "qtbc.h" |
|
22 #include "outputgen.h" |
|
23 |
|
24 #define PREFRAG_START "<div class=\"fragment\"><pre class=\"fragment\">" |
|
25 #define PREFRAG_END "</pre></div>" |
|
26 |
|
27 class QFile; |
|
28 |
|
29 class HtmlGenerator : public OutputGenerator |
|
30 { |
|
31 public: |
|
32 HtmlGenerator(); |
|
33 virtual ~HtmlGenerator(); |
|
34 static void init(); |
|
35 static void writeStyleSheetFile(QFile &f); |
|
36 static void writeHeaderFile(QFile &f); |
|
37 static void writeFooterFile(QFile &f); |
|
38 static void writeSearchPage(); |
|
39 |
|
40 void enable() |
|
41 { if (genStack->top()) active=*genStack->top(); else active=TRUE; } |
|
42 void disable() { active=FALSE; } |
|
43 void enableIf(OutputType o) { if (o==Html) active=TRUE; } |
|
44 void disableIf(OutputType o) { if (o==Html) active=FALSE; } |
|
45 void disableIfNot(OutputType o) { if (o!=Html) active=FALSE; } |
|
46 bool isEnabled(OutputType o) { return (o==Html && active); } |
|
47 OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; } |
|
48 |
|
49 void printDoc(DocNode *,const char *); |
|
50 |
|
51 void startFile(const char *name,const char *manName,const char *title); |
|
52 void writeFooter(); |
|
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 *) { startTitle(); } |
|
63 void endTitleHead(const char *,const char *) { endTitle(); } |
|
64 void startTitle() { t << "<h1>"; } |
|
65 void endTitle() { t << "</h1>"; } |
|
66 |
|
67 void startParagraph(); |
|
68 void endParagraph(); |
|
69 void writeString(const char *text); |
|
70 void startIndexListItem(); |
|
71 void endIndexListItem(); |
|
72 void startIndexList(); |
|
73 void endIndexList(); |
|
74 void startIndexKey(); |
|
75 void endIndexKey(); |
|
76 void startIndexValue(bool); |
|
77 void endIndexValue(const char *,bool); |
|
78 void startItemList() { t << "<ul>" << endl; } |
|
79 void endItemList() { t << "</ul>" << endl; } |
|
80 void startIndexItem(const char *ref,const char *file); |
|
81 void endIndexItem(const char *ref,const char *file); |
|
82 void docify(const char *text); |
|
83 void codify(const char *text); |
|
84 void writeObjectLink(const char *ref,const char *file, |
|
85 const char *anchor,const char *name); |
|
86 void writeCodeLink(const char *ref,const char *file, |
|
87 const char *anchor,const char *name, |
|
88 const char *tooltip); |
|
89 void startTextLink(const char *file,const char *anchor); |
|
90 void endTextLink(); |
|
91 void startHtmlLink(const char *url); |
|
92 void endHtmlLink(); |
|
93 void startTypewriter() { t << "<code>"; } |
|
94 void endTypewriter() { t << "</code>"; } |
|
95 void startGroupHeader(); |
|
96 void endGroupHeader(); |
|
97 void startItemListItem() { t << "<li>"; } |
|
98 void endItemListItem() { t << "</li>\n"; } |
|
99 |
|
100 void startMemberSections(); |
|
101 void endMemberSections(); |
|
102 void startMemberHeader(); |
|
103 void endMemberHeader(); |
|
104 void startMemberSubtitle(); |
|
105 void endMemberSubtitle(); |
|
106 void startMemberDocList(); |
|
107 void endMemberDocList(); |
|
108 void startMemberList(); |
|
109 void endMemberList(); |
|
110 void startAnonTypeScope(int) {} |
|
111 void endAnonTypeScope(int) {} |
|
112 void startMemberItem(int); |
|
113 void endMemberItem(); |
|
114 void startMemberTemplateParams(); |
|
115 void endMemberTemplateParams(); |
|
116 |
|
117 void startMemberGroupHeader(bool); |
|
118 void endMemberGroupHeader(); |
|
119 void startMemberGroupDocs(); |
|
120 void endMemberGroupDocs(); |
|
121 void startMemberGroup(); |
|
122 void endMemberGroup(bool); |
|
123 |
|
124 void insertMemberAlign(bool); |
|
125 void startMemberDescription(); |
|
126 void endMemberDescription(); |
|
127 |
|
128 void writeRuler() { t << "<hr/>"; } |
|
129 void writeAnchor(const char *,const char *name) |
|
130 { t << "<a name=\"" << name <<"\"></a>"; } |
|
131 void startCodeFragment() { t << PREFRAG_START; } |
|
132 void endCodeFragment() { t << PREFRAG_END; } |
|
133 void writeLineNumber(const char *,const char *,const char *,int); |
|
134 void startCodeLine() { col=0; } |
|
135 void endCodeLine() { codify("\n"); } |
|
136 void startEmphasis() { t << "<em>"; } |
|
137 void endEmphasis() { t << "</em>"; } |
|
138 void startBold() { t << "<b>"; } |
|
139 void endBold() { t << "</b>"; } |
|
140 void startDescription() { t << endl << "<dl>" << endl; } |
|
141 void endDescription() { t << endl << "</dl>\n" << endl; } |
|
142 void startDescItem() { t << "<dt>"; } |
|
143 void endDescItem() { t << "</dt>"; } |
|
144 void startDescForItem() { t << "<dd>"; } |
|
145 void endDescForItem() { t << "</dd>\n"; } |
|
146 void lineBreak(const char *style); |
|
147 void writeChar(char c); |
|
148 void startMemberDoc(const char *,const char *,const char *,const char *); |
|
149 void endMemberDoc(bool); |
|
150 void startDoxyAnchor(const char *fName,const char *manName, |
|
151 const char *anchor,const char *name, |
|
152 const char *args); |
|
153 void endDoxyAnchor(const char *fName,const char *anchor); |
|
154 void startCodeAnchor(const char *label) { t << "<a name=\"" << label << "\"></a>"; } |
|
155 void endCodeAnchor() { } |
|
156 void writeLatexSpacing() {} |
|
157 void writeStartAnnoItem(const char *type,const char *file, |
|
158 const char *path,const char *name); |
|
159 void writeEndAnnoItem(const char *) { t << endl; } |
|
160 void startSubsection() { t << "<h2>"; } |
|
161 void endSubsection() { t << "</h2>" << endl; } |
|
162 void startSubsubsection() { t << "<h3>"; } |
|
163 void endSubsubsection() { t << "</h3>" << endl; } |
|
164 void startCenter() { t << "<center>" << endl; } |
|
165 void endCenter() { t << "</center>" << endl; } |
|
166 void startSmall() { t << "<small>" << endl; } |
|
167 void endSmall() { t << "</small>" << endl; } |
|
168 //void startDescList(SectionTypes) { t << "<dl compact><dt><b>" << endl; } |
|
169 //void endDescList() { t << "</dl>"; } |
|
170 void startSimpleSect(SectionTypes,const char *,const char *,const char *); |
|
171 void endSimpleSect(); |
|
172 void startParamList(ParamListTypes,const char *); |
|
173 void endParamList(); |
|
174 //void writeDescItem() { t << "<dd>" << endl; } |
|
175 void startSection(const char *,const char *,SectionInfo::SectionType); |
|
176 void endSection(const char *,SectionInfo::SectionType); |
|
177 void addIndexItem(const char *,const char *); |
|
178 void startIndent(); |
|
179 void endIndent(); |
|
180 void writeSynopsis() {} |
|
181 void startClassDiagram(); |
|
182 void endClassDiagram(const ClassDiagram &,const char *,const char *); |
|
183 void startPageRef() {} |
|
184 void endPageRef(const char *,const char *) {} |
|
185 void startQuickIndices(); |
|
186 void endQuickIndices(); |
|
187 void writeQuickLinks(bool compact,HighlightedItem hli); |
|
188 void startContents(); |
|
189 void endContents(); |
|
190 void writeNonBreakableSpace(int); |
|
191 |
|
192 void startDescTable() |
|
193 { t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">" << endl; } |
|
194 void endDescTable() |
|
195 { t << "</table>" << endl; } |
|
196 void startDescTableTitle() |
|
197 { t << "<tr><td valign=\"top\"><em>"; } |
|
198 void endDescTableTitle() |
|
199 { t << "</em> </td>"; } |
|
200 void startDescTableData() |
|
201 { t << "<td>" << endl; } |
|
202 void endDescTableData() |
|
203 { t << "</td></tr>" << endl; } |
|
204 |
|
205 void startDotGraph(); |
|
206 void endDotGraph(const DotClassGraph &g); |
|
207 void startInclDepGraph(); |
|
208 void endInclDepGraph(const DotInclDepGraph &g); |
|
209 void startGroupCollaboration(); |
|
210 void endGroupCollaboration(const DotGroupCollaboration &g); |
|
211 void startCallGraph(); |
|
212 void endCallGraph(const DotCallGraph &g); |
|
213 void startDirDepGraph(); |
|
214 void endDirDepGraph(const DotDirDeps &g); |
|
215 void writeGraphicalHierarchy(const DotGfxHierarchyTable &g); |
|
216 |
|
217 void startTextBlock(bool) {} |
|
218 void endTextBlock(bool) {} |
|
219 void lastIndexPage() {} |
|
220 |
|
221 void startMemberDocPrefixItem(); |
|
222 void endMemberDocPrefixItem(); |
|
223 void startMemberDocName(bool); |
|
224 void endMemberDocName(); |
|
225 void startParameterType(bool first,const char *key); |
|
226 void endParameterType(); |
|
227 void startParameterName(bool); |
|
228 void endParameterName(bool last,bool emptyList,bool closeBracket); |
|
229 void startParameterList(bool); |
|
230 void endParameterList(); |
|
231 |
|
232 void startConstraintList(const char *); |
|
233 void startConstraintParam(); |
|
234 void endConstraintParam(); |
|
235 void startConstraintType(); |
|
236 void endConstraintType(); |
|
237 void startConstraintDocs(); |
|
238 void endConstraintDocs(); |
|
239 void endConstraintList(); |
|
240 |
|
241 void startFontClass(const char *s) { t << "<span class=\"" << s << "\">"; } |
|
242 void endFontClass() { t << "</span>"; } |
|
243 |
|
244 void writeCodeAnchor(const char *anchor) |
|
245 { t << "<a name=\"" << anchor << "\"></a>"; } |
|
246 void linkableSymbol(int,const char *,Definition *,Definition *) {} |
|
247 |
|
248 static void writeSearchFooter(QTextStream &t,const QCString &relPath); |
|
249 static void writeSearchData(const char *dir); |
|
250 static void generateSectionImages(); |
|
251 |
|
252 private: |
|
253 QCString lastTitle; |
|
254 QCString lastFile; |
|
255 QCString relPath; |
|
256 void docify(const char *text,bool inHtmlComment); |
|
257 |
|
258 HtmlGenerator &operator=(const HtmlGenerator &g); |
|
259 HtmlGenerator(const HtmlGenerator &g); |
|
260 |
|
261 int col; |
|
262 }; |
|
263 |
|
264 #endif |