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 | #include "mandocvisitor.h"␊ |
20 | #include "docparser.h"␊ |
21 | #include "language.h"␊ |
22 | #include "doxygen.h"␊ |
23 | #include "outputgen.h"␊ |
24 | #include "code.h"␊ |
25 | #include "dot.h"␊ |
26 | #include "util.h"␊ |
27 | #include "message.h"␊ |
28 | #include <qfileinfo.h> ␊ |
29 | #include "parserintf.h"␊ |
30 | ␊ |
31 | ManDocVisitor::ManDocVisitor(FTextStream &t,CodeOutputInterface &ci,␊ |
32 | const char *langExt) ␊ |
33 | : DocVisitor(DocVisitor_Man), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(TRUE),␊ |
34 | m_indent(0), m_langExt(langExt)␊ |
35 | {␊ |
36 | }␊ |
37 | ␊ |
38 | //--------------------------------------␊ |
39 | // visitor functions for leaf nodes␊ |
40 | //--------------------------------------␊ |
41 | ␊ |
42 | void ManDocVisitor::visit(DocWord *w)␊ |
43 | {␊ |
44 | if (m_hide) return;␊ |
45 | filter(w->word());␊ |
46 | m_firstCol=FALSE;␊ |
47 | }␊ |
48 | ␊ |
49 | void ManDocVisitor::visit(DocLinkedWord *w)␊ |
50 | {␊ |
51 | if (m_hide) return;␊ |
52 | m_t << "\\fB";␊ |
53 | filter(w->word());␊ |
54 | m_t << "\\fP";␊ |
55 | m_firstCol=FALSE;␊ |
56 | }␊ |
57 | ␊ |
58 | void ManDocVisitor::visit(DocWhiteSpace *w)␊ |
59 | {␊ |
60 | if (m_hide) return;␊ |
61 | if (m_insidePre)␊ |
62 | {␊ |
63 | m_t << w->chars();␊ |
64 | m_firstCol=w->chars().at(w->chars().length()-1)=='\n';␊ |
65 | }␊ |
66 | else␊ |
67 | {␊ |
68 | m_t << " ";␊ |
69 | m_firstCol=FALSE;␊ |
70 | }␊ |
71 | }␊ |
72 | ␊ |
73 | void ManDocVisitor::visit(DocSymbol *s)␊ |
74 | {␊ |
75 | if (m_hide) return;␊ |
76 | switch(s->symbol())␊ |
77 | {␊ |
78 | case DocSymbol::BSlash: m_t << "\\\\"; break;␊ |
79 | case DocSymbol::At: m_t << "@"; break;␊ |
80 | case DocSymbol::Less: m_t << "<"; break;␊ |
81 | case DocSymbol::Greater: m_t << ">"; break;␊ |
82 | case DocSymbol::Amp: m_t << "&"; break;␊ |
83 | case DocSymbol::Dollar: m_t << "$"; break;␊ |
84 | case DocSymbol::Hash: m_t << "#"; break;␊ |
85 | case DocSymbol::DoubleColon: m_t << "::"; break;␊ |
86 | case DocSymbol::Percent: m_t << "%"; break;␊ |
87 | case DocSymbol::Copy: m_t << "(C)"; break;␊ |
88 | case DocSymbol::Tm: m_t << "(TM)"; break;␊ |
89 | case DocSymbol::Reg: m_t << "(R)"; break;␊ |
90 | case DocSymbol::Apos: m_t << "'"; break;␊ |
91 | case DocSymbol::Quot: m_t << "\""; break;␊ |
92 | case DocSymbol::Lsquo: m_t << "`"; break;␊ |
93 | case DocSymbol::Rsquo: m_t << "'"; break;␊ |
94 | case DocSymbol::Ldquo: m_t << "``"; break;␊ |
95 | case DocSymbol::Rdquo: m_t << "''"; break;␊ |
96 | case DocSymbol::Ndash: m_t << "--"; break;␊ |
97 | case DocSymbol::Mdash: m_t << "---"; break;␊ |
98 | case DocSymbol::Uml: m_t << s->letter() << "\\*(4"; break;␊ |
99 | case DocSymbol::Acute: m_t << s->letter() << "\\*(`"; break;␊ |
100 | case DocSymbol::Grave: m_t << s->letter() << "\\*:"; break;␊ |
101 | case DocSymbol::Circ: m_t << s->letter() << "\\*^"; break;␊ |
102 | case DocSymbol::Slash: m_t << s->letter(); break; /* todo: implement this */␊ |
103 | case DocSymbol::Tilde: m_t << s->letter() << "\\*~"; break;␊ |
104 | case DocSymbol::Szlig: m_t << "s\\*:"; break;␊ |
105 | case DocSymbol::Cedil: m_t << s->letter() << "\\*,"; break;␊ |
106 | case DocSymbol::Ring: m_t << s->letter() << "\\*o"; break;␊ |
107 | case DocSymbol::Nbsp: m_t << " "; break;␊ |
108 | default:␊ |
109 | err("error: unknown symbol found\n");␊ |
110 | }␊ |
111 | m_firstCol=FALSE;␊ |
112 | }␊ |
113 | ␊ |
114 | void ManDocVisitor::visit(DocURL *u)␊ |
115 | {␊ |
116 | if (m_hide) return;␊ |
117 | m_t << u->url();␊ |
118 | m_firstCol=FALSE;␊ |
119 | }␊ |
120 | ␊ |
121 | void ManDocVisitor::visit(DocLineBreak *)␊ |
122 | {␊ |
123 | if (m_hide) return;␊ |
124 | m_t << endl << ".br" << endl;␊ |
125 | m_firstCol=TRUE;␊ |
126 | }␊ |
127 | ␊ |
128 | void ManDocVisitor::visit(DocHorRuler *)␊ |
129 | {␊ |
130 | if (m_hide) return;␊ |
131 | if (!m_firstCol) m_t << endl;␊ |
132 | m_t << ".PP" << endl;␊ |
133 | m_firstCol=TRUE;␊ |
134 | }␊ |
135 | ␊ |
136 | void ManDocVisitor::visit(DocStyleChange *s)␊ |
137 | {␊ |
138 | if (m_hide) return;␊ |
139 | switch (s->style())␊ |
140 | {␊ |
141 | case DocStyleChange::Bold:␊ |
142 | if (s->enable()) m_t << "\\fB"; else m_t << "\\fP";␊ |
143 | m_firstCol=FALSE;␊ |
144 | break;␊ |
145 | case DocStyleChange::Italic:␊ |
146 | if (s->enable()) m_t << "\\fI"; else m_t << "\\fP";␊ |
147 | m_firstCol=FALSE;␊ |
148 | break;␊ |
149 | case DocStyleChange::Code:␊ |
150 | if (s->enable()) m_t << "\\fC"; else m_t << "\\fP";␊ |
151 | m_firstCol=FALSE;␊ |
152 | break;␊ |
153 | case DocStyleChange::Subscript:␊ |
154 | if (s->enable()) m_t << "\\*<"; else m_t << "\\*> ";␊ |
155 | m_firstCol=FALSE;␊ |
156 | break;␊ |
157 | case DocStyleChange::Superscript:␊ |
158 | if (s->enable()) m_t << "\\*{"; else m_t << "\\*} ";␊ |
159 | m_firstCol=FALSE;␊ |
160 | break;␊ |
161 | case DocStyleChange::Center:␊ |
162 | /* not supported */␊ |
163 | break;␊ |
164 | case DocStyleChange::Small:␊ |
165 | /* not supported */␊ |
166 | break;␊ |
167 | case DocStyleChange::Preformatted:␊ |
168 | if (s->enable())␊ |
169 | {␊ |
170 | if (!m_firstCol) m_t << endl;␊ |
171 | m_t << ".PP" << endl;␊ |
172 | m_t << ".nf" << endl;␊ |
173 | m_insidePre=TRUE;␊ |
174 | }␊ |
175 | else␊ |
176 | {␊ |
177 | m_insidePre=FALSE;␊ |
178 | if (!m_firstCol) m_t << endl;␊ |
179 | m_t << ".fi" << endl;␊ |
180 | m_t << ".PP" << endl;␊ |
181 | m_firstCol=TRUE;␊ |
182 | }␊ |
183 | break;␊ |
184 | case DocStyleChange::Div: /* HTML only */ break;␊ |
185 | case DocStyleChange::Span: /* HTML only */ break;␊ |
186 | }␊ |
187 | }␊ |
188 | ␊ |
189 | void ManDocVisitor::visit(DocVerbatim *s)␊ |
190 | {␊ |
191 | if (m_hide) return;␊ |
192 | switch(s->type())␊ |
193 | {␊ |
194 | case DocVerbatim::Code: // fall though␊ |
195 | if (!m_firstCol) m_t << endl;␊ |
196 | m_t << ".PP" << endl;␊ |
197 | m_t << ".nf" << endl;␊ |
198 | Doxygen::parserManager->getParser(0/*TODO*/)␊ |
199 | ->parseCode(m_ci,s->context(),s->text(),␊ |
200 | s->isExample(),s->exampleFile());␊ |
201 | if (!m_firstCol) m_t << endl;␊ |
202 | m_t << ".fi" << endl;␊ |
203 | m_t << ".PP" << endl;␊ |
204 | m_firstCol=TRUE;␊ |
205 | break;␊ |
206 | case DocVerbatim::Verbatim: ␊ |
207 | if (!m_firstCol) m_t << endl;␊ |
208 | m_t << ".PP" << endl;␊ |
209 | m_t << ".nf" << endl;␊ |
210 | m_t << s->text();␊ |
211 | if (!m_firstCol) m_t << endl;␊ |
212 | m_t << ".fi" << endl;␊ |
213 | m_t << ".PP" << endl;␊ |
214 | m_firstCol=TRUE;␊ |
215 | break;␊ |
216 | case DocVerbatim::ManOnly: ␊ |
217 | m_t << s->text(); ␊ |
218 | break;␊ |
219 | case DocVerbatim::HtmlOnly: ␊ |
220 | case DocVerbatim::XmlOnly: ␊ |
221 | case DocVerbatim::LatexOnly: ␊ |
222 | case DocVerbatim::Dot: ␊ |
223 | case DocVerbatim::Msc: ␊ |
224 | /* nothing */ ␊ |
225 | break;␊ |
226 | }␊ |
227 | }␊ |
228 | ␊ |
229 | void ManDocVisitor::visit(DocAnchor *)␊ |
230 | {␊ |
231 | /* no support for anchors in man pages */␊ |
232 | }␊ |
233 | ␊ |
234 | void ManDocVisitor::visit(DocInclude *inc)␊ |
235 | {␊ |
236 | if (m_hide) return;␊ |
237 | switch(inc->type())␊ |
238 | {␊ |
239 | case DocInclude::IncWithLines:␊ |
240 | { ␊ |
241 | if (!m_firstCol) m_t << endl;␊ |
242 | m_t << ".PP" << endl;␊ |
243 | m_t << ".nf" << endl;␊ |
244 | QFileInfo cfi( inc->file() );␊ |
245 | FileDef fd( cfi.dirPath(), cfi.fileName() );␊ |
246 | Doxygen::parserManager->getParser(inc->extension())␊ |
247 | ->parseCode(m_ci,inc->context(),␊ |
248 | inc->text(),␊ |
249 | inc->isExample(),␊ |
250 | inc->exampleFile(), &fd);␊ |
251 | if (!m_firstCol) m_t << endl;␊ |
252 | m_t << ".fi" << endl;␊ |
253 | m_t << ".PP" << endl;␊ |
254 | m_firstCol=TRUE;␊ |
255 | }␊ |
256 | break;␊ |
257 | case DocInclude::Include: ␊ |
258 | if (!m_firstCol) m_t << endl;␊ |
259 | m_t << ".PP" << endl;␊ |
260 | m_t << ".nf" << endl;␊ |
261 | Doxygen::parserManager->getParser(inc->extension())␊ |
262 | ->parseCode(m_ci,inc->context(),␊ |
263 | inc->text(),inc->isExample(),␊ |
264 | inc->exampleFile());␊ |
265 | if (!m_firstCol) m_t << endl;␊ |
266 | m_t << ".fi" << endl;␊ |
267 | m_t << ".PP" << endl;␊ |
268 | m_firstCol=TRUE;␊ |
269 | break;␊ |
270 | case DocInclude::DontInclude: ␊ |
271 | break;␊ |
272 | case DocInclude::HtmlInclude: ␊ |
273 | break;␊ |
274 | case DocInclude::VerbInclude: ␊ |
275 | if (!m_firstCol) m_t << endl;␊ |
276 | m_t << ".PP" << endl;␊ |
277 | m_t << ".nf" << endl;␊ |
278 | m_t << inc->text();␊ |
279 | if (!m_firstCol) m_t << endl;␊ |
280 | m_t << ".fi" << endl;␊ |
281 | m_t << ".PP" << endl;␊ |
282 | m_firstCol=TRUE;␊ |
283 | break;␊ |
284 | }␊ |
285 | }␊ |
286 | ␊ |
287 | void ManDocVisitor::visit(DocIncOperator *op)␊ |
288 | {␊ |
289 | //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",␊ |
290 | // op->type(),op->isFirst(),op->isLast(),op->text().data());␊ |
291 | if (op->isFirst()) ␊ |
292 | {␊ |
293 | if (!m_hide)␊ |
294 | {␊ |
295 | if (!m_firstCol) m_t << endl;␊ |
296 | m_t << ".PP" << endl;␊ |
297 | m_t << ".nf" << endl;␊ |
298 | }␊ |
299 | pushEnabled();␊ |
300 | m_hide = TRUE;␊ |
301 | }␊ |
302 | if (op->type()!=DocIncOperator::Skip) ␊ |
303 | {␊ |
304 | popEnabled();␊ |
305 | if (!m_hide) ␊ |
306 | {␊ |
307 | Doxygen::parserManager->getParser(0/*TODO*/)␊ |
308 | ->parseCode(m_ci,op->context(),op->text(),␊ |
309 | op->isExample(),op->exampleFile());␊ |
310 | }␊ |
311 | pushEnabled();␊ |
312 | m_hide=TRUE;␊ |
313 | }␊ |
314 | if (op->isLast()) ␊ |
315 | {␊ |
316 | popEnabled();␊ |
317 | if (!m_hide)␊ |
318 | {␊ |
319 | if (!m_firstCol) m_t << endl;␊ |
320 | m_t << ".fi" << endl;␊ |
321 | m_t << ".PP" << endl;␊ |
322 | m_firstCol=TRUE;␊ |
323 | }␊ |
324 | }␊ |
325 | else␊ |
326 | {␊ |
327 | if (!m_hide) m_t << endl;␊ |
328 | }␊ |
329 | }␊ |
330 | ␊ |
331 | void ManDocVisitor::visit(DocFormula *f)␊ |
332 | {␊ |
333 | if (m_hide) return;␊ |
334 | m_t << f->text();␊ |
335 | }␊ |
336 | ␊ |
337 | void ManDocVisitor::visit(DocIndexEntry *)␊ |
338 | {␊ |
339 | }␊ |
340 | ␊ |
341 | void ManDocVisitor::visit(DocSimpleSectSep *)␊ |
342 | {␊ |
343 | }␊ |
344 | ␊ |
345 | //--------------------------------------␊ |
346 | // visitor functions for compound nodes␊ |
347 | //--------------------------------------␊ |
348 | ␊ |
349 | void ManDocVisitor::visitPre(DocAutoList *)␊ |
350 | {␊ |
351 | if (m_hide) return;␊ |
352 | m_indent+=2;␊ |
353 | }␊ |
354 | ␊ |
355 | void ManDocVisitor::visitPost(DocAutoList *)␊ |
356 | {␊ |
357 | if (m_hide) return;␊ |
358 | m_indent-=2;␊ |
359 | m_t << ".PP" << endl;␊ |
360 | }␊ |
361 | ␊ |
362 | void ManDocVisitor::visitPre(DocAutoListItem *li)␊ |
363 | {␊ |
364 | if (m_hide) return;␊ |
365 | QCString ws;␊ |
366 | ws.fill(' ',m_indent-2);␊ |
367 | if (!m_firstCol) m_t << endl;␊ |
368 | m_t << ".IP \"" << ws; ␊ |
369 | if (((DocAutoList *)li->parent())->isEnumList())␊ |
370 | {␊ |
371 | m_t << li->itemNumber() << ".\" " << m_indent+2;␊ |
372 | }␊ |
373 | else // bullet list␊ |
374 | {␊ |
375 | m_t << "\\(bu\" " << m_indent;␊ |
376 | }␊ |
377 | m_t << endl;␊ |
378 | m_firstCol=TRUE;␊ |
379 | }␊ |
380 | ␊ |
381 | void ManDocVisitor::visitPost(DocAutoListItem *) ␊ |
382 | {␊ |
383 | if (m_hide) return;␊ |
384 | m_t << endl;␊ |
385 | m_firstCol=TRUE;␊ |
386 | }␊ |
387 | ␊ |
388 | void ManDocVisitor::visitPre(DocPara *) ␊ |
389 | {␊ |
390 | }␊ |
391 | ␊ |
392 | void ManDocVisitor::visitPost(DocPara *p)␊ |
393 | {␊ |
394 | if (m_hide) return;␊ |
395 | if (!p->isLast() && // omit <p> for last paragraph␊ |
396 | !(p->parent() && // and for parameter sections␊ |
397 | p->parent()->kind()==DocNode::Kind_ParamSect␊ |
398 | )␊ |
399 | ) ␊ |
400 | {␊ |
401 | if (!m_firstCol) m_t << endl;␊ |
402 | m_t << ".PP" << endl;␊ |
403 | m_firstCol=TRUE;␊ |
404 | }␊ |
405 | }␊ |
406 | ␊ |
407 | void ManDocVisitor::visitPre(DocRoot *)␊ |
408 | {␊ |
409 | }␊ |
410 | ␊ |
411 | void ManDocVisitor::visitPost(DocRoot *)␊ |
412 | {␊ |
413 | }␊ |
414 | ␊ |
415 | void ManDocVisitor::visitPre(DocSimpleSect *s)␊ |
416 | {␊ |
417 | if (m_hide) return;␊ |
418 | if (!m_firstCol)␊ |
419 | { ␊ |
420 | m_t << endl;␊ |
421 | m_t << ".PP" << endl;␊ |
422 | }␊ |
423 | m_t << "\\fB";␊ |
424 | switch(s->type())␊ |
425 | {␊ |
426 | case DocSimpleSect::See: ␊ |
427 | m_t << theTranslator->trSeeAlso(); break;␊ |
428 | case DocSimpleSect::Return: ␊ |
429 | m_t << theTranslator->trReturns(); break;␊ |
430 | case DocSimpleSect::Author: ␊ |
431 | m_t << theTranslator->trAuthor(TRUE,TRUE); break;␊ |
432 | case DocSimpleSect::Authors: ␊ |
433 | m_t << theTranslator->trAuthor(TRUE,FALSE); break;␊ |
434 | case DocSimpleSect::Version: ␊ |
435 | m_t << theTranslator->trVersion(); break;␊ |
436 | case DocSimpleSect::Since: ␊ |
437 | m_t << theTranslator->trSince(); break;␊ |
438 | case DocSimpleSect::Date: ␊ |
439 | m_t << theTranslator->trDate(); break;␊ |
440 | case DocSimpleSect::Note: ␊ |
441 | m_t << theTranslator->trNote(); break;␊ |
442 | case DocSimpleSect::Warning:␊ |
443 | m_t << theTranslator->trWarning(); break;␊ |
444 | case DocSimpleSect::Pre:␊ |
445 | m_t << theTranslator->trPrecondition(); break;␊ |
446 | case DocSimpleSect::Post:␊ |
447 | m_t << theTranslator->trPostcondition(); break;␊ |
448 | case DocSimpleSect::Invar:␊ |
449 | m_t << theTranslator->trInvariant(); break;␊ |
450 | case DocSimpleSect::Remark:␊ |
451 | m_t << theTranslator->trRemarks(); break;␊ |
452 | case DocSimpleSect::Attention:␊ |
453 | m_t << theTranslator->trAttention(); break;␊ |
454 | case DocSimpleSect::User: break;␊ |
455 | case DocSimpleSect::Rcs: break;␊ |
456 | case DocSimpleSect::Unknown: break;␊ |
457 | }␊ |
458 | ␊ |
459 | // special case 1: user defined title␊ |
460 | if (s->type()!=DocSimpleSect::User && s->type()!=DocSimpleSect::Rcs)␊ |
461 | {␊ |
462 | m_t << ":\\fP" << endl;␊ |
463 | m_t << ".RS 4" << endl;␊ |
464 | }␊ |
465 | }␊ |
466 | ␊ |
467 | void ManDocVisitor::visitPost(DocSimpleSect *)␊ |
468 | {␊ |
469 | if (m_hide) return;␊ |
470 | if (!m_firstCol) m_t << endl;␊ |
471 | m_t << ".RE" << endl;␊ |
472 | m_t << ".PP" << endl;␊ |
473 | m_firstCol=TRUE;␊ |
474 | }␊ |
475 | ␊ |
476 | void ManDocVisitor::visitPre(DocTitle *)␊ |
477 | {␊ |
478 | }␊ |
479 | ␊ |
480 | void ManDocVisitor::visitPost(DocTitle *)␊ |
481 | {␊ |
482 | if (m_hide) return;␊ |
483 | m_t << "\\fP" << endl;␊ |
484 | m_t << ".RS 4" << endl;␊ |
485 | }␊ |
486 | ␊ |
487 | void ManDocVisitor::visitPre(DocSimpleList *)␊ |
488 | {␊ |
489 | if (m_hide) return;␊ |
490 | m_indent+=2;␊ |
491 | if (!m_firstCol) m_t << endl;␊ |
492 | m_t << ".PD 0" << endl;␊ |
493 | }␊ |
494 | ␊ |
495 | void ManDocVisitor::visitPost(DocSimpleList *)␊ |
496 | {␊ |
497 | if (m_hide) return;␊ |
498 | m_indent-=2;␊ |
499 | m_t << ".PP" << endl;␊ |
500 | }␊ |
501 | ␊ |
502 | void ManDocVisitor::visitPre(DocSimpleListItem *)␊ |
503 | {␊ |
504 | if (m_hide) return;␊ |
505 | QCString ws;␊ |
506 | ws.fill(' ',m_indent-2);␊ |
507 | if (!m_firstCol) m_t << endl;␊ |
508 | m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << endl;␊ |
509 | m_firstCol=TRUE;␊ |
510 | }␊ |
511 | ␊ |
512 | void ManDocVisitor::visitPost(DocSimpleListItem *) ␊ |
513 | {␊ |
514 | if (m_hide) return;␊ |
515 | m_t << endl;␊ |
516 | m_firstCol=TRUE;␊ |
517 | }␊ |
518 | ␊ |
519 | void ManDocVisitor::visitPre(DocSection *s)␊ |
520 | {␊ |
521 | if (m_hide) return;␊ |
522 | if (!m_firstCol) m_t << endl;␊ |
523 | if (s->level()==1) m_t << ".SH"; else m_t << ".SS";␊ |
524 | m_t << " \"";␊ |
525 | filter(s->title());␊ |
526 | m_t << "\"" << endl;␊ |
527 | if (s->level()==1) m_t << ".PP" << endl;␊ |
528 | m_firstCol=TRUE;␊ |
529 | }␊ |
530 | ␊ |
531 | void ManDocVisitor::visitPost(DocSection *) ␊ |
532 | {␊ |
533 | }␊ |
534 | ␊ |
535 | void ManDocVisitor::visitPre(DocHtmlList *)␊ |
536 | {␊ |
537 | if (m_hide) return;␊ |
538 | m_indent+=2;␊ |
539 | if (!m_firstCol) m_t << endl;␊ |
540 | m_t << ".PD 0" << endl;␊ |
541 | }␊ |
542 | ␊ |
543 | void ManDocVisitor::visitPost(DocHtmlList *) ␊ |
544 | {␊ |
545 | if (m_hide) return;␊ |
546 | m_indent-=2;␊ |
547 | if (!m_firstCol) m_t << endl;␊ |
548 | m_t << ".PP" << endl;␊ |
549 | }␊ |
550 | ␊ |
551 | void ManDocVisitor::visitPre(DocHtmlListItem *li)␊ |
552 | {␊ |
553 | if (m_hide) return;␊ |
554 | QCString ws;␊ |
555 | ws.fill(' ',m_indent-2);␊ |
556 | if (!m_firstCol) m_t << endl;␊ |
557 | m_t << ".IP \"" << ws; ␊ |
558 | if (((DocHtmlList *)li->parent())->type()==DocHtmlList::Ordered)␊ |
559 | {␊ |
560 | m_t << li->itemNumber() << ".\" " << m_indent+2;␊ |
561 | }␊ |
562 | else // bullet list␊ |
563 | {␊ |
564 | m_t << "\\(bu\" " << m_indent;␊ |
565 | }␊ |
566 | m_t << endl;␊ |
567 | m_firstCol=TRUE;␊ |
568 | }␊ |
569 | ␊ |
570 | void ManDocVisitor::visitPost(DocHtmlListItem *) ␊ |
571 | {␊ |
572 | if (m_hide) return;␊ |
573 | m_t << endl;␊ |
574 | m_firstCol=TRUE;␊ |
575 | }␊ |
576 | ␊ |
577 | //void ManDocVisitor::visitPre(DocHtmlPre *)␊ |
578 | //{␊ |
579 | // if (!m_firstCol) m_t << endl;␊ |
580 | // m_t << ".PP" << endl;␊ |
581 | // m_t << ".nf" << endl;␊ |
582 | // m_insidePre=TRUE;␊ |
583 | //}␊ |
584 | //␊ |
585 | //void ManDocVisitor::visitPost(DocHtmlPre *) ␊ |
586 | //{␊ |
587 | // m_insidePre=FALSE;␊ |
588 | // if (!m_firstCol) m_t << endl;␊ |
589 | // m_t << ".fi" << endl;␊ |
590 | // m_t << ".PP" << endl;␊ |
591 | // m_firstCol=TRUE;␊ |
592 | //}␊ |
593 | ␊ |
594 | void ManDocVisitor::visitPre(DocHtmlDescList *)␊ |
595 | {␊ |
596 | }␊ |
597 | ␊ |
598 | void ManDocVisitor::visitPost(DocHtmlDescList *) ␊ |
599 | {␊ |
600 | if (m_hide) return;␊ |
601 | if (!m_firstCol) m_t << endl;␊ |
602 | m_t << ".PP" << endl;␊ |
603 | m_firstCol=TRUE;␊ |
604 | }␊ |
605 | ␊ |
606 | void ManDocVisitor::visitPre(DocHtmlDescTitle *)␊ |
607 | {␊ |
608 | if (m_hide) return;␊ |
609 | if (!m_firstCol) m_t << endl;␊ |
610 | m_t << ".IP \"\\fB";␊ |
611 | m_firstCol=FALSE;␊ |
612 | }␊ |
613 | ␊ |
614 | void ManDocVisitor::visitPost(DocHtmlDescTitle *) ␊ |
615 | {␊ |
616 | if (m_hide) return;␊ |
617 | m_t << "\\fP\" 1c" << endl;␊ |
618 | m_firstCol=TRUE;␊ |
619 | }␊ |
620 | ␊ |
621 | void ManDocVisitor::visitPre(DocHtmlDescData *)␊ |
622 | {␊ |
623 | }␊ |
624 | ␊ |
625 | void ManDocVisitor::visitPost(DocHtmlDescData *) ␊ |
626 | {␊ |
627 | }␊ |
628 | ␊ |
629 | void ManDocVisitor::visitPre(DocHtmlTable *)␊ |
630 | {␊ |
631 | }␊ |
632 | ␊ |
633 | void ManDocVisitor::visitPost(DocHtmlTable *) ␊ |
634 | {␊ |
635 | }␊ |
636 | ␊ |
637 | void ManDocVisitor::visitPre(DocHtmlCaption *)␊ |
638 | {␊ |
639 | }␊ |
640 | ␊ |
641 | void ManDocVisitor::visitPost(DocHtmlCaption *) ␊ |
642 | {␊ |
643 | }␊ |
644 | ␊ |
645 | void ManDocVisitor::visitPre(DocHtmlRow *)␊ |
646 | {␊ |
647 | }␊ |
648 | ␊ |
649 | void ManDocVisitor::visitPost(DocHtmlRow *) ␊ |
650 | {␊ |
651 | }␊ |
652 | ␊ |
653 | void ManDocVisitor::visitPre(DocHtmlCell *)␊ |
654 | {␊ |
655 | }␊ |
656 | ␊ |
657 | void ManDocVisitor::visitPost(DocHtmlCell *) ␊ |
658 | {␊ |
659 | }␊ |
660 | ␊ |
661 | void ManDocVisitor::visitPre(DocInternal *)␊ |
662 | {␊ |
663 | if (m_hide) return;␊ |
664 | //if (!m_firstCol) m_t << endl;␊ |
665 | //m_t << ".PP" << endl;␊ |
666 | //m_t << "\\fB" << theTranslator->trForInternalUseOnly() << "\\fP" << endl;␊ |
667 | //m_t << ".RS 4" << endl;␊ |
668 | }␊ |
669 | ␊ |
670 | void ManDocVisitor::visitPost(DocInternal *) ␊ |
671 | {␊ |
672 | if (m_hide) return;␊ |
673 | //if (!m_firstCol) m_t << endl;␊ |
674 | //m_t << ".RE" << endl;␊ |
675 | //m_t << ".PP" << endl;␊ |
676 | //m_firstCol=TRUE;␊ |
677 | }␊ |
678 | ␊ |
679 | void ManDocVisitor::visitPre(DocHRef *)␊ |
680 | {␊ |
681 | if (m_hide) return;␊ |
682 | m_t << "\\fC";␊ |
683 | }␊ |
684 | ␊ |
685 | void ManDocVisitor::visitPost(DocHRef *) ␊ |
686 | {␊ |
687 | if (m_hide) return;␊ |
688 | m_t << "\\fP";␊ |
689 | }␊ |
690 | ␊ |
691 | void ManDocVisitor::visitPre(DocHtmlHeader *header)␊ |
692 | {␊ |
693 | if (m_hide) return;␊ |
694 | if (!m_firstCol) m_t << endl;␊ |
695 | if (header->level()==1) m_t << ".SH"; else m_t << ".SS";␊ |
696 | m_t << " \"";␊ |
697 | }␊ |
698 | ␊ |
699 | void ManDocVisitor::visitPost(DocHtmlHeader *header) ␊ |
700 | {␊ |
701 | if (m_hide) return;␊ |
702 | m_t << "\"" << endl;␊ |
703 | if (header->level()==1) m_t << ".PP" << endl;␊ |
704 | m_firstCol=TRUE;␊ |
705 | }␊ |
706 | ␊ |
707 | void ManDocVisitor::visitPre(DocImage *)␊ |
708 | {␊ |
709 | }␊ |
710 | ␊ |
711 | void ManDocVisitor::visitPost(DocImage *) ␊ |
712 | {␊ |
713 | }␊ |
714 | ␊ |
715 | void ManDocVisitor::visitPre(DocDotFile *)␊ |
716 | {␊ |
717 | }␊ |
718 | ␊ |
719 | void ManDocVisitor::visitPost(DocDotFile *) ␊ |
720 | {␊ |
721 | }␊ |
722 | void ManDocVisitor::visitPre(DocMscFile *)␊ |
723 | {␊ |
724 | }␊ |
725 | ␊ |
726 | void ManDocVisitor::visitPost(DocMscFile *) ␊ |
727 | {␊ |
728 | }␊ |
729 | ␊ |
730 | ␊ |
731 | void ManDocVisitor::visitPre(DocLink *)␊ |
732 | {␊ |
733 | if (m_hide) return;␊ |
734 | m_t << "\\fB";␊ |
735 | }␊ |
736 | ␊ |
737 | void ManDocVisitor::visitPost(DocLink *) ␊ |
738 | {␊ |
739 | if (m_hide) return;␊ |
740 | m_t << "\\fP";␊ |
741 | }␊ |
742 | ␊ |
743 | void ManDocVisitor::visitPre(DocRef *ref)␊ |
744 | {␊ |
745 | if (m_hide) return;␊ |
746 | m_t << "\\fB";␊ |
747 | if (!ref->hasLinkText()) filter(ref->targetTitle());␊ |
748 | }␊ |
749 | ␊ |
750 | void ManDocVisitor::visitPost(DocRef *) ␊ |
751 | {␊ |
752 | if (m_hide) return;␊ |
753 | m_t << "\\fP";␊ |
754 | }␊ |
755 | ␊ |
756 | void ManDocVisitor::visitPre(DocSecRefItem *)␊ |
757 | {␊ |
758 | if (m_hide) return;␊ |
759 | QCString ws;␊ |
760 | ws.fill(' ',m_indent-2);␊ |
761 | if (!m_firstCol) m_t << endl;␊ |
762 | m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << endl;␊ |
763 | m_firstCol=TRUE;␊ |
764 | }␊ |
765 | ␊ |
766 | void ManDocVisitor::visitPost(DocSecRefItem *) ␊ |
767 | {␊ |
768 | if (m_hide) return;␊ |
769 | m_t << endl;␊ |
770 | m_firstCol=TRUE;␊ |
771 | }␊ |
772 | ␊ |
773 | void ManDocVisitor::visitPre(DocSecRefList *)␊ |
774 | {␊ |
775 | if (m_hide) return;␊ |
776 | m_indent+=2;␊ |
777 | }␊ |
778 | ␊ |
779 | void ManDocVisitor::visitPost(DocSecRefList *) ␊ |
780 | {␊ |
781 | if (m_hide) return;␊ |
782 | m_indent-=2;␊ |
783 | if (!m_firstCol) m_t << endl;␊ |
784 | m_t << ".PP" << endl;␊ |
785 | }␊ |
786 | ␊ |
787 | //void ManDocVisitor::visitPre(DocLanguage *l)␊ |
788 | //{␊ |
789 | // QString langId = Config_getEnum("OUTPUT_LANGUAGE");␊ |
790 | // if (l->id().lower()!=langId.lower())␊ |
791 | // {␊ |
792 | // pushEnabled();␊ |
793 | // m_hide = TRUE;␊ |
794 | // }␊ |
795 | //}␊ |
796 | //␊ |
797 | //void ManDocVisitor::visitPost(DocLanguage *l) ␊ |
798 | //{␊ |
799 | // QString langId = Config_getEnum("OUTPUT_LANGUAGE");␊ |
800 | // if (l->id().lower()!=langId.lower())␊ |
801 | // {␊ |
802 | // popEnabled();␊ |
803 | // }␊ |
804 | //}␊ |
805 | ␊ |
806 | void ManDocVisitor::visitPre(DocParamSect *s)␊ |
807 | {␊ |
808 | if (m_hide) return;␊ |
809 | if (!m_firstCol)␊ |
810 | { ␊ |
811 | m_t << endl;␊ |
812 | m_t << ".PP" << endl;␊ |
813 | }␊ |
814 | m_t << "\\fB";␊ |
815 | switch(s->type())␊ |
816 | {␊ |
817 | case DocParamSect::Param: ␊ |
818 | m_t << theTranslator->trParameters(); break;␊ |
819 | case DocParamSect::RetVal: ␊ |
820 | m_t << theTranslator->trReturnValues(); break;␊ |
821 | case DocParamSect::Exception: ␊ |
822 | m_t << theTranslator->trExceptions(); break;␊ |
823 | case DocParamSect::TemplateParam: ␊ |
824 | /* TODO: add this ␊ |
825 | m_t << theTranslator->trTemplateParam(); break;␊ |
826 | */␊ |
827 | m_t << "Template Parameters"; break;␊ |
828 | default:␊ |
829 | ASSERT(0);␊ |
830 | }␊ |
831 | m_t << ":\\fP" << endl;␊ |
832 | m_t << ".RS 4" << endl;␊ |
833 | }␊ |
834 | ␊ |
835 | void ManDocVisitor::visitPost(DocParamSect *)␊ |
836 | {␊ |
837 | if (m_hide) return;␊ |
838 | if (!m_firstCol) m_t << endl;␊ |
839 | m_t << ".RE" << endl;␊ |
840 | m_t << ".PP" << endl;␊ |
841 | m_firstCol=TRUE;␊ |
842 | }␊ |
843 | ␊ |
844 | void ManDocVisitor::visitPre(DocParamList *pl)␊ |
845 | {␊ |
846 | if (m_hide) return;␊ |
847 | m_t << "\\fI";␊ |
848 | //QStrListIterator li(pl->parameters());␊ |
849 | //const char *s;␊ |
850 | QListIterator<DocNode> li(pl->parameters());␊ |
851 | DocNode *param;␊ |
852 | bool first=TRUE;␊ |
853 | for (li.toFirst();(param=li.current());++li)␊ |
854 | {␊ |
855 | if (!first) m_t << ","; else first=FALSE;␊ |
856 | if (param->kind()==DocNode::Kind_Word)␊ |
857 | {␊ |
858 | visit((DocWord*)param); ␊ |
859 | }␊ |
860 | else if (param->kind()==DocNode::Kind_LinkedWord)␊ |
861 | {␊ |
862 | visit((DocLinkedWord*)param); ␊ |
863 | }␊ |
864 | }␊ |
865 | m_t << "\\fP ";␊ |
866 | }␊ |
867 | ␊ |
868 | void ManDocVisitor::visitPost(DocParamList *pl)␊ |
869 | {␊ |
870 | if (m_hide) return;␊ |
871 | if (!pl->isLast())␊ |
872 | {␊ |
873 | if (!m_firstCol) m_t << endl;␊ |
874 | m_t << ".br" << endl;␊ |
875 | }␊ |
876 | }␊ |
877 | ␊ |
878 | void ManDocVisitor::visitPre(DocXRefItem *x)␊ |
879 | {␊ |
880 | if (m_hide) return;␊ |
881 | if (!m_firstCol)␊ |
882 | { ␊ |
883 | m_t << endl;␊ |
884 | m_t << ".PP" << endl;␊ |
885 | }␊ |
886 | m_t << "\\fB";␊ |
887 | filter(x->title());␊ |
888 | m_t << "\\fP" << endl;␊ |
889 | m_t << ".RS 4" << endl;␊ |
890 | }␊ |
891 | ␊ |
892 | void ManDocVisitor::visitPost(DocXRefItem *)␊ |
893 | {␊ |
894 | if (m_hide) return;␊ |
895 | if (!m_firstCol) m_t << endl;␊ |
896 | m_t << ".RE" << endl;␊ |
897 | m_t << ".PP" << endl;␊ |
898 | m_firstCol=TRUE;␊ |
899 | }␊ |
900 | ␊ |
901 | void ManDocVisitor::visitPre(DocInternalRef *)␊ |
902 | {␊ |
903 | if (m_hide) return;␊ |
904 | m_t << "\\fB";␊ |
905 | }␊ |
906 | ␊ |
907 | void ManDocVisitor::visitPost(DocInternalRef *) ␊ |
908 | {␊ |
909 | if (m_hide) return;␊ |
910 | m_t << "\\fP";␊ |
911 | }␊ |
912 | ␊ |
913 | void ManDocVisitor::visitPre(DocCopy *)␊ |
914 | {␊ |
915 | }␊ |
916 | ␊ |
917 | void ManDocVisitor::visitPost(DocCopy *)␊ |
918 | {␊ |
919 | }␊ |
920 | ␊ |
921 | void ManDocVisitor::visitPre(DocText *)␊ |
922 | {␊ |
923 | }␊ |
924 | ␊ |
925 | void ManDocVisitor::visitPost(DocText *)␊ |
926 | {␊ |
927 | }␊ |
928 | ␊ |
929 | void ManDocVisitor::filter(const char *str)␊ |
930 | { ␊ |
931 | if (str)␊ |
932 | {␊ |
933 | const char *p=str;␊ |
934 | char c=0;␊ |
935 | while ((c=*p++)) ␊ |
936 | {␊ |
937 | switch(c)␊ |
938 | {␊ |
939 | case '\\': m_t << "\\\\"; break;␊ |
940 | case '"': c = '\''; // fall through␊ |
941 | default: m_t << c; break;␊ |
942 | }␊ |
943 | }␊ |
944 | }␊ |
945 | }␊ |
946 | ␊ |
947 | void ManDocVisitor::pushEnabled()␊ |
948 | {␊ |
949 | m_enabled.push(new bool(m_hide));␊ |
950 | }␊ |
951 | ␊ |
952 | void ManDocVisitor::popEnabled()␊ |
953 | {␊ |
954 | bool *v=m_enabled.pop();␊ |
955 | ASSERT(v!=0);␊ |
956 | m_hide = *v;␊ |
957 | delete v;␊ |
958 | }␊ |
959 | ␊ |
960 |