Doxygen
Loading...
Searching...
No Matches
ManDocVisitor Class Reference

Concrete visitor implementation for LaTeX output. More...

#include <src/mandocvisitor.h>

+ Inheritance diagram for ManDocVisitor:
+ Collaboration diagram for ManDocVisitor:

Classes

struct  ManListItemInfo
 

Public Member Functions

 ManDocVisitor (TextStream &t, OutputCodeList &ci, const QCString &langExt)
 
void operator() (const DocWord &)
 
void operator() (const DocLinkedWord &)
 
void operator() (const DocWhiteSpace &)
 
void operator() (const DocSymbol &)
 
void operator() (const DocEmoji &)
 
void operator() (const DocURL &)
 
void operator() (const DocLineBreak &)
 
void operator() (const DocHorRuler &)
 
void operator() (const DocStyleChange &)
 
void operator() (const DocVerbatim &)
 
void operator() (const DocAnchor &)
 
void operator() (const DocInclude &)
 
void operator() (const DocIncOperator &)
 
void operator() (const DocFormula &)
 
void operator() (const DocIndexEntry &)
 
void operator() (const DocSimpleSectSep &)
 
void operator() (const DocCite &)
 
void operator() (const DocSeparator &)
 
void operator() (const DocAutoList &)
 
void operator() (const DocAutoListItem &)
 
void operator() (const DocPara &)
 
void operator() (const DocRoot &)
 
void operator() (const DocSimpleSect &)
 
void operator() (const DocTitle &)
 
void operator() (const DocSimpleList &)
 
void operator() (const DocSimpleListItem &)
 
void operator() (const DocSection &s)
 
void operator() (const DocHtmlList &s)
 
void operator() (const DocHtmlListItem &)
 
void operator() (const DocHtmlDescList &)
 
void operator() (const DocHtmlDescTitle &)
 
void operator() (const DocHtmlDescData &)
 
void operator() (const DocHtmlTable &t)
 
void operator() (const DocHtmlCaption &)
 
void operator() (const DocHtmlRow &)
 
void operator() (const DocHtmlCell &)
 
void operator() (const DocInternal &)
 
void operator() (const DocHRef &)
 
void operator() (const DocHtmlSummary &)
 
void operator() (const DocHtmlDetails &)
 
void operator() (const DocHtmlHeader &)
 
void operator() (const DocImage &)
 
void operator() (const DocDotFile &)
 
void operator() (const DocMscFile &)
 
void operator() (const DocDiaFile &)
 
void operator() (const DocLink &lnk)
 
void operator() (const DocRef &ref)
 
void operator() (const DocSecRefItem &)
 
void operator() (const DocSecRefList &)
 
void operator() (const DocParamSect &)
 
void operator() (const DocParamList &)
 
void operator() (const DocXRefItem &)
 
void operator() (const DocInternalRef &)
 
void operator() (const DocText &)
 
void operator() (const DocHtmlBlockQuote &)
 
void operator() (const DocVhdlFlow &)
 
void operator() (const DocParBlock &)
 
- Public Member Functions inherited from DocVisitor
 DocVisitor ()
 
virtual ~DocVisitor ()
 
CodeParserInterfacegetCodeParser (const QCString &langExt)
 
void pushHidden (bool hide)
 
bool popHidden ()
 

Private Member Functions

template<class T >
void visitChildren (const T &t)
 
void filter (const QCString &str)
 

Private Attributes

TextStreamm_t
 
OutputCodeListm_ci
 
bool m_insidePre
 
bool m_hide
 
bool m_firstCol
 
int m_indent
 
QCString m_langExt
 
std::array< ManListItemInfo, maxIndentLevelsm_listItemInfo
 

Static Private Attributes

static const int maxIndentLevels = 13
 

Detailed Description

Concrete visitor implementation for LaTeX output.

Definition at line 33 of file mandocvisitor.h.

Constructor & Destructor Documentation

◆ ManDocVisitor()

ManDocVisitor::ManDocVisitor ( TextStream & t,
OutputCodeList & ci,
const QCString & langExt )

Definition at line 32 of file mandocvisitor.cpp.

35 m_indent(0), m_langExt(langExt)
36{
37}
TextStream & m_t
OutputCodeList & m_ci
QCString m_langExt
#define FALSE
Definition qcstring.h:34

Member Function Documentation

◆ filter()

void ManDocVisitor::filter ( const QCString & str)
private

Definition at line 978 of file mandocvisitor.cpp.

979{
980 if (!str.isEmpty())
981 {
982 const char *p=str.data();
983 char c=0;
984 while ((c=*p++))
985 {
986 switch(c)
987 {
988 case '.': m_t << "\\&."; break; // see bug652277
989 case '\\': m_t << "\\\\"; break;
990 case '"': c = '\''; // fall through
991 default: m_t << c; break;
992 }
993 }
994 }
995}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:143
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:152

References QCString::data(), QCString::isEmpty(), and m_t.

Referenced by operator()(), operator()(), operator()(), operator()(), operator()(), and operator()().

◆ operator()() [1/57]

void ManDocVisitor::operator() ( const DocAnchor & )

Definition at line 250 of file mandocvisitor.cpp.

251{
252 /* no support for anchors in man pages */
253}

◆ operator()() [2/57]

void ManDocVisitor::operator() ( const DocAutoList & l)

Definition at line 444 of file mandocvisitor.cpp.

445{
446 if (m_hide) return;
447 m_indent++;
448 visitChildren(l);
449 m_indent--;
450 m_t << ".PP\n";
451}
void visitChildren(const T &t)

References m_hide, m_indent, m_t, and visitChildren().

◆ operator()() [3/57]

void ManDocVisitor::operator() ( const DocAutoListItem & li)

Definition at line 453 of file mandocvisitor.cpp.

454{
455 if (m_hide) return;
456 QCString ws;
457 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
458 if (!m_firstCol) m_t << "\n";
459 m_t << ".IP \"" << ws;
460 const DocAutoList *list = std::get_if<DocAutoList>(li.parent());
461 if (list && list->isEnumList())
462 {
463 m_t << li.itemNumber() << ".\" " << (2*(m_indent+1));
464 }
465 else // bullet list
466 {
467 switch (li.itemNumber())
468 {
469 case DocAutoList::Unchecked: // unchecked
470 m_t << "[ ]\" " << (2*m_indent) + 2;
471 break;
472 case DocAutoList::Checked_x: // checked with x
473 m_t << "[x]\" " << (2*m_indent) + 2;
474 break;
475 case DocAutoList::Checked_X: // checked with X
476 m_t << "[X]\" " << (2*m_indent) + 2;
477 break;
478 default:
479 m_t << "\\(bu\" " << (2*m_indent);
480 break;
481 }
482 }
483 m_t << "\n";
485 visitChildren(li);
486 m_t << "\n";
488}
Node representing an auto List.
Definition docnode.h:543
bool isEnumList() const
Definition docnode.h:552
int itemNumber() const
Definition docnode.h:570
DocNodeVariant * parent()
Definition docnode.h:88
This is an alternative implementation of QCString.
Definition qcstring.h:94
void fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:173
#define TRUE
Definition qcstring.h:37

References DocAutoList::Checked_x, DocAutoList::Checked_X, QCString::fill(), DocAutoList::isEnumList(), DocAutoListItem::itemNumber(), m_firstCol, m_hide, m_indent, m_t, DocNode::parent(), TRUE, DocAutoList::Unchecked, and visitChildren().

◆ operator()() [4/57]

void ManDocVisitor::operator() ( const DocCite & cite)

Definition at line 423 of file mandocvisitor.cpp.

424{
425 if (m_hide) return;
426 m_t << "\\fB";
427 if (cite.file().isEmpty()) m_t << "[";
428 filter(cite.text());
429 if (cite.file().isEmpty()) m_t << "]";
430 m_t << "\\fP";
431}
QCString text() const
Definition docnode.h:250
QCString file() const
Definition docnode.h:246
void filter(const QCString &str)

References DocCite::file(), filter(), QCString::isEmpty(), m_hide, m_t, and DocCite::text().

◆ operator()() [5/57]

void ManDocVisitor::operator() ( const DocDiaFile & )

Definition at line 822 of file mandocvisitor.cpp.

823{
824}

◆ operator()() [6/57]

void ManDocVisitor::operator() ( const DocDotFile & )

Definition at line 814 of file mandocvisitor.cpp.

815{
816}

◆ operator()() [7/57]

void ManDocVisitor::operator() ( const DocEmoji & s)

Definition at line 90 of file mandocvisitor.cpp.

91{
92 if (m_hide) return;
93 const char *res = EmojiEntityMapper::instance().name(s.index());
94 if (res)
95 {
96 m_t << res;
97 }
98 else
99 {
100 m_t << s.name();
101 }
103}
int index() const
Definition docnode.h:324
QCString name() const
Definition docnode.h:323
const char * name(int index) const
Access routine to the name of the Emoji entity.
Definition emoji.cpp:1968
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1920

References FALSE, DocEmoji::index(), EmojiEntityMapper::instance(), m_firstCol, m_hide, m_t, DocEmoji::name(), and EmojiEntityMapper::name().

◆ operator()() [8/57]

void ManDocVisitor::operator() ( const DocFormula & f)

Definition at line 409 of file mandocvisitor.cpp.

410{
411 if (m_hide) return;
412 m_t << f.text();
413}
QCString text() const
Definition docnode.h:505

References m_hide, m_t, and DocFormula::text().

◆ operator()() [9/57]

void ManDocVisitor::operator() ( const DocHorRuler & )

Definition at line 119 of file mandocvisitor.cpp.

120{
121 if (m_hide) return;
122 if (!m_firstCol) m_t << "\n";
123 m_t << ".PP\n";
125}

References m_firstCol, m_hide, m_t, and TRUE.

◆ operator()() [10/57]

void ManDocVisitor::operator() ( const DocHRef & href)

Definition at line 758 of file mandocvisitor.cpp.

759{
760 if (m_hide) return;
761 m_t << "\\fR";
762 visitChildren(href);
763 m_t << "\\fP";
764}

References m_hide, m_t, and visitChildren().

◆ operator()() [11/57]

void ManDocVisitor::operator() ( const DocHtmlBlockQuote & q)

Definition at line 953 of file mandocvisitor.cpp.

954{
955 if (m_hide) return;
956 if (!m_firstCol)
957 {
958 m_t << "\n";
959 m_t << ".PP\n";
960 }
961 m_t << ".RS 4\n"; // TODO: add support for nested block quotes
962 visitChildren(q);
963 if (!m_firstCol) m_t << "\n";
964 m_t << ".RE\n";
965 m_t << ".PP\n";
967}

References m_firstCol, m_hide, m_t, TRUE, and visitChildren().

◆ operator()() [12/57]

void ManDocVisitor::operator() ( const DocHtmlCaption & c)

Definition at line 738 of file mandocvisitor.cpp.

739{
740 visitChildren(c);
741}

References visitChildren().

◆ operator()() [13/57]

void ManDocVisitor::operator() ( const DocHtmlCell & c)

Definition at line 748 of file mandocvisitor.cpp.

749{
750 visitChildren(c);
751}

References visitChildren().

◆ operator()() [14/57]

void ManDocVisitor::operator() ( const DocHtmlDescData & dd)

Definition at line 727 of file mandocvisitor.cpp.

728{
729 if (!m_firstCol) m_t << "\n.IP \"\" 1c\n";
730 visitChildren(dd);
731}

References m_firstCol, m_t, and visitChildren().

◆ operator()() [15/57]

void ManDocVisitor::operator() ( const DocHtmlDescList & dl)

Definition at line 707 of file mandocvisitor.cpp.

708{
709 if (m_hide) return;
710 visitChildren(dl);
711 if (!m_firstCol) m_t << "\n";
712 m_t << ".PP\n";
714}

References m_firstCol, m_hide, m_t, TRUE, and visitChildren().

◆ operator()() [16/57]

void ManDocVisitor::operator() ( const DocHtmlDescTitle & dt)

Definition at line 716 of file mandocvisitor.cpp.

717{
718 if (m_hide) return;
719 if (!m_firstCol) m_t << "\n";
720 m_t << ".IP \"\\fB";
722 visitChildren(dt);
723 m_t << "\\fP\" 1c\n";
725}

References FALSE, m_firstCol, m_hide, m_t, TRUE, and visitChildren().

◆ operator()() [17/57]

void ManDocVisitor::operator() ( const DocHtmlDetails & d)

Definition at line 773 of file mandocvisitor.cpp.

774{
775 if (m_hide) return;
776 if (!m_firstCol)
777 {
778 m_t << "\n";
779 m_t << ".PP\n";
780 }
781 auto summary = d.summary();
782 if (summary)
783 {
784 std::visit(*this,*summary);
785 m_t << ".PP\n";
786 m_t << ".RS 4\n";
787 }
788 visitChildren(d);
789 if (!m_firstCol) m_t << "\n";
790 if (summary)
791 {
792 m_t << ".RE\n";
793 }
794 m_t << ".PP\n";
796}
const DocNodeVariant * summary() const
Definition docnode.h:826

References m_firstCol, m_hide, m_t, DocHtmlDetails::summary(), TRUE, and visitChildren().

◆ operator()() [18/57]

void ManDocVisitor::operator() ( const DocHtmlHeader & header)

Definition at line 798 of file mandocvisitor.cpp.

799{
800 if (m_hide) return;
801 if (!m_firstCol) m_t << "\n";
802 if (header.level()==1) m_t << ".SH"; else m_t << ".SS";
803 m_t << " \"";
804 visitChildren(header);
805 m_t << "\"\n";
806 if (header.level()==1) m_t << ".PP\n";
808}
int level() const
Definition docnode.h:839

References DocHtmlHeader::level(), m_firstCol, m_hide, m_t, TRUE, and visitChildren().

◆ operator()() [19/57]

void ManDocVisitor::operator() ( const DocHtmlList & s)

Definition at line 623 of file mandocvisitor.cpp.

624{
625 if (m_hide) return;
626 m_indent++;
627 if (!m_firstCol) m_t << "\n";
628 m_t << ".PD 0\n";
629 m_firstCol=true;
630 int indent = std::min(m_indent,maxIndentLevels-1);
631 m_listItemInfo[indent].number = 1;
632 m_listItemInfo[indent].type = '1';
633 for (const auto &opt : l.attribs())
634 {
635 if (opt.name=="type")
636 {
637 m_listItemInfo[indent].type = opt.value[0];
638 }
639 if (opt.name=="start")
640 {
641 bool ok = false;
642 int val = opt.value.toInt(&ok);
643 if (ok) m_listItemInfo[indent].number = val;
644 }
645 }
646 visitChildren(l);
647 m_indent--;
648 if (!m_firstCol) m_t << "\n";
649 m_t << ".PP\n";
650}
std::array< ManListItemInfo, maxIndentLevels > m_listItemInfo
static const int maxIndentLevels

References DocHtmlList::attribs(), m_firstCol, m_hide, m_indent, m_listItemInfo, m_t, maxIndentLevels, and visitChildren().

◆ operator()() [20/57]

void ManDocVisitor::operator() ( const DocHtmlListItem & li)

Definition at line 652 of file mandocvisitor.cpp.

653{
654 if (m_hide) return;
655 QCString ws;
656 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
657 if (!m_firstCol) m_t << "\n";
658 m_t << ".IP \"" << ws;
659 const DocHtmlList *list = std::get_if<DocHtmlList>(li.parent());
660 if (list && list->type()==DocHtmlList::Ordered)
661 {
662 int indent = std::min(m_indent,maxIndentLevels-1);
663 for (const auto &opt : li.attribs())
664 {
665 if (opt.name=="value")
666 {
667 bool ok = false;
668 int val = opt.value.toInt(&ok);
669 if (ok) m_listItemInfo[indent].number = val;
670 }
671 }
672 switch (m_listItemInfo[indent].type)
673 {
674 case '1':
675 m_t << m_listItemInfo[indent].number;
676 break;
677 case 'a':
678 m_t << integerToAlpha(m_listItemInfo[indent].number,false);
679 break;
680 case 'A':
681 m_t << integerToAlpha(m_listItemInfo[indent].number);
682 break;
683 case 'i':
684 m_t << integerToRoman(m_listItemInfo[indent].number,false);
685 break;
686 case 'I':
687 m_t << integerToRoman(m_listItemInfo[indent].number);
688 break;
689 default:
690 m_t << m_listItemInfo[indent].number;
691 break;
692 }
693 m_t << ".\" " << ((m_indent+1)*2);
694 m_listItemInfo[indent].number++;
695 }
696 else // bullet list
697 {
698 m_t << "\\(bu\" " << (m_indent*2);
699 }
700 m_t << "\n";
702 visitChildren(li);
703 m_t << "\n";
705}
Node representing a Html list.
Definition docnode.h:962
Type type() const
Definition docnode.h:967
QCString integerToRoman(int n, bool upper)
Definition util.cpp:7048
QCString integerToAlpha(int n, bool upper)
Definition util.cpp:7032

References DocHtmlListItem::attribs(), QCString::fill(), integerToAlpha(), integerToRoman(), m_firstCol, m_hide, m_indent, m_listItemInfo, m_t, maxIndentLevels, DocHtmlList::Ordered, DocNode::parent(), TRUE, DocHtmlList::type(), and visitChildren().

◆ operator()() [21/57]

void ManDocVisitor::operator() ( const DocHtmlRow & r)

Definition at line 743 of file mandocvisitor.cpp.

744{
745 visitChildren(r);
746}

References visitChildren().

◆ operator()() [22/57]

void ManDocVisitor::operator() ( const DocHtmlSummary & s)

Definition at line 766 of file mandocvisitor.cpp.

767{
768 m_t << "\\fB";
769 visitChildren(s);
770 m_t << "\\fP\n.PP\n";
771}

References m_t, and visitChildren().

◆ operator()() [23/57]

void ManDocVisitor::operator() ( const DocHtmlTable & t)

Definition at line 733 of file mandocvisitor.cpp.

734{
735 visitChildren(t);
736}

References visitChildren().

◆ operator()() [24/57]

void ManDocVisitor::operator() ( const DocImage & )

Definition at line 810 of file mandocvisitor.cpp.

811{
812}

◆ operator()() [25/57]

void ManDocVisitor::operator() ( const DocInclude & inc)

Definition at line 255 of file mandocvisitor.cpp.

256{
257 if (m_hide) return;
259 switch(inc.type())
260 {
262 {
263 if (!m_firstCol) m_t << "\n";
264 m_t << ".PP\n";
265 m_t << ".nf\n";
266 FileInfo cfi( inc.file().str() );
267 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
269 inc.text(),
270 langExt,
271 inc.isExample(),
272 inc.exampleFile(),
273 fd.get(), // fileDef,
274 -1, // start line
275 -1, // end line
276 FALSE, // inline fragment
277 nullptr, // memberDef
278 TRUE
279 );
280 if (!m_firstCol) m_t << "\n";
281 m_t << ".fi\n";
282 m_t << ".PP\n";
284 }
285 break;
287 if (!m_firstCol) m_t << "\n";
288 m_t << ".PP\n";
289 m_t << ".nf\n";
291 inc.text(),
292 langExt,
293 inc.isExample(),
294 inc.exampleFile(),
295 nullptr, // fileDef
296 -1, // startLine
297 -1, // endLine
298 TRUE, // inlineFragment
299 nullptr, // memberDef
300 FALSE
301 );
302 if (!m_firstCol) m_t << "\n";
303 m_t << ".fi\n";
304 m_t << ".PP\n";
306 break;
314 break;
316 m_t << inc.text();
317 break;
319 if (!m_firstCol) m_t << "\n";
320 m_t << ".PP\n";
321 m_t << ".nf\n";
322 m_t << inc.text();
323 if (!m_firstCol) m_t << "\n";
324 m_t << ".fi\n";
325 m_t << ".PP\n";
327 break;
331 if (!m_firstCol) m_t << "\n";
332 m_t << ".PP\n";
333 m_t << ".nf\n";
335 inc.file(),
336 inc.blockId(),
337 inc.context(),
340 );
341 if (!m_firstCol) m_t << "\n";
342 m_t << ".fi\n";
343 m_t << ".PP\n";
345 break;
346 }
347}
void parseCodeFragment(OutputCodeList &codeOutList, const QCString &fileName, const QCString &blockId, const QCString &scopeName, bool showLineNumbers, bool trimLeft)
static CodeFragmentManager & instance()
virtual void parseCode(OutputCodeList &codeOutList, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE)=0
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
QCString blockId() const
Definition docnode.h:432
QCString extension() const
Definition docnode.h:428
@ LatexInclude
Definition docnode.h:416
@ SnippetTrimLeft
Definition docnode.h:419
@ SnippetWithLines
Definition docnode.h:417
@ DontIncWithLines
Definition docnode.h:418
@ IncWithLines
Definition docnode.h:417
@ HtmlInclude
Definition docnode.h:416
@ VerbInclude
Definition docnode.h:416
@ DontInclude
Definition docnode.h:416
@ DocbookInclude
Definition docnode.h:418
Type type() const
Definition docnode.h:429
QCString exampleFile() const
Definition docnode.h:434
QCString text() const
Definition docnode.h:430
QCString file() const
Definition docnode.h:427
bool isExample() const
Definition docnode.h:433
QCString context() const
Definition docnode.h:431
CodeParserInterface & getCodeParser(const QCString &langExt)
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
const std::string & str() const
Definition qcstring.h:517
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
Definition filedef.cpp:263
SrcLangExt
Language as given by extension.
Definition types.h:42
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5472

References DocInclude::blockId(), DocInclude::context(), createFileDef(), FileInfo::dirPath(), DocInclude::DocbookInclude, DocInclude::DontInclude, DocInclude::DontIncWithLines, DocInclude::exampleFile(), DocInclude::extension(), FALSE, DocInclude::file(), FileInfo::fileName(), DocVisitor::getCodeParser(), getLanguageFromFileName(), DocInclude::HtmlInclude, DocInclude::Include, DocInclude::IncWithLines, CodeFragmentManager::instance(), DocInclude::isExample(), DocInclude::LatexInclude, m_ci, m_firstCol, m_hide, m_t, DocInclude::ManInclude, CodeParserInterface::parseCode(), CodeFragmentManager::parseCodeFragment(), DocInclude::RtfInclude, DocInclude::Snippet, DocInclude::SnippetTrimLeft, DocInclude::SnippetWithLines, QCString::str(), DocInclude::text(), TRUE, DocInclude::type(), DocInclude::VerbInclude, and DocInclude::XmlInclude.

◆ operator()() [26/57]

void ManDocVisitor::operator() ( const DocIncOperator & op)

Definition at line 349 of file mandocvisitor.cpp.

350{
352 if (locLangExt.isEmpty()) locLangExt = m_langExt;
353 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
354 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
355 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
356 if (op.isFirst())
357 {
358 if (!m_hide)
359 {
360 if (!m_firstCol) m_t << "\n";
361 m_t << ".PP\n";
362 m_t << ".nf\n";
363 }
365 m_hide = TRUE;
366 }
367 if (op.type()!=DocIncOperator::Skip)
368 {
369 m_hide = popHidden();
370 if (!m_hide)
371 {
372 std::unique_ptr<FileDef> fd;
373 if (!op.includeFileName().isEmpty())
374 {
375 FileInfo cfi( op.includeFileName().str() );
376 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
377 }
378
379 getCodeParser(locLangExt).parseCode(m_ci,op.context(),op.text(),langExt,
380 op.isExample(),op.exampleFile(),
381 fd.get(), // fileDef
382 op.line(), // startLine
383 -1, // endLine
384 FALSE, // inline fragment
385 nullptr, // memberDef
386 op.showLineNo() // show line numbers
387 );
388 }
390 m_hide=TRUE;
391 }
392 if (op.isLast())
393 {
394 m_hide = popHidden();
395 if (!m_hide)
396 {
397 if (!m_firstCol) m_t << "\n";
398 m_t << ".fi\n";
399 m_t << ".PP\n";
401 }
402 }
403 else
404 {
405 if (!m_hide) m_t << "\n";
406 }
407}
bool isLast() const
Definition docnode.h:477
QCString includeFileName() const
Definition docnode.h:482
QCString text() const
Definition docnode.h:473
QCString context() const
Definition docnode.h:475
QCString exampleFile() const
Definition docnode.h:481
int line() const
Definition docnode.h:471
Type type() const
Definition docnode.h:459
bool isFirst() const
Definition docnode.h:476
bool showLineNo() const
Definition docnode.h:472
bool isExample() const
Definition docnode.h:480
void pushHidden(bool hide)
bool popHidden()
QCString getFileNameExtension(const QCString &fn)
Definition util.cpp:5514

References DocIncOperator::context(), createFileDef(), FileInfo::dirPath(), DocIncOperator::exampleFile(), FALSE, FileInfo::fileName(), DocVisitor::getCodeParser(), getFileNameExtension(), getLanguageFromFileName(), DocIncOperator::includeFileName(), QCString::isEmpty(), DocIncOperator::isExample(), DocIncOperator::isFirst(), DocIncOperator::isLast(), DocIncOperator::line(), m_ci, m_firstCol, m_hide, m_langExt, m_t, CodeParserInterface::parseCode(), DocVisitor::popHidden(), DocVisitor::pushHidden(), DocIncOperator::showLineNo(), DocIncOperator::Skip, QCString::str(), DocIncOperator::text(), TRUE, and DocIncOperator::type().

◆ operator()() [27/57]

void ManDocVisitor::operator() ( const DocIndexEntry & )

Definition at line 415 of file mandocvisitor.cpp.

416{
417}

◆ operator()() [28/57]

void ManDocVisitor::operator() ( const DocInternal & i)

Definition at line 753 of file mandocvisitor.cpp.

754{
755 visitChildren(i);
756}

References visitChildren().

◆ operator()() [29/57]

void ManDocVisitor::operator() ( const DocInternalRef & ref)

Definition at line 940 of file mandocvisitor.cpp.

941{
942 if (m_hide) return;
943 m_t << "\\fB";
944 visitChildren(ref);
945 m_t << "\\fP";
946}

References m_hide, m_t, and visitChildren().

◆ operator()() [30/57]

void ManDocVisitor::operator() ( const DocLineBreak & )

Definition at line 112 of file mandocvisitor.cpp.

113{
114 if (m_hide) return;
115 m_t << "\n.br\n";
117}

References m_firstCol, m_hide, m_t, and TRUE.

◆ operator()() [31/57]

void ManDocVisitor::operator() ( const DocLink & lnk)

Definition at line 826 of file mandocvisitor.cpp.

827{
828 if (m_hide) return;
829 m_t << "\\fB";
830 visitChildren(dl);
831 m_t << "\\fP";
832}

References m_hide, m_t, and visitChildren().

◆ operator()() [32/57]

void ManDocVisitor::operator() ( const DocLinkedWord & w)

Definition at line 50 of file mandocvisitor.cpp.

51{
52 if (m_hide) return;
53 m_t << "\\fB";
54 filter(w.word());
55 m_t << "\\fP";
57}
QCString word() const
Definition docnode.h:168

References FALSE, filter(), m_firstCol, m_hide, m_t, and DocLinkedWord::word().

◆ operator()() [33/57]

void ManDocVisitor::operator() ( const DocMscFile & )

Definition at line 818 of file mandocvisitor.cpp.

819{
820}

◆ operator()() [34/57]

void ManDocVisitor::operator() ( const DocPara & p)

Definition at line 490 of file mandocvisitor.cpp.

491{
492 if (m_hide) return;
493 visitChildren(p);
494 if (!p.isLast() && // omit <p> for last paragraph
495 !(p.parent() && // and for parameter sections
496 std::get_if<DocParamSect>(p.parent())
497 )
498 )
499 {
500 if (!m_firstCol) m_t << "\n";
501 m_t << ".PP\n";
503 }
504}
bool isLast() const
Definition docnode.h:1050

References DocPara::isLast(), m_firstCol, m_hide, m_t, DocNode::parent(), TRUE, and visitChildren().

◆ operator()() [35/57]

void ManDocVisitor::operator() ( const DocParamList & pl)

Definition at line 897 of file mandocvisitor.cpp.

898{
899 if (m_hide) return;
900 m_t << "\\fI";
901 bool first=TRUE;
902 for (const auto &param : pl.parameters())
903 {
904 if (!first) m_t << ","; else first=FALSE;
905 std::visit(*this,param);
906 }
907 m_t << "\\fP ";
908 for (const auto &par : pl.paragraphs())
909 {
910 std::visit(*this,par);
911 }
912 if (!pl.isLast())
913 {
914 if (!m_firstCol) m_t << "\n";
915 m_t << ".br\n";
916 }
917}
bool isLast() const
Definition docnode.h:1099

References FALSE, DocParamList::isLast(), m_firstCol, m_hide, m_t, DocParamList::paragraphs(), DocParamList::parameters(), and TRUE.

◆ operator()() [36/57]

void ManDocVisitor::operator() ( const DocParamSect & s)

Definition at line 866 of file mandocvisitor.cpp.

867{
868 if (m_hide) return;
869 if (!m_firstCol)
870 {
871 m_t << "\n";
872 m_t << ".PP\n";
873 }
874 m_t << "\\fB";
875 switch(s.type())
876 {
878 m_t << theTranslator->trParameters(); break;
880 m_t << theTranslator->trReturnValues(); break;
882 m_t << theTranslator->trExceptions(); break;
885 default:
886 ASSERT(0);
887 }
888 m_t << "\\fP\n";
889 m_t << ".RS 4\n";
890 visitChildren(s);
891 if (!m_firstCol) m_t << "\n";
892 m_t << ".RE\n";
893 m_t << ".PP\n";
895}
Type type() const
Definition docnode.h:1030
virtual QCString trExceptions()=0
virtual QCString trParameters()=0
virtual QCString trTemplateParameters()=0
virtual QCString trReturnValues()=0
Translator * theTranslator
Definition language.cpp:71
#define ASSERT(x)
Definition qcstring.h:39

References ASSERT, DocParamSect::Exception, m_firstCol, m_hide, m_t, DocParamSect::Param, DocParamSect::RetVal, DocParamSect::TemplateParam, theTranslator, Translator::trExceptions(), Translator::trParameters(), Translator::trReturnValues(), Translator::trTemplateParameters(), TRUE, DocParamSect::type(), and visitChildren().

◆ operator()() [37/57]

void ManDocVisitor::operator() ( const DocParBlock & pb)

Definition at line 973 of file mandocvisitor.cpp.

974{
975 visitChildren(pb);
976}

References visitChildren().

◆ operator()() [38/57]

void ManDocVisitor::operator() ( const DocRef & ref)

Definition at line 834 of file mandocvisitor.cpp.

835{
836 if (m_hide) return;
837 m_t << "\\fB";
838 if (!ref.hasLinkText()) filter(ref.targetTitle());
839 visitChildren(ref);
840 m_t << "\\fP";
841}
QCString targetTitle() const
Definition docnode.h:748
bool hasLinkText() const
Definition docnode.h:750

References filter(), DocRef::hasLinkText(), m_hide, m_t, DocRef::targetTitle(), and visitChildren().

◆ operator()() [39/57]

void ManDocVisitor::operator() ( const DocRoot & r)

Definition at line 506 of file mandocvisitor.cpp.

507{
508 visitChildren(r);
509}

References visitChildren().

◆ operator()() [40/57]

void ManDocVisitor::operator() ( const DocSecRefItem & ref)

Definition at line 843 of file mandocvisitor.cpp.

844{
845 if (m_hide) return;
846 QCString ws;
847 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
848 if (!m_firstCol) m_t << "\n";
849 m_t << ".IP \"" << ws << "\\(bu\" " << (2*m_indent) << "\n";
851 visitChildren(ref);
852 m_t << "\n";
854}

References QCString::fill(), m_firstCol, m_hide, m_indent, m_t, TRUE, and visitChildren().

◆ operator()() [41/57]

void ManDocVisitor::operator() ( const DocSecRefList & l)

Definition at line 856 of file mandocvisitor.cpp.

857{
858 if (m_hide) return;
859 m_indent++;
860 visitChildren(l);
861 m_indent--;
862 if (!m_firstCol) m_t << "\n";
863 m_t << ".PP\n";
864}

References m_firstCol, m_hide, m_indent, m_t, and visitChildren().

◆ operator()() [42/57]

void ManDocVisitor::operator() ( const DocSection & s)

Definition at line 607 of file mandocvisitor.cpp.

608{
609 if (m_hide) return;
610 if (!m_firstCol) m_t << "\n";
611 if (s.level()==1) m_t << ".SH"; else m_t << ".SS";
612 m_t << " \"";
613 if (s.title())
614 {
615 std::visit(*this,*s.title());
616 }
617 m_t << "\"\n";
618 if (s.level()==1) m_t << ".PP\n";
620 visitChildren(s);
621}
int level() const
Definition docnode.h:880
const DocNodeVariant * title() const
Definition docnode.h:881

References DocSection::level(), m_firstCol, m_hide, m_t, DocSection::title(), TRUE, and visitChildren().

◆ operator()() [43/57]

void ManDocVisitor::operator() ( const DocSeparator & s)

Definition at line 433 of file mandocvisitor.cpp.

434{
435 if (m_hide) return;
436 m_t << s.chars();
437}
QCString chars() const
Definition docnode.h:348

References DocSeparator::chars(), m_hide, and m_t.

◆ operator()() [44/57]

void ManDocVisitor::operator() ( const DocSimpleList & l)

Definition at line 579 of file mandocvisitor.cpp.

580{
581 if (m_hide) return;
582 m_indent++;
583 if (!m_firstCol) m_t << "\n";
584 m_t << ".PD 0\n";
585 m_firstCol=true;
586 visitChildren(l);
587 m_indent--;
588 m_t << ".PP\n";
589}

References m_firstCol, m_hide, m_indent, m_t, and visitChildren().

◆ operator()() [45/57]

void ManDocVisitor::operator() ( const DocSimpleListItem & li)

Definition at line 591 of file mandocvisitor.cpp.

592{
593 if (m_hide) return;
594 QCString ws;
595 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
596 if (!m_firstCol) m_t << "\n";
597 m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << "\n";
599 if (li.paragraph())
600 {
601 visit(*this,*li.paragraph());
602 }
603 m_t << "\n";
605}
const DocNodeVariant * paragraph() const
Definition docnode.h:1119

References QCString::fill(), m_firstCol, m_hide, m_indent, m_t, DocSimpleListItem::paragraph(), and TRUE.

◆ operator()() [46/57]

void ManDocVisitor::operator() ( const DocSimpleSect & s)

Definition at line 511 of file mandocvisitor.cpp.

512{
513 if (m_hide) return;
514 if (!m_firstCol)
515 {
516 m_t << "\n";
517 m_t << ".PP\n";
518 }
519 m_t << "\\fB";
520 switch(s.type())
521 {
523 m_t << theTranslator->trSeeAlso(); break;
525 m_t << theTranslator->trReturns(); break;
527 m_t << theTranslator->trAuthor(TRUE,TRUE); break;
529 m_t << theTranslator->trAuthor(TRUE,FALSE); break;
531 m_t << theTranslator->trVersion(); break;
533 m_t << theTranslator->trSince(); break;
535 m_t << theTranslator->trDate(); break;
537 m_t << theTranslator->trNote(); break;
539 m_t << theTranslator->trWarning(); break;
541 m_t << theTranslator->trPrecondition(); break;
543 m_t << theTranslator->trPostcondition(); break;
545 m_t << theTranslator->trCopyright(); break;
547 m_t << theTranslator->trInvariant(); break;
549 m_t << theTranslator->trRemarks(); break;
551 m_t << theTranslator->trAttention(); break;
553 m_t << theTranslator->trImportant(); break;
554 case DocSimpleSect::User: break;
555 case DocSimpleSect::Rcs: break;
556 case DocSimpleSect::Unknown: break;
557 }
558
559 // special case 1: user defined title
560 if (s.title())
561 {
562 std::visit(*this,*s.title());
563 }
564 m_t << "\\fP\n";
565 m_t << ".RS 4\n";
566 visitChildren(s);
567 if (!m_firstCol) m_t << "\n";
568 m_t << ".RE\n";
569 m_t << ".PP\n";
571}
Type type() const
Definition docnode.h:988
const DocNodeVariant * title() const
Definition docnode.h:995
virtual QCString trPrecondition()=0
virtual QCString trSince()=0
virtual QCString trVersion()=0
virtual QCString trReturns()=0
virtual QCString trRemarks()=0
virtual QCString trNote()=0
virtual QCString trPostcondition()=0
virtual QCString trAttention()=0
virtual QCString trCopyright()=0
virtual QCString trDate()=0
virtual QCString trAuthor(bool first_capital, bool singular)=0
virtual QCString trWarning()=0
virtual QCString trSeeAlso()=0
virtual QCString trImportant()=0
virtual QCString trInvariant()=0

References DocSimpleSect::Attention, DocSimpleSect::Author, DocSimpleSect::Authors, DocSimpleSect::Copyright, DocSimpleSect::Date, FALSE, DocSimpleSect::Important, DocSimpleSect::Invar, m_firstCol, m_hide, m_t, DocSimpleSect::Note, DocSimpleSect::Post, DocSimpleSect::Pre, DocSimpleSect::Rcs, DocSimpleSect::Remark, DocSimpleSect::Return, DocSimpleSect::See, DocSimpleSect::Since, theTranslator, DocSimpleSect::title(), Translator::trAttention(), Translator::trAuthor(), Translator::trCopyright(), Translator::trDate(), Translator::trImportant(), Translator::trInvariant(), Translator::trNote(), Translator::trPostcondition(), Translator::trPrecondition(), Translator::trRemarks(), Translator::trReturns(), Translator::trSeeAlso(), Translator::trSince(), TRUE, Translator::trVersion(), Translator::trWarning(), DocSimpleSect::type(), DocSimpleSect::Unknown, DocSimpleSect::User, DocSimpleSect::Version, visitChildren(), and DocSimpleSect::Warning.

◆ operator()() [47/57]

void ManDocVisitor::operator() ( const DocSimpleSectSep & )

Definition at line 419 of file mandocvisitor.cpp.

420{
421}

◆ operator()() [48/57]

void ManDocVisitor::operator() ( const DocStyleChange & s)

Definition at line 127 of file mandocvisitor.cpp.

128{
129 if (m_hide) return;
130 switch (s.style())
131 {
133 if (s.enable()) m_t << "\\fB"; else m_t << "\\fP";
135 break;
139 /* not supported */
140 break;
141 case DocStyleChange::Underline: //underline is shown as emphasis
143 if (s.enable()) m_t << "\\fI"; else m_t << "\\fP";
145 break;
147 if (s.enable()) m_t << "\\fI"; else m_t << "\\fP";
149 break;
151 if (s.enable()) m_t << "\\fR"; else m_t << "\\fP";
153 break;
155 if (s.enable()) m_t << "\\*<"; else m_t << "\\*> ";
157 break;
159 if (s.enable()) m_t << "\\*{"; else m_t << "\\*} ";
161 break;
163 /* not supported */
164 break;
166 /* not supported */
167 break;
169 /* not supported */
170 break;
172 if (s.enable())
173 {
174 if (!m_firstCol) m_t << "\n";
175 m_t << ".PP\n";
176 m_t << ".nf\n";
178 }
179 else
180 {
182 if (!m_firstCol) m_t << "\n";
183 m_t << ".fi\n";
184 m_t << ".PP\n";
186 }
187 break;
188 case DocStyleChange::Div: /* HTML only */ break;
189 case DocStyleChange::Span: /* HTML only */ break;
190 }
191}
Style style() const
Definition docnode.h:290
bool enable() const
Definition docnode.h:292

References DocStyleChange::Bold, DocStyleChange::Center, DocStyleChange::Cite, DocStyleChange::Code, DocStyleChange::Del, DocStyleChange::Div, DocStyleChange::enable(), FALSE, DocStyleChange::Ins, DocStyleChange::Italic, m_firstCol, m_hide, m_insidePre, m_t, DocStyleChange::Preformatted, DocStyleChange::S, DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Strike, DocStyleChange::style(), DocStyleChange::Subscript, DocStyleChange::Superscript, TRUE, and DocStyleChange::Underline.

◆ operator()() [49/57]

void ManDocVisitor::operator() ( const DocSymbol & s)

Definition at line 74 of file mandocvisitor.cpp.

75{
76 if (m_hide) return;
77 const char *res = HtmlEntityMapper::instance().man(s.symbol());
78 if (res)
79 {
80 m_t << res;
81 }
82 else
83 {
84 // no error or warning to be supplied
85 // err("man: non supported HTML-entity found: &%s;\n",get_symbol_item(s->symbol()));
86 }
88}
HtmlEntityMapper::SymType symbol() const
Definition docnode.h:311
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
const char * man(SymType symb) const
Access routine to the man code of the HTML entity.

References FALSE, HtmlEntityMapper::instance(), m_firstCol, m_hide, m_t, HtmlEntityMapper::man(), and DocSymbol::symbol().

◆ operator()() [50/57]

void ManDocVisitor::operator() ( const DocText & t)

Definition at line 948 of file mandocvisitor.cpp.

949{
950 visitChildren(t);
951}

References visitChildren().

◆ operator()() [51/57]

void ManDocVisitor::operator() ( const DocTitle & t)

Definition at line 573 of file mandocvisitor.cpp.

574{
575 if (m_hide) return;
576 visitChildren(t);
577}

References m_hide, and visitChildren().

◆ operator()() [52/57]

void ManDocVisitor::operator() ( const DocURL & u)

Definition at line 105 of file mandocvisitor.cpp.

106{
107 if (m_hide) return;
108 m_t << u.url();
110}
QCString url() const
Definition docnode.h:190

References FALSE, m_firstCol, m_hide, m_t, and DocURL::url().

◆ operator()() [53/57]

void ManDocVisitor::operator() ( const DocVerbatim & s)

Definition at line 193 of file mandocvisitor.cpp.

194{
195 if (m_hide) return;
196 QCString lang = m_langExt;
197 if (!s.language().isEmpty()) // explicit language setting
198 {
199 lang = s.language();
200 }
201 SrcLangExt langExt = getLanguageFromCodeLang(lang);
202 switch (s.type())
203 {
205 if (!m_firstCol) m_t << "\n";
206 m_t << ".PP\n";
207 m_t << ".nf\n";
209 langExt,
210 s.isExample(),s.exampleFile());
211 if (!m_firstCol) m_t << "\n";
212 m_t << ".fi\n";
213 m_t << ".PP\n";
215 break;
217 filter(s.text());
218 break;
220 m_t << "\\fR\n";
221 filter(s.text());
222 m_t << "\\fP\n";
223 break;
225 if (!m_firstCol) m_t << "\n";
226 m_t << ".PP\n";
227 m_t << ".nf\n";
228 filter(s.text());
229 if (!m_firstCol) m_t << "\n";
230 m_t << ".fi\n";
231 m_t << ".PP\n";
233 break;
235 m_t << s.text();
236 break;
242 case DocVerbatim::Dot:
243 case DocVerbatim::Msc:
245 /* nothing */
246 break;
247 }
248}
QCString language() const
Definition docnode.h:367
bool isExample() const
Definition docnode.h:364
QCString context() const
Definition docnode.h:363
Type type() const
Definition docnode.h:361
QCString text() const
Definition docnode.h:362
QCString exampleFile() const
Definition docnode.h:365
@ JavaDocLiteral
Definition docnode.h:357
SrcLangExt getLanguageFromCodeLang(QCString &fileName)
Routine to handle the language attribute of the \code command.
Definition util.cpp:5490

References DocVerbatim::Code, DocVerbatim::context(), DocVerbatim::DocbookOnly, DocVerbatim::Dot, DocVerbatim::exampleFile(), filter(), DocVisitor::getCodeParser(), getLanguageFromCodeLang(), DocVerbatim::HtmlOnly, QCString::isEmpty(), DocVerbatim::isExample(), DocVerbatim::JavaDocCode, DocVerbatim::JavaDocLiteral, DocVerbatim::language(), DocVerbatim::LatexOnly, m_ci, m_firstCol, m_hide, m_langExt, m_t, DocVerbatim::ManOnly, DocVerbatim::Msc, CodeParserInterface::parseCode(), DocVerbatim::PlantUML, DocVerbatim::RtfOnly, DocVerbatim::text(), TRUE, DocVerbatim::type(), DocVerbatim::Verbatim, and DocVerbatim::XmlOnly.

◆ operator()() [54/57]

void ManDocVisitor::operator() ( const DocVhdlFlow & )

Definition at line 969 of file mandocvisitor.cpp.

970{
971}

◆ operator()() [55/57]

void ManDocVisitor::operator() ( const DocWhiteSpace & w)

Definition at line 59 of file mandocvisitor.cpp.

60{
61 if (m_hide) return;
62 if (m_insidePre)
63 {
64 m_t << w.chars();
65 m_firstCol=w.chars().at(w.chars().length()-1)=='\n';
66 }
67 else
68 {
69 m_t << " ";
71 }
72}
QCString chars() const
Definition docnode.h:337
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:146
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:558

References QCString::at(), DocWhiteSpace::chars(), FALSE, QCString::length(), m_firstCol, m_hide, m_insidePre, and m_t.

◆ operator()() [56/57]

void ManDocVisitor::operator() ( const DocWord & w)

Definition at line 43 of file mandocvisitor.cpp.

44{
45 if (m_hide) return;
46 filter(w.word());
48}
QCString word() const
Definition docnode.h:154

References FALSE, filter(), m_firstCol, m_hide, and DocWord::word().

◆ operator()() [57/57]

void ManDocVisitor::operator() ( const DocXRefItem & x)

Definition at line 919 of file mandocvisitor.cpp.

920{
921 if (m_hide) return;
922 if (x.title().isEmpty()) return;
923 if (!m_firstCol)
924 {
925 m_t << "\n";
926 m_t << ".PP\n";
927 }
928 m_t << "\\fB";
929 filter(x.title());
930 m_t << "\\fP\n";
931 m_t << ".RS 4\n";
932 visitChildren(x);
933 if (x.title().isEmpty()) return;
934 if (!m_firstCol) m_t << "\n";
935 m_t << ".RE\n";
936 m_t << ".PP\n";
938}
QCString title() const
Definition docnode.h:597

References filter(), QCString::isEmpty(), m_firstCol, m_hide, m_t, DocXRefItem::title(), TRUE, and visitChildren().

◆ visitChildren()

template<class T >
void ManDocVisitor::visitChildren ( const T & t)
inlineprivate

Member Data Documentation

◆ m_ci

OutputCodeList& ManDocVisitor::m_ci
private

Definition at line 126 of file mandocvisitor.h.

Referenced by operator()(), operator()(), and operator()().

◆ m_firstCol

◆ m_hide

◆ m_indent

int ManDocVisitor::m_indent
private

◆ m_insidePre

bool ManDocVisitor::m_insidePre
private

Definition at line 127 of file mandocvisitor.h.

Referenced by operator()(), and operator()().

◆ m_langExt

QCString ManDocVisitor::m_langExt
private

Definition at line 131 of file mandocvisitor.h.

Referenced by operator()(), and operator()().

◆ m_listItemInfo

std::array<ManListItemInfo,maxIndentLevels> ManDocVisitor::m_listItemInfo
private

Definition at line 140 of file mandocvisitor.h.

Referenced by operator()(), and operator()().

◆ m_t

◆ maxIndentLevels

const int ManDocVisitor::maxIndentLevels = 13
staticprivate

Definition at line 138 of file mandocvisitor.h.

Referenced by operator()(), and operator()().


The documentation for this class was generated from the following files: