/****************************************************************************** * * * * * Copyright (C) 1997-2012 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ #include #include "docbookvisitor.h" #include "docparser.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "docbookgen.h" #include "dot.h" #include "message.h" #include "util.h" #include "parserintf.h" #include "filename.h" #include "config.h" #include "filedef.h" #include "msc.h" DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) { } //-------------------------------------- // visitor functions for leaf nodes //-------------------------------------- void DocbookDocVisitor::visit(DocWord *w) { if (m_hide) return; filter(w->word()); } void DocbookDocVisitor::visit(DocLinkedWord *w) { if (m_hide) return; startLink(w->file(),w->anchor()); filter(w->word()); endLink(); } void DocbookDocVisitor::visit(DocWhiteSpace *w) { if (m_hide) return; if (m_insidePre) { m_t << w->chars(); } else { m_t << " "; } } void DocbookDocVisitor::visit(DocSymbol *s) { if (m_hide) return; switch(s->symbol()) { case DocSymbol::BSlash: m_t << "\\"; break; case DocSymbol::At: m_t << "@"; break; case DocSymbol::Less: m_t << "<"; break; case DocSymbol::Greater: m_t << ">"; break; case DocSymbol::Amp: m_t << "&"; break; case DocSymbol::Dollar: m_t << "$"; break; case DocSymbol::Hash: m_t << "#"; break; case DocSymbol::DoubleColon: m_t << "::"; break; case DocSymbol::Percent: m_t << "%"; break; case DocSymbol::Copy: m_t << "©"; break; case DocSymbol::Tm: m_t << "™"; break; case DocSymbol::Reg: m_t << "®"; break; case DocSymbol::Apos: m_t << "'"; break; case DocSymbol::Quot: m_t << """; break; case DocSymbol::Lsquo: m_t << "‘"; break; case DocSymbol::Rsquo: m_t << "’"; break; case DocSymbol::Ldquo: m_t << "“"; break; case DocSymbol::Rdquo: m_t << "”"; break; case DocSymbol::Ndash: m_t << "–"; break; case DocSymbol::Mdash: m_t << "—"; break; case DocSymbol::Uml: m_t << "¨"; break; case DocSymbol::Acute: m_t << "´"; break; case DocSymbol::Grave: m_t << "À"; break; case DocSymbol::Circ: m_t << "ˆ"; break; case DocSymbol::Tilde: m_t << "˜"; break; case DocSymbol::Szlig: m_t << "ß"; break; case DocSymbol::Cedil: m_t << "¸"; break; case DocSymbol::Ring: m_t << "Å"; break; case DocSymbol::Slash: m_t << "Ø"; break; case DocSymbol::Nbsp: m_t << " "; break; case DocSymbol::Aelig: m_t << "æ"; break; case DocSymbol::AElig: m_t << "Æ"; break; case DocSymbol::GrkGamma: m_t << "Γ"; break; case DocSymbol::GrkDelta: m_t << "Δ"; break; case DocSymbol::GrkTheta: m_t << "Θ"; break; case DocSymbol::GrkLambda: m_t << "Λ"; break; case DocSymbol::GrkXi: m_t << "Ξ"; break; case DocSymbol::GrkPi: m_t << "Π"; break; case DocSymbol::GrkSigma: m_t << "Σ"; break; case DocSymbol::GrkUpsilon: m_t << "Υ"; break; case DocSymbol::GrkPhi: m_t << "Φ"; break; case DocSymbol::GrkPsi: m_t << "Ψ"; break; case DocSymbol::GrkOmega: m_t << "Ω"; break; case DocSymbol::Grkalpha: m_t << "α"; break; case DocSymbol::Grkbeta: m_t << "β"; break; case DocSymbol::Grkgamma: m_t << "γ"; break; case DocSymbol::Grkdelta: m_t << "δ"; break; case DocSymbol::Grkepsilon: m_t << "ε"; break; case DocSymbol::Grkzeta: m_t << "ζ"; break; case DocSymbol::Grketa: m_t << "η"; break; case DocSymbol::Grktheta: m_t << "θ"; break; case DocSymbol::Grkiota: m_t << "ι"; break; case DocSymbol::Grkkappa: m_t << "κ"; break; case DocSymbol::Grklambda: m_t << "λ"; break; case DocSymbol::Grkmu: m_t << "μ"; break; case DocSymbol::Grknu: m_t << "ν"; break; case DocSymbol::Grkxi: m_t << "ξ"; break; case DocSymbol::Grkpi: m_t << "π"; break; case DocSymbol::Grkrho: m_t << "ρ"; break; case DocSymbol::Grksigma: m_t << "σ"; break; case DocSymbol::Grktau: m_t << "τ"; break; case DocSymbol::Grkupsilon: m_t << "υ"; break; case DocSymbol::Grkphi: m_t << "φ"; break; case DocSymbol::Grkchi: m_t << "χ"; break; case DocSymbol::Grkpsi: m_t << "ψ"; break; case DocSymbol::Grkomega: m_t << "ω"; break; case DocSymbol::Grkvarsigma: m_t << "ς"; break; case DocSymbol::Section: m_t << ""; break; case DocSymbol::Degree: m_t << "°"; break; case DocSymbol::Prime: m_t << "′"; break; case DocSymbol::DoublePrime: m_t << "″"; break; case DocSymbol::Infinity: m_t << "∞"; break; case DocSymbol::EmptySet: m_t << "∅"; break; case DocSymbol::PlusMinus: m_t << "±"; break; case DocSymbol::Times: m_t << "×"; break; case DocSymbol::Minus: m_t << "−"; break; case DocSymbol::CenterDot: m_t << "⋅"; break; case DocSymbol::Partial: m_t << "∂"; break; case DocSymbol::Nabla: m_t << "∇"; break; case DocSymbol::SquareRoot: m_t << "√"; break; case DocSymbol::Perpendicular: m_t << "⊥"; break; case DocSymbol::Sum: m_t << "∑"; break; case DocSymbol::Integral: m_t << "∫"; break; case DocSymbol::Product: m_t << "∏"; break; case DocSymbol::Similar: m_t << "∼"; break; case DocSymbol::Approx: m_t << "≈"; break; case DocSymbol::NotEqual: m_t << "≠"; break; case DocSymbol::Equivalent: m_t << "≡"; break; case DocSymbol::Proportional: m_t << "∝"; break; case DocSymbol::LessEqual: m_t << "≤"; break; case DocSymbol::GreaterEqual: m_t << "≥"; break; case DocSymbol::LeftArrow: m_t << "←"; break; case DocSymbol::RightArrow: m_t << "→"; break; case DocSymbol::SetIn: m_t << "∈"; break; case DocSymbol::SetNotIn: m_t << "∉"; break; case DocSymbol::LeftCeil: m_t << "⌈"; break; case DocSymbol::RightCeil: m_t << "⌉"; break; case DocSymbol::LeftFloor: m_t << "⌊"; break; case DocSymbol::RightFloor: m_t << "⌋"; break; default: err("unknown symbol found\n"); } } void DocbookDocVisitor::visit(DocURL *u) { if (m_hide) return; m_t << "isEmail()) m_t << "mailto:"; filter(u->url()); m_t << "\">"; filter(u->url()); m_t << ""; } void DocbookDocVisitor::visit(DocLineBreak *) { if (m_hide) return; m_t << endl << "\n" << endl; } void DocbookDocVisitor::visit(DocHorRuler *) { if (m_hide) return; m_t << "\n"; m_t << "\n"; } void DocbookDocVisitor::visit(DocStyleChange *s) { if (m_hide) return; switch (s->style()) { case DocStyleChange::Bold: if (s->enable()) m_t << ""; else m_t << ""; break; case DocStyleChange::Italic: if (s->enable()) m_t << ""; else m_t << ""; break; case DocStyleChange::Code: if (s->enable()) m_t << ""; else m_t << ""; break; case DocStyleChange::Subscript: if (s->enable()) m_t << ""; else m_t << ""; break; case DocStyleChange::Superscript: if (s->enable()) m_t << ""; else m_t << ""; break; case DocStyleChange::Center: if (s->enable()) m_t << ""; else m_t << ""; break; case DocStyleChange::Preformatted: if (s->enable()) { m_t << ""; m_insidePre=TRUE; } else { m_t << ""; m_insidePre=FALSE; } break; /* There is no equivalent Docbook tag for rendering Small text */ case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break; /* HTML only */ case DocStyleChange::Div: /* HTML only */ break; case DocStyleChange::Span: /* HTML only */ break; } } void DocbookDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(m_langExt); switch(s->type()) { case DocVerbatim::Code: // fall though m_t << ""; Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); m_t << ""; break; case DocVerbatim::Verbatim: m_t << ""; filter(s->text()); m_t << ""; break; case DocVerbatim::HtmlOnly: break; case DocVerbatim::RtfOnly: break; case DocVerbatim::ManOnly: break; case DocVerbatim::LatexOnly: break; case DocVerbatim::XmlOnly: break; case DocVerbatim::DocbookOnly: break; m_t << s->text(); break; case DocVerbatim::Dot: { static int dotindex = 1; QCString baseName(4096); QCString stext = s->text(); m_t << "" << endl; baseName.sprintf("%s%d", (Config_getString("DOCBOOK_OUTPUT")+"/inline_dotgraph_").data(), dotindex++ ); QFile file(baseName+".dot"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } file.writeBlock( stext, stext.length() ); file.close(); m_t << "
" << endl; m_t << " " << endl; m_t << " " << endl; m_t << " " << endl; writeDotFile(baseName); m_t << " " << endl; m_t << " " << endl; m_t << "
" << endl; m_t << "
" << endl; } break; case DocVerbatim::Msc: static int mscindex = 1; QCString baseName(4096); QCString stext = s->text(); m_t << "" << endl; baseName.sprintf("%s%d", (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(), mscindex++ ); QFile file(baseName+".msc"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } QCString text = "msc {"; text+=stext; text+="}"; file.writeBlock( text, text.length() ); file.close(); m_t << "
" << endl; m_t << " " << endl; m_t << " " << endl; m_t << " " << endl; writeMscFile(baseName); m_t << " " << endl; m_t << " " << endl; m_t << "
" << endl; m_t << "
" << endl; break; } } void DocbookDocVisitor::visit(DocAnchor *anc) { if (m_hide) return; m_t << "file() << "_1" << anc->anchor() << "\"/>"; } void DocbookDocVisitor::visit(DocInclude *inc) { if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) { case DocInclude::IncWithLines: { m_t << ""; QFileInfo cfi( inc->file() ); FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), inc->exampleFile(), &fd); m_t << ""; } break; case DocInclude::Include: m_t << ""; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), inc->exampleFile()); m_t << ""; break; case DocInclude::DontInclude: break; case DocInclude::HtmlInclude: break; case DocInclude::VerbInclude: m_t << ""; filter(inc->text()); m_t << ""; break; case DocInclude::Snippet: m_t << ""; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), langExt, inc->isExample(), inc->exampleFile() ); m_t << ""; break; } } void DocbookDocVisitor::visit(DocIncOperator *op) { if (op->isFirst()) { if (!m_hide) { m_t << ""; } pushEnabled(); m_hide = TRUE; } SrcLangExt langExt = getLanguageFromFileName(m_langExt); if (op->type()!=DocIncOperator::Skip) { popEnabled(); if (!m_hide) { Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,op->context(), op->text(),langExt,op->isExample(), op->exampleFile()); } pushEnabled(); m_hide=TRUE; } if (op->isLast()) { popEnabled(); if (!m_hide) m_t << ""; } else { if (!m_hide) m_t << endl; } } void DocbookDocVisitor::visit(DocFormula *f) { if (m_hide) return; m_t << "" << f->name() << ""; filter(f->text()); m_t << ""; } void DocbookDocVisitor::visit(DocIndexEntry *ie) { if (m_hide) return; m_t << "" << endl; filter(ie->entry()); m_t << "" << endl; } void DocbookDocVisitor::visit(DocSimpleSectSep *) { m_t << ""; } void DocbookDocVisitor::visit(DocCite *cite) { if (m_hide) return; if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor()); filter(cite->text()); if (!cite->file().isEmpty()) endLink(); } //-------------------------------------- // visitor functions for compound nodes //-------------------------------------- void DocbookDocVisitor::visitPre(DocAutoList *l) { if (m_hide) return; if (l->isEnumList()) { m_t << "\n"; } else { m_t << "\n"; } } void DocbookDocVisitor::visitPost(DocAutoList *l) { if (m_hide) return; if (l->isEnumList()) { m_t << "\n"; } else { m_t << "\n"; } } void DocbookDocVisitor::visitPre(DocAutoListItem *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocAutoListItem *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocPara *) { if (m_hide) return; m_t << endl; m_t << ""; } void DocbookDocVisitor::visitPost(DocPara *) { if (m_hide) return; m_t << ""; m_t << endl; } void DocbookDocVisitor::visitPre(DocRoot *) { //m_t << "

New parser:

\n"; } void DocbookDocVisitor::visitPost(DocRoot *) { //m_t << "

Old parser:

\n"; } void DocbookDocVisitor::visitPre(DocSimpleSect *s) { if (m_hide) return; switch(s->type()) { case DocSimpleSect::See: if (m_insidePre) { m_t << "" << theTranslator->trSeeAlso() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trSeeAlso()) << ": " << endl; } break; case DocSimpleSect::Return: if (m_insidePre) { m_t << "" << theTranslator->trReturns()<< ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trReturns()) << ": " << endl; } break; case DocSimpleSect::Author: if (m_insidePre) { m_t << "" << theTranslator->trAuthor(TRUE, TRUE) << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trAuthor(TRUE, TRUE)) << ": " << endl; } break; case DocSimpleSect::Authors: if (m_insidePre) { m_t << "" << theTranslator->trAuthor(TRUE, FALSE) << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trAuthor(TRUE, FALSE)) << ": " << endl; } break; case DocSimpleSect::Version: if (m_insidePre) { m_t << "" << theTranslator->trVersion() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trVersion()) << ": " << endl; } break; case DocSimpleSect::Since: if (m_insidePre) { m_t << "" << theTranslator->trSince() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trSince()) << ": " << endl; } break; case DocSimpleSect::Date: if (m_insidePre) { m_t << "" << theTranslator->trDate() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trDate()) << ": " << endl; } break; case DocSimpleSect::Note: if (m_insidePre) { m_t << "" << theTranslator->trNote() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trNote()) << ": " << endl; } break; case DocSimpleSect::Warning: if (m_insidePre) { m_t << "" << theTranslator->trWarning() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trWarning()) << ": " << endl; } break; case DocSimpleSect::Pre: if (m_insidePre) { m_t << "" << theTranslator->trPrecondition() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trPrecondition()) << ": " << endl; } break; case DocSimpleSect::Post: if (m_insidePre) { m_t << "" << theTranslator->trPostcondition() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trPostcondition()) << ": " << endl; } break; case DocSimpleSect::Copyright: if (m_insidePre) { m_t << "" << theTranslator->trCopyright() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trCopyright()) << ": " << endl; } break; case DocSimpleSect::Invar: if (m_insidePre) { m_t << "" << theTranslator->trInvariant() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trInvariant()) << ": " << endl; } break; case DocSimpleSect::Remark: if (m_insidePre) { m_t << "" << theTranslator->trRemarks() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trRemarks()) << ": " << endl; } break; case DocSimpleSect::Attention: if (m_insidePre) { m_t << "" << theTranslator->trAttention() << ": " << endl; } else { m_t << "" << convertToXML(theTranslator->trAttention()) << ": " << endl; } break; case DocSimpleSect::User: m_t << "" << endl; break; case DocSimpleSect::Rcs: m_t << "" << endl; break; case DocSimpleSect::Unknown: m_t << "" << endl; break; } } void DocbookDocVisitor::visitPost(DocSimpleSect *) { if (m_hide) return; m_t << "" << endl; } void DocbookDocVisitor::visitPre(DocTitle *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocTitle *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocSimpleList *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPost(DocSimpleList *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocSimpleListItem *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocSimpleListItem *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocSection *s) { if (m_hide) return; m_t << "
file(); if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor(); m_t << "\">" << endl; m_t << ""; filter(s->title()); m_t << "" << endl; } void DocbookDocVisitor::visitPost(DocSection *) { m_t << "
\n"; } void DocbookDocVisitor::visitPre(DocHtmlList *s) { if (m_hide) return; if (s->type()==DocHtmlList::Ordered) m_t << "\n"; else m_t << "\n"; } void DocbookDocVisitor::visitPost(DocHtmlList *s) { if (m_hide) return; if (s->type()==DocHtmlList::Ordered) m_t << "\n"; else m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlListItem *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPost(DocHtmlListItem *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlDescList *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPost(DocHtmlDescList *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlDescTitle *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlDescTitle *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlDescData *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlDescData *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlTable *t) { if (m_hide) return; m_t << "" << endl; m_t << " " << endl; m_t << " numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl; m_t << " " << endl; } void DocbookDocVisitor::visitPost(DocHtmlTable *) { if (m_hide) return; m_t << " " << endl; m_t << " " << endl; m_t << "
" << endl; } void DocbookDocVisitor::visitPre(DocHtmlRow *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPost(DocHtmlRow *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlCell *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlCell *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocHtmlCaption *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlCaption *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocInternal *) { if (m_hide) return; // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocInternal *) { if (m_hide) return; // TODO: to be implemented } void DocbookDocVisitor::visitPre(DocHRef *href) { if (m_hide) return; m_t << "url() << "\">"; } void DocbookDocVisitor::visitPost(DocHRef *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocHtmlHeader *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlHeader *) { if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocImage *img) { if (img->type()==DocImage::Latex) { if (m_hide) return; m_t << endl; m_t << "
" << endl; m_t << " "; } else { pushEnabled(); m_hide=TRUE; } } void DocbookDocVisitor::visitPost(DocImage *img) { if (img->type()==DocImage::Latex) { if (m_hide) return; QCString typevar; m_t << "" << endl; m_t << " " << endl; m_t << " " << endl; QCString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } m_t << " width().isEmpty()) { m_t << " width=\""; filter(img->width()); m_t << "\""; } else if (!img->height().isEmpty()) { m_t << " depth=\""; filter(img->height()); m_t << "\""; } m_t << " align=\"center\" fileref=\"" << baseName << "\">"; m_t << "" << endl; m_t << " " << endl; m_t << " " << endl; m_t << "
" << endl; // copy the image to the output dir QCString m_file; bool ambig; FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig); if (fd) { m_file=fd->absFilePath(); } QFile inImage(m_file); QFile outImage(Config_getString("DOCBOOK_OUTPUT")+"/"+baseName.data()); if (inImage.open(IO_ReadOnly)) { if (outImage.open(IO_WriteOnly)) { char *buffer = new char[inImage.size()]; inImage.readBlock(buffer,inImage.size()); outImage.writeBlock(buffer,inImage.size()); outImage.flush(); delete[] buffer; } } } else { popEnabled(); } } void DocbookDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; startDotFile(df->file(),df->width(),df->height(),df->hasCaption()); } void DocbookDocVisitor::visitPost(DocDotFile *df) { if (m_hide) return; endDotFile(df->hasCaption()); } void DocbookDocVisitor::visitPre(DocMscFile *df) { if (m_hide) return; startMscFile(df->file(),df->width(),df->height(),df->hasCaption()); } void DocbookDocVisitor::visitPost(DocMscFile *df) { if (m_hide) return; endMscFile(df->hasCaption()); } void DocbookDocVisitor::visitPre(DocLink *lnk) { if (m_hide) return; startLink(lnk->file(),lnk->anchor()); } void DocbookDocVisitor::visitPost(DocLink *) { if (m_hide) return; endLink(); } void DocbookDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; if (!ref->file().isEmpty()) startLink(ref->file(),ref->anchor()); if (!ref->hasLinkText()) filter(ref->targetTitle()); } void DocbookDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; if (!ref->file().isEmpty()) endLink(); } void DocbookDocVisitor::visitPre(DocSecRefItem *ref) { if (m_hide) return; m_t << "file() << "_1" << ref->anchor() << "\">"; } void DocbookDocVisitor::visitPost(DocSecRefItem *) { if (m_hide) return; m_t << "" << endl; } void DocbookDocVisitor::visitPre(DocSecRefList *) { if (m_hide) return; m_t << "" << endl; } void DocbookDocVisitor::visitPost(DocSecRefList *) { if (m_hide) return; m_t << "" << endl; } void DocbookDocVisitor::visitPre(DocParamSect *s) { if (m_hide) return; switch(s->type()) { case DocParamSect::Param: { m_t << endl; m_t << " " << endl; m_t << " " << endl; m_t << " <table frame=\"all\">" << endl; m_t << " <title>Parameters" << endl; m_t << " " << endl; m_t << " " << endl; break; } case DocParamSect::RetVal: { m_t << endl; m_t << " " << endl; m_t << " " << endl; m_t << " <table frame=\"all\">" << endl; m_t << " <title>Parameters" << endl; m_t << " " << endl; m_t << " " << endl; break; } case DocParamSect::Exception: m_t << "exception"; break; case DocParamSect::TemplateParam: m_t << "templateparam"; break; default: ASSERT(0); } } void DocbookDocVisitor::visitPost(DocParamSect *) { if (m_hide) return; m_t << " " << endl; m_t << " " << endl; m_t << " " << endl; m_t << " " << endl; m_t << " "; } void DocbookDocVisitor::visitPre(DocParamList *pl) { if (m_hide) return; QListIterator li(pl->parameters()); DocNode *param; m_t << " " << endl; if (!li.toFirst()) { m_t << " " << endl; } else { m_t << " "; int cnt = 0; for (li.toFirst();(param=li.current());++li) { if (cnt) { m_t << ", "; } if (param->kind()==DocNode::Kind_Word) { visit((DocWord*)param); } else if (param->kind()==DocNode::Kind_LinkedWord) { visit((DocLinkedWord*)param); } cnt++; } m_t << "" << endl; } m_t << " "; } void DocbookDocVisitor::visitPost(DocParamList *) { if (m_hide) return; m_t << "" << endl; m_t << " " << endl; } void DocbookDocVisitor::visitPre(DocXRefItem *x) { if (m_hide) return; m_t << "file() << "_1" << x->anchor(); m_t << "\">"; filter(x->title()); m_t << ""; m_t << " "; } void DocbookDocVisitor::visitPost(DocXRefItem *) { if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocInternalRef *ref) { if (m_hide) return; startLink(ref->file(),ref->anchor()); } void DocbookDocVisitor::visitPost(DocInternalRef *) { if (m_hide) return; endLink(); m_t << " "; } void DocbookDocVisitor::visitPre(DocCopy *) { if (m_hide) return; // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocCopy *) { if (m_hide) return; // TODO: to be implemented } void DocbookDocVisitor::visitPre(DocText *) { // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocText *) { // TODO: to be implemented } void DocbookDocVisitor::visitPre(DocHtmlBlockQuote *) { if (m_hide) return; m_t << "
"; } void DocbookDocVisitor::visitPost(DocHtmlBlockQuote *) { if (m_hide) return; m_t << "
"; } void DocbookDocVisitor::visitPre(DocVhdlFlow *) { // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocVhdlFlow *) { // TODO: to be implemented } void DocbookDocVisitor::filter(const char *str) { m_t << convertToXML(str); } void DocbookDocVisitor::startLink(const QCString &file,const QCString &anchor) { m_t << ""; } void DocbookDocVisitor::endLink() { m_t << ""; } void DocbookDocVisitor::pushEnabled() { m_enabled.push(new bool(m_hide)); } void DocbookDocVisitor::popEnabled() { bool *v=m_enabled.pop(); ASSERT(v!=0); m_hide = *v; delete v; } void DocbookDocVisitor::writeMscFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); m_t << " "; m_t << "" << endl; } void DocbookDocVisitor::startMscFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption ) { QCString baseName=fileName; int i; if ((i=baseName.findRev('/'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { baseName=baseName.left(i); } baseName.prepend("msc_"); QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP); m_t << "" << endl; m_t << "
" << endl; m_t << " " << endl; m_t << " " << endl; m_t << " " << endl; m_t << " "; m_t << "" << endl; m_t << " " << endl; if (hasCaption) { m_t << " " << endl; } } void DocbookDocVisitor::endMscFile(bool hasCaption) { if (m_hide) return; m_t << "endl"; if (hasCaption) { m_t << " " << endl; } m_t << " " << endl; m_t << "
" << endl; m_t << "
" << endl; } void DocbookDocVisitor::writeDotFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeDotGraphFromFile(baseName+".dot",outDir,shortName,BITMAP); m_t << " "; m_t << "" << endl; } void DocbookDocVisitor::startDotFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption ) { QCString baseName=fileName; int i; if ((i=baseName.findRev('/'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { baseName=baseName.left(i); } baseName.prepend("dot_"); QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeDotGraphFromFile(fileName,outDir,baseName,BITMAP); m_t << "" << endl; m_t << "
" << endl; m_t << " " << endl; m_t << " " << endl; m_t << " " << endl; m_t << " "; m_t << "" << endl; m_t << " " << endl; if (hasCaption) { m_t << " " << endl; } } void DocbookDocVisitor::endDotFile(bool hasCaption) { if (m_hide) return; m_t << "endl"; if (hasCaption) { m_t << " " << endl; } m_t << " " << endl; m_t << "
" << endl; m_t << "
" << endl; }