summaryrefslogtreecommitdiffstats
path: root/src/mandocvisitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mandocvisitor.cpp')
-rw-r--r--src/mandocvisitor.cpp167
1 files changed, 79 insertions, 88 deletions
diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp
index fef857e..875cd14 100644
--- a/src/mandocvisitor.cpp
+++ b/src/mandocvisitor.cpp
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 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
+ * 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.
*
@@ -16,7 +13,7 @@
*
*/
-#include <qfileinfo.h>
+#include <qfileinfo.h>
#include "mandocvisitor.h"
#include "docparser.h"
@@ -33,7 +30,7 @@
#include "emoji.h"
ManDocVisitor::ManDocVisitor(FTextStream &t,CodeOutputInterface &ci,
- const char *langExt)
+ const char *langExt)
: DocVisitor(DocVisitor_Man), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(FALSE),
m_indent(0), m_langExt(langExt)
{
@@ -205,8 +202,7 @@ void ManDocVisitor::visit(DocVerbatim *s)
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
- Doxygen::parserManager->getCodeParser(lang)
- .parseCode(m_ci,s->context(),s->text(),
+ getCodeParser(lang).parseCode(m_ci,s->context(),s->text(),
langExt,
s->isExample(),s->exampleFile());
if (!m_firstCol) m_t << endl;
@@ -214,7 +210,7 @@ void ManDocVisitor::visit(DocVerbatim *s)
m_t << ".PP" << endl;
m_firstCol=TRUE;
break;
- case DocVerbatim::Verbatim:
+ case DocVerbatim::Verbatim:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
@@ -224,18 +220,18 @@ void ManDocVisitor::visit(DocVerbatim *s)
m_t << ".PP" << endl;
m_firstCol=TRUE;
break;
- case DocVerbatim::ManOnly:
- m_t << s->text();
+ case DocVerbatim::ManOnly:
+ m_t << s->text();
break;
- case DocVerbatim::HtmlOnly:
- case DocVerbatim::XmlOnly:
- case DocVerbatim::LatexOnly:
+ case DocVerbatim::HtmlOnly:
+ case DocVerbatim::XmlOnly:
+ case DocVerbatim::LatexOnly:
case DocVerbatim::RtfOnly:
case DocVerbatim::DocbookOnly:
- case DocVerbatim::Dot:
- case DocVerbatim::Msc:
- case DocVerbatim::PlantUML:
- /* nothing */
+ case DocVerbatim::Dot:
+ case DocVerbatim::Msc:
+ case DocVerbatim::PlantUML:
+ /* nothing */
break;
}
}
@@ -252,14 +248,13 @@ void ManDocVisitor::visit(DocInclude *inc)
switch(inc->type())
{
case DocInclude::IncWithLines:
- {
+ {
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -278,12 +273,11 @@ void ManDocVisitor::visit(DocInclude *inc)
m_firstCol=TRUE;
}
break;
- case DocInclude::Include:
+ case DocInclude::Include:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -311,7 +305,7 @@ void ManDocVisitor::visit(DocInclude *inc)
case DocInclude::ManInclude:
m_t << inc->text();
break;
- case DocInclude::VerbInclude:
+ case DocInclude::VerbInclude:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
@@ -325,8 +319,7 @@ void ManDocVisitor::visit(DocInclude *inc)
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -345,13 +338,12 @@ void ManDocVisitor::visit(DocInclude *inc)
m_t << ".nf" << endl;
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
inc->isExample(),
- inc->exampleFile(),
+ inc->exampleFile(),
fd,
lineBlock(inc->text(),inc->blockId()),
-1, // endLine
@@ -366,8 +358,8 @@ void ManDocVisitor::visit(DocInclude *inc)
m_firstCol=TRUE;
}
break;
- case DocInclude::SnippetDoc:
- case DocInclude::IncludeDoc:
+ case DocInclude::SnippetDoc:
+ case DocInclude::IncludeDoc:
err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
"Please create a bug report\n",__FILE__);
break;
@@ -381,7 +373,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
SrcLangExt langExt = getLanguageFromFileName(locLangExt);
//printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
// op->type(),op->isFirst(),op->isLast(),op->text().data());
- if (op->isFirst())
+ if (op->isFirst())
{
if (!m_hide)
{
@@ -392,10 +384,10 @@ void ManDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide = TRUE;
}
- if (op->type()!=DocIncOperator::Skip)
+ if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
- if (!m_hide)
+ if (!m_hide)
{
FileDef *fd = 0;
if (!op->includeFileName().isEmpty())
@@ -404,8 +396,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(m_ci,op->context(),op->text(),langExt,
+ getCodeParser(locLangExt).parseCode(m_ci,op->context(),op->text(),langExt,
op->isExample(),op->exampleFile(),
fd, // fileDef
op->line(), // startLine
@@ -419,7 +410,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide=TRUE;
}
- if (op->isLast())
+ if (op->isLast())
{
popEnabled();
if (!m_hide)
@@ -484,7 +475,7 @@ void ManDocVisitor::visitPre(DocAutoListItem *li)
QCString ws;
ws.fill(' ',m_indent-2);
if (!m_firstCol) m_t << endl;
- m_t << ".IP \"" << ws;
+ m_t << ".IP \"" << ws;
if (((DocAutoList *)li->parent())->isEnumList())
{
m_t << li->itemNumber() << ".\" " << m_indent+2;
@@ -497,14 +488,14 @@ void ManDocVisitor::visitPre(DocAutoListItem *li)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocAutoListItem *)
+void ManDocVisitor::visitPost(DocAutoListItem *)
{
if (m_hide) return;
m_t << endl;
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPre(DocPara *)
+void ManDocVisitor::visitPre(DocPara *)
{
}
@@ -515,7 +506,7 @@ void ManDocVisitor::visitPost(DocPara *p)
!(p->parent() && // and for parameter sections
p->parent()->kind()==DocNode::Kind_ParamSect
)
- )
+ )
{
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
@@ -535,28 +526,28 @@ void ManDocVisitor::visitPre(DocSimpleSect *s)
{
if (m_hide) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
m_t << "\\fB";
switch(s->type())
{
- case DocSimpleSect::See:
+ case DocSimpleSect::See:
m_t << theTranslator->trSeeAlso(); break;
- case DocSimpleSect::Return:
+ case DocSimpleSect::Return:
m_t << theTranslator->trReturns(); break;
- case DocSimpleSect::Author:
+ case DocSimpleSect::Author:
m_t << theTranslator->trAuthor(TRUE,TRUE); break;
- case DocSimpleSect::Authors:
+ case DocSimpleSect::Authors:
m_t << theTranslator->trAuthor(TRUE,FALSE); break;
- case DocSimpleSect::Version:
+ case DocSimpleSect::Version:
m_t << theTranslator->trVersion(); break;
- case DocSimpleSect::Since:
+ case DocSimpleSect::Since:
m_t << theTranslator->trSince(); break;
- case DocSimpleSect::Date:
+ case DocSimpleSect::Date:
m_t << theTranslator->trDate(); break;
- case DocSimpleSect::Note:
+ case DocSimpleSect::Note:
m_t << theTranslator->trNote(); break;
case DocSimpleSect::Warning:
m_t << theTranslator->trWarning(); break;
@@ -630,7 +621,7 @@ void ManDocVisitor::visitPre(DocSimpleListItem *)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocSimpleListItem *)
+void ManDocVisitor::visitPost(DocSimpleListItem *)
{
if (m_hide) return;
m_t << endl;
@@ -649,7 +640,7 @@ void ManDocVisitor::visitPre(DocSection *s)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocSection *)
+void ManDocVisitor::visitPost(DocSection *)
{
}
@@ -661,7 +652,7 @@ void ManDocVisitor::visitPre(DocHtmlList *)
m_t << ".PD 0" << endl;
}
-void ManDocVisitor::visitPost(DocHtmlList *)
+void ManDocVisitor::visitPost(DocHtmlList *)
{
if (m_hide) return;
m_indent-=2;
@@ -675,7 +666,7 @@ void ManDocVisitor::visitPre(DocHtmlListItem *li)
QCString ws;
ws.fill(' ',m_indent-2);
if (!m_firstCol) m_t << endl;
- m_t << ".IP \"" << ws;
+ m_t << ".IP \"" << ws;
if (((DocHtmlList *)li->parent())->type()==DocHtmlList::Ordered)
{
m_t << li->itemNumber() << ".\" " << m_indent+2;
@@ -688,7 +679,7 @@ void ManDocVisitor::visitPre(DocHtmlListItem *li)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocHtmlListItem *)
+void ManDocVisitor::visitPost(DocHtmlListItem *)
{
if (m_hide) return;
m_t << endl;
@@ -703,7 +694,7 @@ void ManDocVisitor::visitPost(DocHtmlListItem *)
// m_insidePre=TRUE;
//}
//
-//void ManDocVisitor::visitPost(DocHtmlPre *)
+//void ManDocVisitor::visitPost(DocHtmlPre *)
//{
// m_insidePre=FALSE;
// if (!m_firstCol) m_t << endl;
@@ -716,7 +707,7 @@ void ManDocVisitor::visitPre(DocHtmlDescList *)
{
}
-void ManDocVisitor::visitPost(DocHtmlDescList *)
+void ManDocVisitor::visitPost(DocHtmlDescList *)
{
if (m_hide) return;
if (!m_firstCol) m_t << endl;
@@ -732,7 +723,7 @@ void ManDocVisitor::visitPre(DocHtmlDescTitle *)
m_firstCol=FALSE;
}
-void ManDocVisitor::visitPost(DocHtmlDescTitle *)
+void ManDocVisitor::visitPost(DocHtmlDescTitle *)
{
if (m_hide) return;
m_t << "\\fP\" 1c" << endl;
@@ -743,7 +734,7 @@ void ManDocVisitor::visitPre(DocHtmlDescData *)
{
}
-void ManDocVisitor::visitPost(DocHtmlDescData *)
+void ManDocVisitor::visitPost(DocHtmlDescData *)
{
}
@@ -751,7 +742,7 @@ void ManDocVisitor::visitPre(DocHtmlTable *)
{
}
-void ManDocVisitor::visitPost(DocHtmlTable *)
+void ManDocVisitor::visitPost(DocHtmlTable *)
{
}
@@ -759,7 +750,7 @@ void ManDocVisitor::visitPre(DocHtmlCaption *)
{
}
-void ManDocVisitor::visitPost(DocHtmlCaption *)
+void ManDocVisitor::visitPost(DocHtmlCaption *)
{
}
@@ -767,7 +758,7 @@ void ManDocVisitor::visitPre(DocHtmlRow *)
{
}
-void ManDocVisitor::visitPost(DocHtmlRow *)
+void ManDocVisitor::visitPost(DocHtmlRow *)
{
}
@@ -775,7 +766,7 @@ void ManDocVisitor::visitPre(DocHtmlCell *)
{
}
-void ManDocVisitor::visitPost(DocHtmlCell *)
+void ManDocVisitor::visitPost(DocHtmlCell *)
{
}
@@ -788,7 +779,7 @@ void ManDocVisitor::visitPre(DocInternal *)
//m_t << ".RS 4" << endl;
}
-void ManDocVisitor::visitPost(DocInternal *)
+void ManDocVisitor::visitPost(DocInternal *)
{
if (m_hide) return;
//if (!m_firstCol) m_t << endl;
@@ -803,7 +794,7 @@ void ManDocVisitor::visitPre(DocHRef *)
m_t << "\\fC";
}
-void ManDocVisitor::visitPost(DocHRef *)
+void ManDocVisitor::visitPost(DocHRef *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -817,7 +808,7 @@ void ManDocVisitor::visitPre(DocHtmlHeader *header)
m_t << " \"";
}
-void ManDocVisitor::visitPost(DocHtmlHeader *header)
+void ManDocVisitor::visitPost(DocHtmlHeader *header)
{
if (m_hide) return;
m_t << "\"" << endl;
@@ -829,7 +820,7 @@ void ManDocVisitor::visitPre(DocImage *)
{
}
-void ManDocVisitor::visitPost(DocImage *)
+void ManDocVisitor::visitPost(DocImage *)
{
}
@@ -837,14 +828,14 @@ void ManDocVisitor::visitPre(DocDotFile *)
{
}
-void ManDocVisitor::visitPost(DocDotFile *)
+void ManDocVisitor::visitPost(DocDotFile *)
{
}
void ManDocVisitor::visitPre(DocMscFile *)
{
}
-void ManDocVisitor::visitPost(DocMscFile *)
+void ManDocVisitor::visitPost(DocMscFile *)
{
}
@@ -862,7 +853,7 @@ void ManDocVisitor::visitPre(DocLink *)
m_t << "\\fB";
}
-void ManDocVisitor::visitPost(DocLink *)
+void ManDocVisitor::visitPost(DocLink *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -875,7 +866,7 @@ void ManDocVisitor::visitPre(DocRef *ref)
if (!ref->hasLinkText()) filter(ref->targetTitle());
}
-void ManDocVisitor::visitPost(DocRef *)
+void ManDocVisitor::visitPost(DocRef *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -891,7 +882,7 @@ void ManDocVisitor::visitPre(DocSecRefItem *)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocSecRefItem *)
+void ManDocVisitor::visitPost(DocSecRefItem *)
{
if (m_hide) return;
m_t << endl;
@@ -904,7 +895,7 @@ void ManDocVisitor::visitPre(DocSecRefList *)
m_indent+=2;
}
-void ManDocVisitor::visitPost(DocSecRefList *)
+void ManDocVisitor::visitPost(DocSecRefList *)
{
if (m_hide) return;
m_indent-=2;
@@ -916,20 +907,20 @@ void ManDocVisitor::visitPre(DocParamSect *s)
{
if (m_hide) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
m_t << "\\fB";
switch(s->type())
{
- case DocParamSect::Param:
+ case DocParamSect::Param:
m_t << theTranslator->trParameters(); break;
- case DocParamSect::RetVal:
+ case DocParamSect::RetVal:
m_t << theTranslator->trReturnValues(); break;
- case DocParamSect::Exception:
+ case DocParamSect::Exception:
m_t << theTranslator->trExceptions(); break;
- case DocParamSect::TemplateParam:
+ case DocParamSect::TemplateParam:
m_t << theTranslator->trTemplateParameters(); break;
default:
ASSERT(0);
@@ -961,11 +952,11 @@ void ManDocVisitor::visitPre(DocParamList *pl)
if (!first) m_t << ","; else first=FALSE;
if (param->kind()==DocNode::Kind_Word)
{
- visit((DocWord*)param);
+ visit((DocWord*)param);
}
else if (param->kind()==DocNode::Kind_LinkedWord)
{
- visit((DocLinkedWord*)param);
+ visit((DocLinkedWord*)param);
}
}
m_t << "\\fP ";
@@ -986,7 +977,7 @@ void ManDocVisitor::visitPre(DocXRefItem *x)
if (m_hide) return;
if (x->title().isEmpty()) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
@@ -1012,7 +1003,7 @@ void ManDocVisitor::visitPre(DocInternalRef *)
m_t << "\\fB";
}
-void ManDocVisitor::visitPost(DocInternalRef *)
+void ManDocVisitor::visitPost(DocInternalRef *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -1030,7 +1021,7 @@ void ManDocVisitor::visitPre(DocHtmlBlockQuote *)
{
if (m_hide) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
@@ -1064,12 +1055,12 @@ void ManDocVisitor::visitPost(DocParBlock *)
void ManDocVisitor::filter(const char *str)
-{
+{
if (str)
{
const char *p=str;
char c=0;
- while ((c=*p++))
+ while ((c=*p++))
{
switch(c)
{