mandocvisitor.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: $
00004  *
00005  *
00006  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00007  *
00008  * Permission to use, copy, modify, and distribute this software and its
00009  * documentation under the terms of the GNU General Public License is hereby 
00010  * granted. No representations are made about the suitability of this software 
00011  * for any purpose. It is provided "as is" without express or implied warranty.
00012  * See the GNU General Public License for more details.
00013  *
00014  * Documents produced by Doxygen are derivative works derived from the
00015  * input used in their production; they are not affected by this license.
00016  *
00017  */
00018 
00019 #include "mandocvisitor.h"
00020 #include "docparser.h"
00021 #include "language.h"
00022 #include "doxygen.h"
00023 #include "outputgen.h"
00024 #include "code.h"
00025 #include "dot.h"
00026 #include "util.h"
00027 #include "message.h"
00028 #include <qfileinfo.h> 
00029 #include "parserintf.h"
00030 
00031 ManDocVisitor::ManDocVisitor(QTextStream &t,CodeOutputInterface &ci,
00032                              const char *langExt) 
00033   : DocVisitor(DocVisitor_Man), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(TRUE),
00034     m_indent(0), m_langExt(langExt)
00035 {
00036 }
00037 
00038   //--------------------------------------
00039   // visitor functions for leaf nodes
00040   //--------------------------------------
00041 
00042 void ManDocVisitor::visit(DocWord *w)
00043 {
00044   if (m_hide) return;
00045   filter(w->word());
00046   m_firstCol=FALSE;
00047 }
00048 
00049 void ManDocVisitor::visit(DocLinkedWord *w)
00050 {
00051   if (m_hide) return;
00052   m_t << "\\fB";
00053   filter(w->word());
00054   m_t << "\\fP";
00055   m_firstCol=FALSE;
00056 }
00057 
00058 void ManDocVisitor::visit(DocWhiteSpace *w)
00059 {
00060   if (m_hide) return;
00061   if (m_insidePre)
00062   {
00063     m_t << w->chars();
00064     m_firstCol=w->chars().at(w->chars().length()-1)=='\n';
00065   }
00066   else
00067   {
00068     m_t << " ";
00069     m_firstCol=FALSE;
00070   }
00071 }
00072 
00073 void ManDocVisitor::visit(DocSymbol *s)
00074 {
00075   if (m_hide) return;
00076   switch(s->symbol())
00077   {
00078     case DocSymbol::BSlash:  m_t << "\\\\"; break;
00079     case DocSymbol::At:      m_t << "@"; break;
00080     case DocSymbol::Less:    m_t << "<"; break;
00081     case DocSymbol::Greater: m_t << ">"; break;
00082     case DocSymbol::Amp:     m_t << "&"; break;
00083     case DocSymbol::Dollar:  m_t << "$"; break;
00084     case DocSymbol::Hash:    m_t << "#"; break;
00085     case DocSymbol::Percent: m_t << "%"; break;
00086     case DocSymbol::Copy:    m_t << "(C)"; break;
00087     case DocSymbol::Tm:      m_t << "(TM)"; break;
00088     case DocSymbol::Reg:     m_t << "(R)"; break;
00089     case DocSymbol::Apos:    m_t << "'"; break;
00090     case DocSymbol::Quot:    m_t << "\""; break;
00091     case DocSymbol::Lsquo:   m_t << "`"; break;
00092     case DocSymbol::Rsquo:   m_t << "'"; break;
00093     case DocSymbol::Ldquo:   m_t << "``"; break;
00094     case DocSymbol::Rdquo:   m_t << "''"; break;
00095     case DocSymbol::Ndash:   m_t << "--"; break;
00096     case DocSymbol::Mdash:   m_t << "---"; break;
00097     case DocSymbol::Uml:     m_t << s->letter() << "\\*(4"; break;
00098     case DocSymbol::Acute:   m_t << s->letter() << "\\*(`"; break;
00099     case DocSymbol::Grave:   m_t << s->letter() << "\\*:"; break;
00100     case DocSymbol::Circ:    m_t << s->letter() << "\\*^"; break;
00101     case DocSymbol::Slash:   m_t << s->letter(); break; /* todo: implement this */
00102     case DocSymbol::Tilde:   m_t << s->letter() << "\\*~"; break;
00103     case DocSymbol::Szlig:   m_t << "s\\*:"; break;
00104     case DocSymbol::Cedil:   m_t << s->letter() << "\\*,"; break;
00105     case DocSymbol::Ring:    m_t << s->letter() << "\\*o"; break;
00106     case DocSymbol::Nbsp:    m_t << " "; break;
00107     default:
00108                              err("Error: unknown symbol found\n");
00109   }
00110   m_firstCol=FALSE;
00111 }
00112 
00113 void ManDocVisitor::visit(DocURL *u)
00114 {
00115   if (m_hide) return;
00116   m_t << u->url();
00117   m_firstCol=FALSE;
00118 }
00119 
00120 void ManDocVisitor::visit(DocLineBreak *)
00121 {
00122   if (m_hide) return;
00123   m_t << endl << ".br" << endl;
00124   m_firstCol=TRUE;
00125 }
00126 
00127 void ManDocVisitor::visit(DocHorRuler *)
00128 {
00129   if (m_hide) return;
00130   if (!m_firstCol) m_t << endl;
00131   m_t << ".PP" << endl;
00132   m_firstCol=TRUE;
00133 }
00134 
00135 void ManDocVisitor::visit(DocStyleChange *s)
00136 {
00137   if (m_hide) return;
00138   switch (s->style())
00139   {
00140     case DocStyleChange::Bold:
00141       if (s->enable()) m_t << "\\fB";      else m_t << "\\fP";
00142       m_firstCol=FALSE;
00143       break;
00144     case DocStyleChange::Italic:
00145       if (s->enable()) m_t << "\\fI";     else m_t << "\\fP";
00146       m_firstCol=FALSE;
00147       break;
00148     case DocStyleChange::Code:
00149       if (s->enable()) m_t << "\\fC";   else m_t << "\\fP";
00150       m_firstCol=FALSE;
00151       break;
00152     case DocStyleChange::Subscript:
00153       if (s->enable()) m_t << "\\*<";    else m_t << "\\*> ";
00154       m_firstCol=FALSE;
00155       break;
00156     case DocStyleChange::Superscript:
00157       if (s->enable()) m_t << "\\*{";    else m_t << "\\*} ";
00158       m_firstCol=FALSE;
00159       break;
00160     case DocStyleChange::Center:
00161       /* not supported */
00162       break;
00163     case DocStyleChange::Small:
00164       /* not supported */
00165       break;
00166     case DocStyleChange::Preformatted:
00167       if (s->enable())
00168       {
00169         if (!m_firstCol) m_t << endl;
00170         m_t << ".PP" << endl;
00171         m_t << ".nf" << endl;
00172         m_insidePre=TRUE;
00173       }
00174       else
00175       {
00176         m_insidePre=FALSE;
00177         if (!m_firstCol) m_t << endl;
00178         m_t << ".fi" << endl;
00179         m_t << ".PP" << endl;
00180         m_firstCol=TRUE;
00181       }
00182       break;
00183     case DocStyleChange::Div:  /* HTML only */ break;
00184     case DocStyleChange::Span: /* HTML only */ break;
00185   }
00186 }
00187 
00188 void ManDocVisitor::visit(DocVerbatim *s)
00189 {
00190   if (m_hide) return;
00191   switch(s->type())
00192   {
00193     case DocVerbatim::Code: // fall though
00194       if (!m_firstCol) m_t << endl;
00195       m_t << ".PP" << endl;
00196       m_t << ".nf" << endl;
00197       Doxygen::parserManager->getParser(0/*TODO*/)
00198                             ->parseCode(m_ci,s->context(),s->text().latin1(),
00199                                         s->isExample(),s->exampleFile());
00200       if (!m_firstCol) m_t << endl;
00201       m_t << ".fi" << endl;
00202       m_t << ".PP" << endl;
00203       m_firstCol=TRUE;
00204       break;
00205     case DocVerbatim::Verbatim: 
00206       if (!m_firstCol) m_t << endl;
00207       m_t << ".PP" << endl;
00208       m_t << ".nf" << endl;
00209       m_t << s->text();
00210       if (!m_firstCol) m_t << endl;
00211       m_t << ".fi" << endl;
00212       m_t << ".PP" << endl;
00213       m_firstCol=TRUE;
00214       break;
00215     case DocVerbatim::ManOnly: 
00216       m_t << s->text(); 
00217       break;
00218     case DocVerbatim::HtmlOnly: 
00219     case DocVerbatim::XmlOnly: 
00220     case DocVerbatim::LatexOnly: 
00221     case DocVerbatim::Dot: 
00222     case DocVerbatim::Msc: 
00223       /* nothing */ 
00224       break;
00225   }
00226 }
00227 
00228 void ManDocVisitor::visit(DocAnchor *)
00229 {
00230   /* no support for anchors in man pages */
00231 }
00232 
00233 void ManDocVisitor::visit(DocInclude *inc)
00234 {
00235   if (m_hide) return;
00236   switch(inc->type())
00237   {
00238     case DocInclude::IncWithLines:
00239       { 
00240          if (!m_firstCol) m_t << endl;
00241          m_t << ".PP" << endl;
00242          m_t << ".nf" << endl;
00243          QFileInfo cfi( inc->file() );
00244          FileDef fd( cfi.dirPath(), cfi.fileName() );
00245          Doxygen::parserManager->getParser(inc->extension())
00246                                ->parseCode(m_ci,inc->context(),
00247                                            inc->text().latin1(),
00248                                            inc->isExample(),
00249                                            inc->exampleFile(), &fd);
00250          if (!m_firstCol) m_t << endl;
00251          m_t << ".fi" << endl;
00252          m_t << ".PP" << endl;
00253          m_firstCol=TRUE;
00254       }
00255       break;
00256     case DocInclude::Include: 
00257       if (!m_firstCol) m_t << endl;
00258       m_t << ".PP" << endl;
00259       m_t << ".nf" << endl;
00260       Doxygen::parserManager->getParser(inc->extension())
00261                             ->parseCode(m_ci,inc->context(),
00262                                         inc->text().latin1(),inc->isExample(),
00263                                         inc->exampleFile());
00264       if (!m_firstCol) m_t << endl;
00265       m_t << ".fi" << endl;
00266       m_t << ".PP" << endl;
00267       m_firstCol=TRUE;
00268       break;
00269     case DocInclude::DontInclude: 
00270       break;
00271     case DocInclude::HtmlInclude: 
00272       break;
00273     case DocInclude::VerbInclude: 
00274       if (!m_firstCol) m_t << endl;
00275       m_t << ".PP" << endl;
00276       m_t << ".nf" << endl;
00277       m_t << inc->text();
00278       if (!m_firstCol) m_t << endl;
00279       m_t << ".fi" << endl;
00280       m_t << ".PP" << endl;
00281       m_firstCol=TRUE;
00282       break;
00283   }
00284 }
00285 
00286 void ManDocVisitor::visit(DocIncOperator *op)
00287 {
00288   //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",
00289   //    op->type(),op->isFirst(),op->isLast(),op->text().data());
00290   if (op->isFirst()) 
00291   {
00292     if (!m_hide)
00293     {
00294       if (!m_firstCol) m_t << endl;
00295       m_t << ".PP" << endl;
00296       m_t << ".nf" << endl;
00297     }
00298     pushEnabled();
00299     m_hide = TRUE;
00300   }
00301   if (op->type()!=DocIncOperator::Skip) 
00302   {
00303     popEnabled();
00304     if (!m_hide) 
00305     {
00306       Doxygen::parserManager->getParser(0/*TODO*/)
00307                             ->parseCode(m_ci,op->context(),op->text().latin1(),
00308                                         op->isExample(),op->exampleFile());
00309     }
00310     pushEnabled();
00311     m_hide=TRUE;
00312   }
00313   if (op->isLast())  
00314   {
00315     popEnabled();
00316     if (!m_hide)
00317     {
00318       if (!m_firstCol) m_t << endl;
00319       m_t << ".fi" << endl;
00320       m_t << ".PP" << endl;
00321       m_firstCol=TRUE;
00322     }
00323   }
00324   else
00325   {
00326     if (!m_hide) m_t << endl;
00327   }
00328 }
00329 
00330 void ManDocVisitor::visit(DocFormula *f)
00331 {
00332   if (m_hide) return;
00333   m_t << f->text();
00334 }
00335 
00336 void ManDocVisitor::visit(DocIndexEntry *)
00337 {
00338 }
00339 
00340 //--------------------------------------
00341 // visitor functions for compound nodes
00342 //--------------------------------------
00343 
00344 void ManDocVisitor::visitPre(DocAutoList *)
00345 {
00346   if (m_hide) return;
00347   m_indent+=2;
00348 }
00349 
00350 void ManDocVisitor::visitPost(DocAutoList *)
00351 {
00352   if (m_hide) return;
00353   m_indent-=2;
00354   m_t << ".PP" << endl;
00355 }
00356 
00357 void ManDocVisitor::visitPre(DocAutoListItem *li)
00358 {
00359   if (m_hide) return;
00360   QCString ws;
00361   ws.fill(' ',m_indent-2);
00362   if (!m_firstCol) m_t << endl;
00363   m_t << ".IP \"" << ws; 
00364   if (((DocAutoList *)li->parent())->isEnumList())
00365   {
00366     m_t << li->itemNumber() << ".\" " << m_indent+2;
00367   }
00368   else // bullet list
00369   {
00370     m_t << "\\(bu\" " << m_indent;
00371   }
00372   m_t << endl;
00373   m_firstCol=TRUE;
00374 }
00375 
00376 void ManDocVisitor::visitPost(DocAutoListItem *) 
00377 {
00378   if (m_hide) return;
00379   m_t << endl;
00380   m_firstCol=TRUE;
00381 }
00382 
00383 void ManDocVisitor::visitPre(DocPara *) 
00384 {
00385 }
00386 
00387 void ManDocVisitor::visitPost(DocPara *p)
00388 {
00389   if (m_hide) return;
00390   if (!p->isLast() &&            // omit <p> for last paragraph
00391       !(p->parent() &&           // and for parameter sections
00392         p->parent()->kind()==DocNode::Kind_ParamSect
00393        )
00394      ) 
00395   {
00396     if (!m_firstCol) m_t << endl;
00397     m_t << ".PP" << endl;
00398     m_firstCol=TRUE;
00399   }
00400 }
00401 
00402 void ManDocVisitor::visitPre(DocRoot *)
00403 {
00404 }
00405 
00406 void ManDocVisitor::visitPost(DocRoot *)
00407 {
00408 }
00409 
00410 void ManDocVisitor::visitPre(DocSimpleSect *s)
00411 {
00412   if (m_hide) return;
00413   if (!m_firstCol)
00414   { 
00415     m_t << endl;
00416     m_t << ".PP" << endl;
00417   }
00418   m_t << "\\fB";
00419   switch(s->type())
00420   {
00421     case DocSimpleSect::See: 
00422       m_t << theTranslator->trSeeAlso(); break;
00423     case DocSimpleSect::Return: 
00424       m_t << theTranslator->trReturns(); break;
00425     case DocSimpleSect::Author: 
00426       m_t << theTranslator->trAuthor(TRUE,TRUE); break;
00427     case DocSimpleSect::Authors: 
00428       m_t << theTranslator->trAuthor(TRUE,FALSE); break;
00429     case DocSimpleSect::Version: 
00430       m_t << theTranslator->trVersion(); break;
00431     case DocSimpleSect::Since: 
00432       m_t << theTranslator->trSince(); break;
00433     case DocSimpleSect::Date: 
00434       m_t << theTranslator->trDate(); break;
00435     case DocSimpleSect::Note: 
00436       m_t << theTranslator->trNote(); break;
00437     case DocSimpleSect::Warning:
00438       m_t << theTranslator->trWarning(); break;
00439     case DocSimpleSect::Pre:
00440       m_t << theTranslator->trPrecondition(); break;
00441     case DocSimpleSect::Post:
00442       m_t << theTranslator->trPostcondition(); break;
00443     case DocSimpleSect::Invar:
00444       m_t << theTranslator->trInvariant(); break;
00445     case DocSimpleSect::Remark:
00446       m_t << theTranslator->trRemarks(); break;
00447     case DocSimpleSect::Attention:
00448       m_t << theTranslator->trAttention(); break;
00449     case DocSimpleSect::User: break;
00450     case DocSimpleSect::Rcs: break;
00451     case DocSimpleSect::Unknown:  break;
00452   }
00453 
00454   // special case 1: user defined title
00455   if (s->type()!=DocSimpleSect::User && s->type()!=DocSimpleSect::Rcs)
00456   {
00457     m_t << ":\\fP" << endl;
00458     m_t << ".RS 4" << endl;
00459   }
00460 }
00461 
00462 void ManDocVisitor::visitPost(DocSimpleSect *)
00463 {
00464   if (m_hide) return;
00465   if (!m_firstCol) m_t << endl;
00466   m_t << ".RE" << endl;
00467   m_t << ".PP" << endl;
00468   m_firstCol=TRUE;
00469 }
00470 
00471 void ManDocVisitor::visitPre(DocTitle *)
00472 {
00473 }
00474 
00475 void ManDocVisitor::visitPost(DocTitle *)
00476 {
00477   if (m_hide) return;
00478   m_t << "\\fP";
00479   m_t << ".RS 4" << endl;
00480 }
00481 
00482 void ManDocVisitor::visitPre(DocSimpleList *)
00483 {
00484   if (m_hide) return;
00485   m_indent+=2;
00486   if (!m_firstCol) m_t << endl;
00487   m_t << ".PD 0" << endl;
00488 }
00489 
00490 void ManDocVisitor::visitPost(DocSimpleList *)
00491 {
00492   if (m_hide) return;
00493   m_indent-=2;
00494   m_t << ".PP" << endl;
00495 }
00496 
00497 void ManDocVisitor::visitPre(DocSimpleListItem *)
00498 {
00499   if (m_hide) return;
00500   QCString ws;
00501   ws.fill(' ',m_indent-2);
00502   if (!m_firstCol) m_t << endl;
00503   m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << endl;
00504   m_firstCol=TRUE;
00505 }
00506 
00507 void ManDocVisitor::visitPost(DocSimpleListItem *) 
00508 {
00509   if (m_hide) return;
00510   m_t << endl;
00511   m_firstCol=TRUE;
00512 }
00513 
00514 void ManDocVisitor::visitPre(DocSection *s)
00515 {
00516   if (m_hide) return;
00517   if (!m_firstCol) m_t << endl;
00518   if (s->level()==1) m_t << ".SH"; else m_t << ".SS";
00519   m_t << " \"";
00520   filter(s->title());
00521   m_t << "\"" << endl;
00522   if (s->level()==1) m_t << ".PP" << endl;
00523   m_firstCol=TRUE;
00524 }
00525 
00526 void ManDocVisitor::visitPost(DocSection *) 
00527 {
00528 }
00529 
00530 void ManDocVisitor::visitPre(DocHtmlList *)
00531 {
00532   if (m_hide) return;
00533   m_indent+=2;
00534   if (!m_firstCol) m_t << endl;
00535   m_t << ".PD 0" << endl;
00536 }
00537 
00538 void ManDocVisitor::visitPost(DocHtmlList *) 
00539 {
00540   if (m_hide) return;
00541   m_indent-=2;
00542   if (!m_firstCol) m_t << endl;
00543   m_t << ".PP" << endl;
00544 }
00545 
00546 void ManDocVisitor::visitPre(DocHtmlListItem *li)
00547 {
00548   if (m_hide) return;
00549   QCString ws;
00550   ws.fill(' ',m_indent-2);
00551   if (!m_firstCol) m_t << endl;
00552   m_t << ".IP \"" << ws; 
00553   if (((DocHtmlList *)li->parent())->type()==DocHtmlList::Ordered)
00554   {
00555     m_t << li->itemNumber() << ".\" " << m_indent+2;
00556   }
00557   else // bullet list
00558   {
00559     m_t << "\\(bu\" " << m_indent;
00560   }
00561   m_t << endl;
00562   m_firstCol=TRUE;
00563 }
00564 
00565 void ManDocVisitor::visitPost(DocHtmlListItem *) 
00566 {
00567   if (m_hide) return;
00568   m_t << endl;
00569   m_firstCol=TRUE;
00570 }
00571 
00572 //void ManDocVisitor::visitPre(DocHtmlPre *)
00573 //{
00574 //  if (!m_firstCol) m_t << endl;
00575 //  m_t << ".PP" << endl;
00576 //  m_t << ".nf" << endl;
00577 //  m_insidePre=TRUE;
00578 //}
00579 //
00580 //void ManDocVisitor::visitPost(DocHtmlPre *) 
00581 //{
00582 //  m_insidePre=FALSE;
00583 //  if (!m_firstCol) m_t << endl;
00584 //  m_t << ".fi" << endl;
00585 //  m_t << ".PP" << endl;
00586 //  m_firstCol=TRUE;
00587 //}
00588 
00589 void ManDocVisitor::visitPre(DocHtmlDescList *)
00590 {
00591 }
00592 
00593 void ManDocVisitor::visitPost(DocHtmlDescList *) 
00594 {
00595   if (m_hide) return;
00596   if (!m_firstCol) m_t << endl;
00597   m_t << ".PP" << endl;
00598   m_firstCol=TRUE;
00599 }
00600 
00601 void ManDocVisitor::visitPre(DocHtmlDescTitle *)
00602 {
00603   if (m_hide) return;
00604   if (!m_firstCol) m_t << endl;
00605   m_t << ".IP \"\\fB";
00606   m_firstCol=FALSE;
00607 }
00608 
00609 void ManDocVisitor::visitPost(DocHtmlDescTitle *) 
00610 {
00611   if (m_hide) return;
00612   m_t << "\\fP\" 1c" << endl;
00613   m_firstCol=TRUE;
00614 }
00615 
00616 void ManDocVisitor::visitPre(DocHtmlDescData *)
00617 {
00618 }
00619 
00620 void ManDocVisitor::visitPost(DocHtmlDescData *) 
00621 {
00622 }
00623 
00624 void ManDocVisitor::visitPre(DocHtmlTable *)
00625 {
00626 }
00627 
00628 void ManDocVisitor::visitPost(DocHtmlTable *) 
00629 {
00630 }
00631 
00632 void ManDocVisitor::visitPre(DocHtmlCaption *)
00633 {
00634 }
00635 
00636 void ManDocVisitor::visitPost(DocHtmlCaption *) 
00637 {
00638 }
00639 
00640 void ManDocVisitor::visitPre(DocHtmlRow *)
00641 {
00642 }
00643 
00644 void ManDocVisitor::visitPost(DocHtmlRow *) 
00645 {
00646 }
00647 
00648 void ManDocVisitor::visitPre(DocHtmlCell *)
00649 {
00650 }
00651 
00652 void ManDocVisitor::visitPost(DocHtmlCell *) 
00653 {
00654 }
00655 
00656 void ManDocVisitor::visitPre(DocInternal *)
00657 {
00658   if (m_hide) return;
00659   if (!m_firstCol) m_t << endl;
00660   m_t << ".PP" << endl;
00661   m_t << "\\fB" << theTranslator->trForInternalUseOnly() << "\\fP" << endl;
00662   m_t << ".RS 4" << endl;
00663 }
00664 
00665 void ManDocVisitor::visitPost(DocInternal *) 
00666 {
00667   if (m_hide) return;
00668   if (!m_firstCol) m_t << endl;
00669   m_t << ".RE" << endl;
00670   m_t << ".PP" << endl;
00671   m_firstCol=TRUE;
00672 }
00673 
00674 void ManDocVisitor::visitPre(DocHRef *)
00675 {
00676   if (m_hide) return;
00677   m_t << "\\fC";
00678 }
00679 
00680 void ManDocVisitor::visitPost(DocHRef *) 
00681 {
00682   if (m_hide) return;
00683   m_t << "\\fP";
00684 }
00685 
00686 void ManDocVisitor::visitPre(DocHtmlHeader *header)
00687 {
00688   if (m_hide) return;
00689   if (!m_firstCol) m_t << endl;
00690   if (header->level()==1) m_t << ".SH"; else m_t << ".SS";
00691   m_t << " \"";
00692 }
00693 
00694 void ManDocVisitor::visitPost(DocHtmlHeader *header) 
00695 {
00696   if (m_hide) return;
00697   m_t << "\"" << endl;
00698   if (header->level()==1) m_t << ".PP" << endl;
00699   m_firstCol=TRUE;
00700 }
00701 
00702 void ManDocVisitor::visitPre(DocImage *)
00703 {
00704 }
00705 
00706 void ManDocVisitor::visitPost(DocImage *) 
00707 {
00708 }
00709 
00710 void ManDocVisitor::visitPre(DocDotFile *)
00711 {
00712 }
00713 
00714 void ManDocVisitor::visitPost(DocDotFile *) 
00715 {
00716 }
00717 
00718 void ManDocVisitor::visitPre(DocLink *)
00719 {
00720   if (m_hide) return;
00721   m_t << "\\fB";
00722 }
00723 
00724 void ManDocVisitor::visitPost(DocLink *) 
00725 {
00726   if (m_hide) return;
00727   m_t << "\\fP";
00728 }
00729 
00730 void ManDocVisitor::visitPre(DocRef *ref)
00731 {
00732   if (m_hide) return;
00733   m_t << "\\fB";
00734   if (!ref->hasLinkText()) filter(ref->targetTitle());
00735 }
00736 
00737 void ManDocVisitor::visitPost(DocRef *) 
00738 {
00739   if (m_hide) return;
00740   m_t << "\\fP";
00741 }
00742 
00743 void ManDocVisitor::visitPre(DocSecRefItem *)
00744 {
00745   if (m_hide) return;
00746   QCString ws;
00747   ws.fill(' ',m_indent-2);
00748   if (!m_firstCol) m_t << endl;
00749   m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << endl;
00750   m_firstCol=TRUE;
00751 }
00752 
00753 void ManDocVisitor::visitPost(DocSecRefItem *) 
00754 {
00755   if (m_hide) return;
00756   m_t << endl;
00757   m_firstCol=TRUE;
00758 }
00759 
00760 void ManDocVisitor::visitPre(DocSecRefList *)
00761 {
00762   if (m_hide) return;
00763   m_indent+=2;
00764 }
00765 
00766 void ManDocVisitor::visitPost(DocSecRefList *) 
00767 {
00768   if (m_hide) return;
00769   m_indent-=2;
00770   if (!m_firstCol) m_t << endl;
00771   m_t << ".PP" << endl;
00772 }
00773 
00774 //void ManDocVisitor::visitPre(DocLanguage *l)
00775 //{
00776 //  QString langId = Config_getEnum("OUTPUT_LANGUAGE");
00777 //  if (l->id().lower()!=langId.lower())
00778 //  {
00779 //    pushEnabled();
00780 //    m_hide = TRUE;
00781 //  }
00782 //}
00783 //
00784 //void ManDocVisitor::visitPost(DocLanguage *l) 
00785 //{
00786 //  QString langId = Config_getEnum("OUTPUT_LANGUAGE");
00787 //  if (l->id().lower()!=langId.lower())
00788 //  {
00789 //    popEnabled();
00790 //  }
00791 //}
00792 
00793 void ManDocVisitor::visitPre(DocParamSect *s)
00794 {
00795   if (m_hide) return;
00796   if (!m_firstCol)
00797   { 
00798     m_t << endl;
00799     m_t << ".PP" << endl;
00800   }
00801   m_t << "\\fB";
00802   switch(s->type())
00803   {
00804     case DocParamSect::Param: 
00805       m_t << theTranslator->trParameters(); break;
00806     case DocParamSect::RetVal: 
00807       m_t << theTranslator->trReturnValues(); break;
00808     case DocParamSect::Exception: 
00809       m_t << theTranslator->trExceptions(); break;
00810     case DocParamSect::TemplateParam: 
00811       /* TODO: add this 
00812       m_t << theTranslator->trTemplateParam(); break;
00813       */
00814       m_t << "Template Parameters"; break;
00815     default:
00816       ASSERT(0);
00817   }
00818   m_t << ":\\fP" << endl;
00819   m_t << ".RS 4" << endl;
00820 }
00821 
00822 void ManDocVisitor::visitPost(DocParamSect *)
00823 {
00824   if (m_hide) return;
00825   if (!m_firstCol) m_t << endl;
00826   m_t << ".RE" << endl;
00827   m_t << ".PP" << endl;
00828   m_firstCol=TRUE;
00829 }
00830 
00831 void ManDocVisitor::visitPre(DocParamList *pl)
00832 {
00833   if (m_hide) return;
00834   m_t << "\\fI";
00835   //QStrListIterator li(pl->parameters());
00836   //const char *s;
00837   QListIterator<DocNode> li(pl->parameters());
00838   DocNode *param;
00839   bool first=TRUE;
00840   for (li.toFirst();(param=li.current());++li)
00841   {
00842     if (!first) m_t << ","; else first=FALSE;
00843     if (param->kind()==DocNode::Kind_Word)
00844     {
00845       visit((DocWord*)param); 
00846     }
00847     else if (param->kind()==DocNode::Kind_LinkedWord)
00848     {
00849       visit((DocLinkedWord*)param); 
00850     }
00851   }
00852   m_t << "\\fP ";
00853 }
00854 
00855 void ManDocVisitor::visitPost(DocParamList *pl)
00856 {
00857   if (m_hide) return;
00858   if (!pl->isLast())
00859   {
00860     if (!m_firstCol) m_t << endl;
00861     m_t << ".br" << endl;
00862   }
00863 }
00864 
00865 void ManDocVisitor::visitPre(DocXRefItem *x)
00866 {
00867   if (m_hide) return;
00868   if (!m_firstCol)
00869   { 
00870     m_t << endl;
00871     m_t << ".PP" << endl;
00872   }
00873   m_t << "\\fB";
00874   filter(x->title());
00875   m_t << "\\fP" << endl;
00876   m_t << ".RS 4" << endl;
00877 }
00878 
00879 void ManDocVisitor::visitPost(DocXRefItem *)
00880 {
00881   if (m_hide) return;
00882   if (!m_firstCol) m_t << endl;
00883   m_t << ".RE" << endl;
00884   m_t << ".PP" << endl;
00885   m_firstCol=TRUE;
00886 }
00887 
00888 void ManDocVisitor::visitPre(DocInternalRef *)
00889 {
00890   if (m_hide) return;
00891   m_t << "\\fB";
00892 }
00893 
00894 void ManDocVisitor::visitPost(DocInternalRef *) 
00895 {
00896   if (m_hide) return;
00897   m_t << "\\fP";
00898 }
00899 
00900 void ManDocVisitor::visitPre(DocCopy *)
00901 {
00902 }
00903 
00904 void ManDocVisitor::visitPost(DocCopy *)
00905 {
00906 }
00907 
00908 void ManDocVisitor::visitPre(DocText *)
00909 {
00910 }
00911 
00912 void ManDocVisitor::visitPost(DocText *)
00913 {
00914 }
00915 
00916 void ManDocVisitor::filter(const char *str)
00917 { 
00918   if (str)
00919   {
00920     const char *p=str;
00921     char c=0;
00922     while ((c=*p++)) 
00923     {
00924       switch(c)
00925       {
00926         case '\\': m_t << "\\\\"; break;
00927         case '"':  c = '\''; // fall through
00928         default: m_t << c; break;
00929       }
00930     }
00931   }
00932 }
00933 
00934 void ManDocVisitor::pushEnabled()
00935 {
00936   m_enabled.push(new bool(m_hide));
00937 }
00938 
00939 void ManDocVisitor::popEnabled()
00940 {
00941   bool *v=m_enabled.pop();
00942   ASSERT(v!=0);
00943   m_hide = *v;
00944   delete v;
00945 }
00946 



Generated on Mon Mar 31 10:58:40 2008 by  doxygen 1.5.1