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