Root/
Source at commit 1322 created 12 years 8 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: $␊ |
4 | *␊ |
5 | *␊ |
6 | * Copyright (C) 1997-2011 by Dimitri van Heesch.␊ |
7 | *␊ |
8 | * Permission to use, copy, modify, and distribute this software and its␊ |
9 | * documentation under the terms of the GNU General Public License is hereby ␊ |
10 | * granted. No representations are made about the suitability of this software ␊ |
11 | * for any purpose. It is provided "as is" without express or implied warranty.␊ |
12 | * See the GNU General Public License for more details.␊ |
13 | *␊ |
14 | * Documents produced by Doxygen are derivative works derived from the␊ |
15 | * input used in their production; they are not affected by this license.␊ |
16 | *␊ |
17 | */␊ |
18 | ␊ |
19 | #ifndef _PRINTDOCVISITOR_H␊ |
20 | #define _PRINTDOCVISITOR_H␊ |
21 | ␊ |
22 | #include "docvisitor.h"␊ |
23 | ␊ |
24 | /*! Concrete visitor implementation for pretty printing */␊ |
25 | class PrintDocVisitor : public DocVisitor␊ |
26 | {␊ |
27 | public:␊ |
28 | PrintDocVisitor() : DocVisitor(DocVisitor_Other), m_indent(0), ␊ |
29 | m_needsEnter(FALSE), m_insidePre(FALSE) {}␊ |
30 | ␊ |
31 | //--------------------------------------␊ |
32 | ␊ |
33 | void visit(DocWord *w)␊ |
34 | {␊ |
35 | indent_leaf();␊ |
36 | printf("%s",w->word().data());␊ |
37 | }␊ |
38 | void visit(DocLinkedWord *w)␊ |
39 | {␊ |
40 | indent_leaf();␊ |
41 | printf("%s",w->word().data());␊ |
42 | }␊ |
43 | void visit(DocWhiteSpace *w)␊ |
44 | {␊ |
45 | indent_leaf();␊ |
46 | if (m_insidePre)␊ |
47 | {␊ |
48 | printf("%s",w->chars().data());␊ |
49 | }␊ |
50 | else␊ |
51 | {␊ |
52 | printf(" ");␊ |
53 | }␊ |
54 | }␊ |
55 | void visit(DocSymbol *s)␊ |
56 | {␊ |
57 | indent_leaf();␊ |
58 | switch(s->symbol())␊ |
59 | {␊ |
60 | ␉case DocSymbol::BSlash: printf("\\"); break;␊ |
61 | ␉case DocSymbol::At: printf("@"); break;␊ |
62 | ␉case DocSymbol::Less: printf("<"); break;␊ |
63 | ␉case DocSymbol::Greater: printf(">"); break;␊ |
64 | ␉case DocSymbol::Amp: printf("&"); break;␊ |
65 | ␉case DocSymbol::Dollar: printf("$"); break;␊ |
66 | ␉case DocSymbol::Hash: printf("#"); break;␊ |
67 | ␉case DocSymbol::Percent: printf("%%"); break;␊ |
68 | ␉case DocSymbol::Copy: printf("©"); break;␊ |
69 | ␉case DocSymbol::Apos: printf("'"); break;␊ |
70 | ␉case DocSymbol::Quot: printf("\""); break;␊ |
71 | case DocSymbol::Lsquo: printf("‘"); break;␊ |
72 | case DocSymbol::Rsquo: printf("’"); break;␊ |
73 | case DocSymbol::Ldquo: printf("“"); break;␊ |
74 | case DocSymbol::Rdquo: printf("”"); break;␊ |
75 | case DocSymbol::Ndash: printf("–"); break;␊ |
76 | case DocSymbol::Mdash: printf("—"); break;␊ |
77 | ␉case DocSymbol::Uml: printf("&%cuml;",s->letter()); break;␊ |
78 | ␉case DocSymbol::Acute: printf("&%cacute;",s->letter()); break;␊ |
79 | ␉case DocSymbol::Grave: printf("&%cgrave;",s->letter()); break;␊ |
80 | ␉case DocSymbol::Circ: printf("&%ccirc;",s->letter()); break;␊ |
81 | ␉case DocSymbol::Tilde: printf("&%ctilde;",s->letter()); break;␊ |
82 | ␉case DocSymbol::Szlig: printf("ß"); break;␊ |
83 | ␉case DocSymbol::Cedil: printf("&%ccedul;",s->letter()); break;␊ |
84 | ␉case DocSymbol::Ring: printf("&%cring;",s->letter()); break;␊ |
85 | ␉case DocSymbol::Nbsp: printf(" "); break;␊ |
86 | ␉case DocSymbol::Aelig: printf("æ"); break;␊ |
87 | ␉case DocSymbol::AElig: printf("Æ"); break;␊ |
88 | ␉default:␊ |
89 | ␉ printf("Error: unknown symbol found\n");␊ |
90 | }␊ |
91 | }␊ |
92 | void visit(DocURL *u)␊ |
93 | {␊ |
94 | indent_leaf();␊ |
95 | printf("%s",u->url().data());␊ |
96 | }␊ |
97 | void visit(DocLineBreak *)␊ |
98 | {␊ |
99 | indent_leaf();␊ |
100 | printf("<br/>");␊ |
101 | }␊ |
102 | void visit(DocHorRuler *)␊ |
103 | {␊ |
104 | indent_leaf();␊ |
105 | printf("<hr>");␊ |
106 | }␊ |
107 | void visit(DocStyleChange *s)␊ |
108 | {␊ |
109 | indent_leaf();␊ |
110 | switch (s->style())␊ |
111 | {␊ |
112 | case DocStyleChange::Bold:␊ |
113 | if (s->enable()) printf("<bold>"); else printf("</bold>");␊ |
114 | break;␊ |
115 | case DocStyleChange::Italic:␊ |
116 | if (s->enable()) printf("<italic>"); else printf("</italic>");␊ |
117 | break;␊ |
118 | case DocStyleChange::Code:␊ |
119 | if (s->enable()) printf("<code>"); else printf("</code>");␊ |
120 | break;␊ |
121 | case DocStyleChange::Subscript:␊ |
122 | if (s->enable()) printf("<sub>"); else printf("</sub>");␊ |
123 | break;␊ |
124 | case DocStyleChange::Superscript:␊ |
125 | if (s->enable()) printf("<sup>"); else printf("</sup>");␊ |
126 | break;␊ |
127 | case DocStyleChange::Center:␊ |
128 | if (s->enable()) printf("<center>"); else printf("</center>");␊ |
129 | break;␊ |
130 | case DocStyleChange::Small:␊ |
131 | if (s->enable()) printf("<small>"); else printf("</small>");␊ |
132 | break;␊ |
133 | case DocStyleChange::Preformatted:␊ |
134 | if (s->enable()) printf("<pre>"); else printf("</pre>");␊ |
135 | break;␊ |
136 | case DocStyleChange::Div:␊ |
137 | if (s->enable()) printf("<div>"); else printf("</div>");␊ |
138 | break;␊ |
139 | case DocStyleChange::Span:␊ |
140 | if (s->enable()) printf("<span>"); else printf("</span>");␊ |
141 | break;␊ |
142 | }␊ |
143 | }␊ |
144 | void visit(DocVerbatim *s)␊ |
145 | {␊ |
146 | indent_leaf();␊ |
147 | switch(s->type())␊ |
148 | {␊ |
149 | case DocVerbatim::Code: printf("<code>"); break;␊ |
150 | case DocVerbatim::Verbatim: printf("<verbatim>"); break;␊ |
151 | case DocVerbatim::HtmlOnly: printf("<htmlonly>"); break;␊ |
152 | case DocVerbatim::ManOnly: printf("<manonly>"); break;␊ |
153 | case DocVerbatim::LatexOnly: printf("<latexonly>"); break;␊ |
154 | case DocVerbatim::XmlOnly: printf("<xmlonly>"); break;␊ |
155 | case DocVerbatim::Dot: printf("<dot>"); break;␊ |
156 | case DocVerbatim::Msc: printf("<msc>"); break;␊ |
157 | }␊ |
158 | printf("%s",s->text().data());␊ |
159 | switch(s->type())␊ |
160 | {␊ |
161 | case DocVerbatim::Code: printf("</code>"); break;␊ |
162 | case DocVerbatim::Verbatim: printf("</verbatim>"); break;␊ |
163 | case DocVerbatim::HtmlOnly: printf("</htmlonly>"); break;␊ |
164 | case DocVerbatim::ManOnly: printf("</manonly>"); break;␊ |
165 | case DocVerbatim::LatexOnly: printf("</latexonly>"); break;␊ |
166 | case DocVerbatim::XmlOnly: printf("</xmlonly>"); break;␊ |
167 | case DocVerbatim::Dot: printf("</dot>"); break;␊ |
168 | case DocVerbatim::Msc: printf("</msc>"); break;␊ |
169 | }␊ |
170 | }␊ |
171 | void visit(DocAnchor *a)␊ |
172 | {␊ |
173 | indent_leaf();␊ |
174 | printf("<anchor name=\"%s\"/>",a->anchor().data());␊ |
175 | }␊ |
176 | void visit(DocInclude *inc)␊ |
177 | {␊ |
178 | indent_leaf();␊ |
179 | printf("<include file=\"%s\" type=\"",inc->file().data());␊ |
180 | switch(inc->type())␊ |
181 | {␊ |
182 | case DocInclude::Include: printf("include"); break;␊ |
183 | case DocInclude::IncWithLines: printf("incwithlines"); break;␊ |
184 | case DocInclude::DontInclude: printf("dontinclude"); break;␊ |
185 | case DocInclude::HtmlInclude: printf("htmlinclude"); break;␊ |
186 | case DocInclude::VerbInclude: printf("verbinclude"); break;␊ |
187 | }␊ |
188 | printf("\"/>");␊ |
189 | }␊ |
190 | void visit(DocIncOperator *op)␊ |
191 | {␊ |
192 | indent_leaf();␊ |
193 | printf("<incoperator pattern=\"%s\" type=\"",op->pattern().data());␊ |
194 | switch(op->type())␊ |
195 | {␊ |
196 | case DocIncOperator::Line: printf("line"); break;␊ |
197 | case DocIncOperator::Skip: printf("skip"); break;␊ |
198 | case DocIncOperator::SkipLine: printf("skipline"); break;␊ |
199 | case DocIncOperator::Until: printf("until"); break;␊ |
200 | }␊ |
201 | printf("\"/>");␊ |
202 | }␊ |
203 | void visit(DocFormula *f)␊ |
204 | {␊ |
205 | indent_leaf();␊ |
206 | printf("<formula name=%s test=%s/>",f->name().data(),f->text().data());␊ |
207 | }␊ |
208 | void visit(DocIndexEntry *i)␊ |
209 | {␊ |
210 | indent_leaf();␊ |
211 | printf("<indexentry>%s</indexentry\n",i->entry().data());␊ |
212 | }␊ |
213 | void visit(DocSimpleSectSep *)␊ |
214 | {␊ |
215 | indent_leaf();␊ |
216 | printf("<simplesectsep/>");␊ |
217 | }␊ |
218 | ␊ |
219 | //--------------------------------------␊ |
220 | ␊ |
221 | void visitPre(DocAutoList *l)␊ |
222 | {␊ |
223 | indent_pre();␊ |
224 | if (l->isEnumList())␊ |
225 | {␊ |
226 | printf("<ol>\n");␊ |
227 | }␊ |
228 | else␊ |
229 | {␊ |
230 | printf("<ul>\n");␊ |
231 | }␊ |
232 | }␊ |
233 | void visitPost(DocAutoList *l)␊ |
234 | {␊ |
235 | indent_post();␊ |
236 | if (l->isEnumList())␊ |
237 | {␊ |
238 | printf("</ol>\n");␊ |
239 | }␊ |
240 | else␊ |
241 | {␊ |
242 | printf("</ul>\n");␊ |
243 | }␊ |
244 | }␊ |
245 | void visitPre(DocAutoListItem *)␊ |
246 | {␊ |
247 | indent_pre();␊ |
248 | printf("<li>\n");␊ |
249 | }␊ |
250 | void visitPost(DocAutoListItem *) ␊ |
251 | {␊ |
252 | indent_post();␊ |
253 | printf("</li>\n");␊ |
254 | }␊ |
255 | void visitPre(DocPara *) ␊ |
256 | {␊ |
257 | indent_pre();␊ |
258 | printf("<para>\n");␊ |
259 | }␊ |
260 | void visitPost(DocPara *)␊ |
261 | {␊ |
262 | indent_post();␊ |
263 | printf("</para>\n");␊ |
264 | }␊ |
265 | void visitPre(DocRoot *)␊ |
266 | {␊ |
267 | indent_pre();␊ |
268 | printf("<root>\n");␊ |
269 | }␊ |
270 | void visitPost(DocRoot *)␊ |
271 | {␊ |
272 | indent_post();␊ |
273 | printf("</root>\n");␊ |
274 | }␊ |
275 | void visitPre(DocSimpleSect *s)␊ |
276 | {␊ |
277 | indent_pre();␊ |
278 | printf("<simplesect type=");␊ |
279 | switch(s->type())␊ |
280 | {␊ |
281 | ␉case DocSimpleSect::See: printf("see"); break;␊ |
282 | ␉case DocSimpleSect::Return: printf("return"); break;␊ |
283 | ␉case DocSimpleSect::Author: printf("author"); break;␊ |
284 | ␉case DocSimpleSect::Authors: printf("authors"); break;␊ |
285 | ␉case DocSimpleSect::Version: printf("version"); break;␊ |
286 | ␉case DocSimpleSect::Since: printf("since"); break;␊ |
287 | ␉case DocSimpleSect::Date: printf("date"); break;␊ |
288 | ␉case DocSimpleSect::Note: printf("note"); break;␊ |
289 | ␉case DocSimpleSect::Warning: printf("warning"); break;␊ |
290 | ␉case DocSimpleSect::Pre: printf("pre"); break;␊ |
291 | ␉case DocSimpleSect::Post: printf("post"); break;␊ |
292 | ␉case DocSimpleSect::Invar: printf("invar"); break;␊ |
293 | ␉case DocSimpleSect::Remark: printf("remark"); break;␊ |
294 | ␉case DocSimpleSect::Attention: printf("attention"); break;␊ |
295 | ␉case DocSimpleSect::User: printf("user"); break;␊ |
296 | ␉case DocSimpleSect::Rcs: printf("rcs"); break;␊ |
297 | ␉case DocSimpleSect::Unknown: printf("unknown"); break;␊ |
298 | }␊ |
299 | printf(">\n");␊ |
300 | }␊ |
301 | void visitPost(DocSimpleSect *)␊ |
302 | {␊ |
303 | indent_post();␊ |
304 | printf("</simplesect>\n");␊ |
305 | }␊ |
306 | void visitPre(DocTitle *)␊ |
307 | {␊ |
308 | indent_pre();␊ |
309 | printf("<title>\n");␊ |
310 | }␊ |
311 | void visitPost(DocTitle *)␊ |
312 | {␊ |
313 | indent_post();␊ |
314 | printf("</title>\n");␊ |
315 | }␊ |
316 | void visitPre(DocSimpleList *)␊ |
317 | {␊ |
318 | indent_pre();␊ |
319 | printf("<ul>\n");␊ |
320 | }␊ |
321 | void visitPost(DocSimpleList *)␊ |
322 | {␊ |
323 | indent_post();␊ |
324 | printf("</ul>\n");␊ |
325 | }␊ |
326 | void visitPre(DocSimpleListItem *)␊ |
327 | {␊ |
328 | indent_pre();␊ |
329 | printf("<li>\n");␊ |
330 | }␊ |
331 | void visitPost(DocSimpleListItem *) ␊ |
332 | {␊ |
333 | indent_post();␊ |
334 | printf("</li>\n");␊ |
335 | }␊ |
336 | void visitPre(DocSection *s)␊ |
337 | {␊ |
338 | indent_pre();␊ |
339 | printf("<sect%d>\n",s->level());␊ |
340 | }␊ |
341 | void visitPost(DocSection *s) ␊ |
342 | {␊ |
343 | indent_post();␊ |
344 | printf("</sect%d>\n",s->level());␊ |
345 | }␊ |
346 | void visitPre(DocHtmlList *s)␊ |
347 | {␊ |
348 | indent_pre();␊ |
349 | if (s->type()==DocHtmlList::Ordered) printf("<ol>\n"); else printf("<ul>\n");␊ |
350 | }␊ |
351 | void visitPost(DocHtmlList *s) ␊ |
352 | {␊ |
353 | indent_post();␊ |
354 | if (s->type()==DocHtmlList::Ordered) printf("</ol>\n"); else printf("</ul>\n");␊ |
355 | }␊ |
356 | void visitPre(DocHtmlListItem *)␊ |
357 | {␊ |
358 | indent_pre();␊ |
359 | printf("<li>\n");␊ |
360 | }␊ |
361 | void visitPost(DocHtmlListItem *) ␊ |
362 | {␊ |
363 | indent_post();␊ |
364 | printf("</li>\n");␊ |
365 | }␊ |
366 | //void visitPre(DocHtmlPre *)␊ |
367 | //{␊ |
368 | // indent_pre();␊ |
369 | // printf("<pre>\n");␊ |
370 | // m_insidePre=TRUE;␊ |
371 | //}␊ |
372 | //void visitPost(DocHtmlPre *) ␊ |
373 | //{␊ |
374 | // m_insidePre=FALSE;␊ |
375 | // indent_post();␊ |
376 | // printf("</pre>\n");␊ |
377 | //}␊ |
378 | void visitPre(DocHtmlDescList *)␊ |
379 | {␊ |
380 | indent_pre();␊ |
381 | printf("<dl>\n");␊ |
382 | }␊ |
383 | void visitPost(DocHtmlDescList *) ␊ |
384 | {␊ |
385 | indent_post();␊ |
386 | printf("</dl>\n");␊ |
387 | }␊ |
388 | void visitPre(DocHtmlDescTitle *)␊ |
389 | {␊ |
390 | indent_pre();␊ |
391 | printf("<dt>\n");␊ |
392 | }␊ |
393 | void visitPost(DocHtmlDescTitle *) ␊ |
394 | {␊ |
395 | indent_post();␊ |
396 | printf("</dt>\n");␊ |
397 | }␊ |
398 | void visitPre(DocHtmlDescData *)␊ |
399 | {␊ |
400 | indent_pre();␊ |
401 | printf("<dd>\n");␊ |
402 | }␊ |
403 | void visitPost(DocHtmlDescData *) ␊ |
404 | {␊ |
405 | indent_post();␊ |
406 | printf("</dd>\n");␊ |
407 | }␊ |
408 | void visitPre(DocHtmlTable *t)␊ |
409 | {␊ |
410 | indent_pre();␊ |
411 | printf("<table rows=\"%d\" cols=\"%d\">\n",␊ |
412 | t->numRows(),t->numCols());␊ |
413 | }␊ |
414 | void visitPost(DocHtmlTable *) ␊ |
415 | {␊ |
416 | indent_post();␊ |
417 | printf("</table>\n");␊ |
418 | }␊ |
419 | void visitPre(DocHtmlRow *)␊ |
420 | {␊ |
421 | indent_pre();␊ |
422 | printf("<tr>\n");␊ |
423 | }␊ |
424 | void visitPost(DocHtmlRow *) ␊ |
425 | {␊ |
426 | indent_post();␊ |
427 | printf("</tr>\n");␊ |
428 | }␊ |
429 | void visitPre(DocHtmlCell *c)␊ |
430 | {␊ |
431 | indent_pre();␊ |
432 | printf("<t%c>\n",c->isHeading()?'h':'d');␊ |
433 | }␊ |
434 | void visitPost(DocHtmlCell *c) ␊ |
435 | {␊ |
436 | indent_post();␊ |
437 | printf("</t%c>\n",c->isHeading()?'h':'d');␊ |
438 | }␊ |
439 | void visitPre(DocHtmlCaption *)␊ |
440 | {␊ |
441 | indent_pre();␊ |
442 | printf("<caption>\n");␊ |
443 | }␊ |
444 | void visitPost(DocHtmlCaption *) ␊ |
445 | {␊ |
446 | indent_post();␊ |
447 | printf("</caption>\n");␊ |
448 | }␊ |
449 | void visitPre(DocInternal *)␊ |
450 | {␊ |
451 | indent_pre();␊ |
452 | printf("<internal>\n");␊ |
453 | }␊ |
454 | void visitPost(DocInternal *) ␊ |
455 | {␊ |
456 | indent_post();␊ |
457 | printf("</internal>\n");␊ |
458 | }␊ |
459 | void visitPre(DocHRef *href)␊ |
460 | {␊ |
461 | indent_pre();␊ |
462 | printf("<a url=\"%s\">\n",href->url().data());␊ |
463 | }␊ |
464 | void visitPost(DocHRef *) ␊ |
465 | {␊ |
466 | indent_post();␊ |
467 | printf("</a>\n");␊ |
468 | }␊ |
469 | void visitPre(DocHtmlHeader *header)␊ |
470 | {␊ |
471 | indent_pre();␊ |
472 | printf("<h%d>\n",header->level());␊ |
473 | }␊ |
474 | void visitPost(DocHtmlHeader *header) ␊ |
475 | {␊ |
476 | indent_post();␊ |
477 | printf("</h%d>\n",header->level());␊ |
478 | }␊ |
479 | void visitPre(DocImage *img)␊ |
480 | {␊ |
481 | indent_pre();␊ |
482 | printf("<image src=\"%s\" type=\"",img->name().data());␊ |
483 | switch(img->type())␊ |
484 | {␊ |
485 | case DocImage::Html: printf("html"); break;␊ |
486 | case DocImage::Latex: printf("latex"); break;␊ |
487 | case DocImage::Rtf: printf("rtf"); break;␊ |
488 | }␊ |
489 | printf("\" width=%s height=%s>\n",img->width().data(),img->height().data());␊ |
490 | }␊ |
491 | void visitPost(DocImage *) ␊ |
492 | {␊ |
493 | indent_post();␊ |
494 | printf("</image>\n");␊ |
495 | }␊ |
496 | void visitPre(DocDotFile *df)␊ |
497 | {␊ |
498 | indent_pre();␊ |
499 | printf("<dotfile src=\"%s\">\n",df->name().data());␊ |
500 | }␊ |
501 | void visitPost(DocDotFile *) ␊ |
502 | {␊ |
503 | indent_post();␊ |
504 | printf("</dotfile>\n");␊ |
505 | }␊ |
506 | void visitPre(DocMscFile *df)␊ |
507 | {␊ |
508 | indent_pre();␊ |
509 | printf("<mscfile src=\"%s\">\n",df->name().data());␊ |
510 | }␊ |
511 | void visitPost(DocMscFile *) ␊ |
512 | {␊ |
513 | indent_post();␊ |
514 | printf("</mscfile>\n");␊ |
515 | }␊ |
516 | void visitPre(DocLink *lnk)␊ |
517 | {␊ |
518 | indent_pre();␊ |
519 | printf("<link ref=\"%s\" file=\"%s\" anchor=\"%s\">\n",␊ |
520 | lnk->ref().data(),lnk->file().data(),lnk->anchor().data());␊ |
521 | }␊ |
522 | void visitPost(DocLink *) ␊ |
523 | {␊ |
524 | indent_post();␊ |
525 | printf("</link>\n");␊ |
526 | }␊ |
527 | void visitPre(DocRef *ref)␊ |
528 | {␊ |
529 | indent_pre();␊ |
530 | printf("<ref ref=\"%s\" file=\"%s\" "␊ |
531 | "anchor=\"%s\" targetTitle=\"%s\""␊ |
532 | " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\">\n",␊ |
533 | ref->ref().data(),ref->file().data(),ref->anchor().data(),␊ |
534 | ref->targetTitle().data(),ref->hasLinkText()?"yes":"no",␊ |
535 | ref->refToAnchor()?"yes":"no", ref->refToSection()?"yes":"no");␊ |
536 | }␊ |
537 | void visitPost(DocRef *) ␊ |
538 | {␊ |
539 | indent_post();␊ |
540 | printf("</ref>\n");␊ |
541 | }␊ |
542 | void visitPre(DocSecRefItem *ref)␊ |
543 | {␊ |
544 | indent_pre();␊ |
545 | printf("<secrefitem target=\"%s\">\n",ref->target().data());␊ |
546 | }␊ |
547 | void visitPost(DocSecRefItem *) ␊ |
548 | {␊ |
549 | indent_post();␊ |
550 | printf("</secrefitem>\n");␊ |
551 | }␊ |
552 | void visitPre(DocSecRefList *)␊ |
553 | {␊ |
554 | indent_pre();␊ |
555 | printf("<secreflist>\n");␊ |
556 | }␊ |
557 | void visitPost(DocSecRefList *) ␊ |
558 | {␊ |
559 | indent_post();␊ |
560 | printf("</secreflist>\n");␊ |
561 | }␊ |
562 | //void visitPre(DocLanguage *l)␊ |
563 | //{␊ |
564 | // indent_pre();␊ |
565 | // printf("<language id=%s>\n",l->id().data());␊ |
566 | //}␊ |
567 | //void visitPost(DocLanguage *) ␊ |
568 | //{␊ |
569 | // indent_post();␊ |
570 | // printf("</language>\n");␊ |
571 | //}␊ |
572 | void visitPre(DocParamList *pl)␊ |
573 | {␊ |
574 | indent_pre();␊ |
575 | //QStrListIterator sli(pl->parameters());␊ |
576 | QListIterator<DocNode> sli(pl->parameters());␊ |
577 | //const char *s;␊ |
578 | DocNode *param;␊ |
579 | printf("<parameters>");␊ |
580 | for (sli.toFirst();(param=sli.current());++sli)␊ |
581 | {␊ |
582 | printf("<param>");␊ |
583 | if (param->kind()==DocNode::Kind_Word)␊ |
584 | {␊ |
585 | visit((DocWord*)param); ␊ |
586 | }␊ |
587 | else if (param->kind()==DocNode::Kind_LinkedWord)␊ |
588 | {␊ |
589 | visit((DocLinkedWord*)param); ␊ |
590 | }␊ |
591 | printf("</param>");␊ |
592 | }␊ |
593 | printf("\n");␊ |
594 | }␊ |
595 | void visitPost(DocParamList *)␊ |
596 | {␊ |
597 | indent_post();␊ |
598 | printf("</parameters>\n");␊ |
599 | }␊ |
600 | void visitPre(DocParamSect *ps)␊ |
601 | {␊ |
602 | indent_pre();␊ |
603 | printf("<paramsect type=");␊ |
604 | switch (ps->type())␊ |
605 | {␊ |
606 | ␉case DocParamSect::Param: printf("param"); break;␊ |
607 | ␉case DocParamSect::RetVal: printf("retval"); break;␊ |
608 | ␉case DocParamSect::Exception: printf("exception"); break;␊ |
609 | ␉case DocParamSect::TemplateParam: printf("templateparam"); break;␊ |
610 | ␉case DocParamSect::Unknown: printf("unknown"); break;␊ |
611 | }␊ |
612 | printf(">\n");␊ |
613 | }␊ |
614 | void visitPost(DocParamSect *)␊ |
615 | {␊ |
616 | indent_post();␊ |
617 | printf("</paramsect>\n");␊ |
618 | }␊ |
619 | void visitPre(DocXRefItem *x)␊ |
620 | {␊ |
621 | indent_pre();␊ |
622 | printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\"/>\n",␊ |
623 | x->file().data(),x->anchor().data(),x->title().data());␊ |
624 | }␊ |
625 | void visitPost(DocXRefItem *)␊ |
626 | {␊ |
627 | indent_post();␊ |
628 | printf("<xrefitem/>\n");␊ |
629 | }␊ |
630 | void visitPre(DocInternalRef *r)␊ |
631 | {␊ |
632 | indent_pre();␊ |
633 | printf("<internalref file=%s anchor=%s>\n",r->file().data(),r->anchor().data());␊ |
634 | }␊ |
635 | void visitPost(DocInternalRef *)␊ |
636 | {␊ |
637 | indent_post();␊ |
638 | printf("</internalref>\n");␊ |
639 | }␊ |
640 | void visitPre(DocCopy *c)␊ |
641 | {␊ |
642 | indent_pre();␊ |
643 | printf("<copy link=\"%s\">\n",c->link().data());␊ |
644 | }␊ |
645 | void visitPost(DocCopy *)␊ |
646 | {␊ |
647 | indent_post();␊ |
648 | printf("</copy>\n");␊ |
649 | }␊ |
650 | void visitPre(DocText *)␊ |
651 | {␊ |
652 | indent_pre();␊ |
653 | printf("<text>\n");␊ |
654 | }␊ |
655 | void visitPost(DocText *)␊ |
656 | {␊ |
657 | indent_post();␊ |
658 | printf("</text>\n");␊ |
659 | }␊ |
660 | ␊ |
661 | private:␊ |
662 | // helper functions␊ |
663 | void indent() ␊ |
664 | { ␊ |
665 | if (m_needsEnter) printf("\n");␊ |
666 | for (int i=0;i<m_indent;i++) printf("."); ␊ |
667 | m_needsEnter=FALSE;␊ |
668 | } ␊ |
669 | void indent_leaf()␊ |
670 | {␊ |
671 | if (!m_needsEnter) indent();␊ |
672 | m_needsEnter=TRUE;␊ |
673 | }␊ |
674 | void indent_pre()␊ |
675 | {␊ |
676 | indent();␊ |
677 | m_indent++;␊ |
678 | }␊ |
679 | void indent_post()␊ |
680 | {␊ |
681 | m_indent--;␊ |
682 | indent();␊ |
683 | }␊ |
684 | ␊ |
685 | // member variables␊ |
686 | int m_indent;␊ |
687 | bool m_needsEnter;␊ |
688 | bool m_insidePre;␊ |
689 | };␊ |
690 | ␊ |
691 | #endif␊ |
692 |