Skip to main content

The ManDocVisitor Class Reference

Concrete visitor implementation for LaTeX output. More...

Declaration

class ManDocVisitor { ... }

Included Headers

Base class

classDocVisitor

Helper base class for functionality shared by all visitors. More...

Public Constructors Index

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

Public Operators Index

voidoperator() (const DocWord &)
voidoperator() (const DocLinkedWord &)
voidoperator() (const DocWhiteSpace &)
voidoperator() (const DocSymbol &)
voidoperator() (const DocEmoji &)
voidoperator() (const DocURL &)
voidoperator() (const DocLineBreak &)
voidoperator() (const DocHorRuler &)
voidoperator() (const DocStyleChange &)
voidoperator() (const DocVerbatim &)
voidoperator() (const DocAnchor &)
voidoperator() (const DocInclude &)
voidoperator() (const DocIncOperator &)
voidoperator() (const DocFormula &)
voidoperator() (const DocIndexEntry &)
voidoperator() (const DocSimpleSectSep &)
voidoperator() (const DocCite &)
voidoperator() (const DocSeparator &)
voidoperator() (const DocAutoList &)
voidoperator() (const DocAutoListItem &)
voidoperator() (const DocPara &)
voidoperator() (const DocRoot &)
voidoperator() (const DocSimpleSect &)
voidoperator() (const DocTitle &)
voidoperator() (const DocSimpleList &)
voidoperator() (const DocSimpleListItem &)
voidoperator() (const DocSection &s)
voidoperator() (const DocHtmlList &s)
voidoperator() (const DocHtmlListItem &)
voidoperator() (const DocHtmlDescList &)
voidoperator() (const DocHtmlDescTitle &)
voidoperator() (const DocHtmlDescData &)
voidoperator() (const DocHtmlTable &t)
voidoperator() (const DocHtmlCaption &)
voidoperator() (const DocHtmlRow &)
voidoperator() (const DocHtmlCell &)
voidoperator() (const DocInternal &)
voidoperator() (const DocHRef &)
voidoperator() (const DocHtmlSummary &)
voidoperator() (const DocHtmlDetails &)
voidoperator() (const DocHtmlHeader &)
voidoperator() (const DocImage &)
voidoperator() (const DocDotFile &)
voidoperator() (const DocMscFile &)
voidoperator() (const DocDiaFile &)
voidoperator() (const DocPlantUmlFile &)
voidoperator() (const DocLink &lnk)
voidoperator() (const DocRef &ref)
voidoperator() (const DocSecRefItem &)
voidoperator() (const DocSecRefList &)
voidoperator() (const DocParamSect &)
voidoperator() (const DocParamList &)
voidoperator() (const DocXRefItem &)
voidoperator() (const DocInternalRef &)
voidoperator() (const DocText &)
voidoperator() (const DocHtmlBlockQuote &)
voidoperator() (const DocVhdlFlow &)
voidoperator() (const DocParBlock &)

Private Member Functions Index

template <class T>
voidvisitChildren (const T &t)
voidfilter (const QCString &str, const bool retainNewline=false)

Private Member Attributes Index

TextStream &m_t
OutputCodeList &m_ci
boolm_insidePre
boolm_hide
boolm_firstCol
intm_indent
QCStringm_langExt
std::array< ManListItemInfo, maxIndentLevels >m_listItemInfo

Private Static Attributes Index

static const intmaxIndentLevels = 13

Description

Concrete visitor implementation for LaTeX output.

Definition at line 33 of file mandocvisitor.h.

Public Constructors

ManDocVisitor()

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

Declaration at line 36 of file mandocvisitor.h, definition at line 33 of file mandocvisitor.cpp.

34 const QCString &langExt)
36 m_indent(0), m_langExt(langExt)
37{
38}

References FALSE, m_ci, m_firstCol, m_hide, m_indent, m_insidePre, m_langExt and m_t.

Public Operators

operator()()

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

Declaration at line 42 of file mandocvisitor.h, definition at line 44 of file mandocvisitor.cpp.

45{
46 if (m_hide) return;
47 filter(w.word());
49}

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

operator()()

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

Declaration at line 43 of file mandocvisitor.h, definition at line 51 of file mandocvisitor.cpp.

52{
53 if (m_hide) return;
54 m_t << "\\fB";
55 filter(w.word());
56 m_t << "\\fP";
58}

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

operator()()

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

Declaration at line 44 of file mandocvisitor.h, definition at line 60 of file mandocvisitor.cpp.

61{
62 if (m_hide) return;
63 if (m_insidePre)
64 {
65 m_t << w.chars();
66 m_firstCol=w.chars().at(w.chars().length()-1)=='\n';
67 }
68 else
69 {
70 m_t << " ";
72 }
73}

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

operator()()

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

Declaration at line 45 of file mandocvisitor.h, definition at line 75 of file mandocvisitor.cpp.

76{
77 if (m_hide) return;
78 const char *res = HtmlEntityMapper::instance().man(s.symbol());
79 if (res)
80 {
81 m_t << res;
82 }
83 else
84 {
85 // no error or warning to be supplied
86 // err("man: non supported HTML-entity found: &{};\n",get_symbol_item(s->symbol()));
87 }
89}

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

operator()()

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

Declaration at line 46 of file mandocvisitor.h, definition at line 91 of file mandocvisitor.cpp.

92{
93 if (m_hide) return;
94 const char *res = EmojiEntityMapper::instance().name(s.index());
95 if (res)
96 {
97 m_t << res;
98 }
99 else
100 {
101 m_t << s.name();
102 }
104}

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

operator()()

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

Declaration at line 47 of file mandocvisitor.h, definition at line 106 of file mandocvisitor.cpp.

107{
108 if (m_hide) return;
109 m_t << u.url();
111}

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

operator()()

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

Declaration at line 48 of file mandocvisitor.h, definition at line 113 of file mandocvisitor.cpp.

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

References m_firstCol, m_hide, m_t and TRUE.

operator()()

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

Declaration at line 49 of file mandocvisitor.h, definition at line 120 of file mandocvisitor.cpp.

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

References m_firstCol, m_hide, m_t and TRUE.

operator()()

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

Declaration at line 50 of file mandocvisitor.h, definition at line 128 of file mandocvisitor.cpp.

129{
130 if (m_hide) return;
131 switch (s.style())
132 {
134 if (s.enable()) m_t << "\\fB"; else m_t << "\\fP";
136 break;
140 /* not supported */
141 break;
142 case DocStyleChange::Underline: //underline is shown as emphasis
144 if (s.enable()) m_t << "\\fI"; else m_t << "\\fP";
146 break;
148 if (s.enable()) m_t << "\\fI"; else m_t << "\\fP";
150 break;
154 if (s.enable()) m_t << "\\fR"; else m_t << "\\fP";
156 break;
158 if (s.enable()) m_t << "\\*<"; else m_t << "\\*> ";
160 break;
162 if (s.enable()) m_t << "\\*{"; else m_t << "\\*} ";
164 break;
166 /* not supported */
167 break;
169 /* not supported */
170 break;
172 /* not supported */
173 break;
175 if (s.enable())
176 {
177 if (!m_firstCol) m_t << "\n";
178 m_t << ".PP\n";
179 m_t << ".nf\n";
181 }
182 else
183 {
185 if (!m_firstCol) m_t << "\n";
186 m_t << ".fi\n";
187 m_t << ".PP\n";
189 }
190 break;
191 case DocStyleChange::Div: /* HTML only */ break;
192 case DocStyleChange::Span: /* HTML only */ break;
193 }
194}

References DocStyleChange::Bold, DocStyleChange::Center, DocStyleChange::Cite, DocStyleChange::Code, DocStyleChange::Del, DocStyleChange::Div, DocStyleChange::enable, FALSE, DocStyleChange::Ins, DocStyleChange::Italic, DocStyleChange::Kbd, 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, DocStyleChange::Typewriter and DocStyleChange::Underline.

operator()()

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

Declaration at line 51 of file mandocvisitor.h, definition at line 196 of file mandocvisitor.cpp.

197{
198 if (m_hide) return;
199 QCString lang = m_langExt;
200 if (!s.language().isEmpty()) // explicit language setting
201 {
202 lang = s.language();
203 }
204 SrcLangExt langExt = getLanguageFromCodeLang(lang);
205 switch (s.type())
206 {
208 if (!m_firstCol) m_t << "\n";
209 m_t << ".PP\n";
210 m_t << ".nf\n";
212 langExt,
213 Config_getBool(STRIP_CODE_COMMENTS),
214 s.isExample(),s.exampleFile());
215 if (!m_firstCol) m_t << "\n";
216 m_t << ".fi\n";
217 m_t << ".PP\n";
219 break;
221 filter(s.text(),true);
222 break;
224 m_t << "\\fR\n";
225 filter(s.text(),true);
226 m_t << "\\fP\n";
227 break;
229 if (!m_firstCol) m_t << "\n";
230 m_t << ".PP\n";
231 m_t << ".nf\n";
232 filter(s.text(),true);
233 if (!m_firstCol) m_t << "\n";
234 m_t << ".fi\n";
235 m_t << ".PP\n";
237 break;
239 m_t << s.text();
240 break;
249 /* nothing */
250 break;
251 }
252}

References DocVerbatim::Code, Config_getBool, 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()()

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

Declaration at line 52 of file mandocvisitor.h, definition at line 254 of file mandocvisitor.cpp.

255{
256 /* no support for anchors in man pages */
257}

operator()()

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

Declaration at line 53 of file mandocvisitor.h, definition at line 259 of file mandocvisitor.cpp.

260{
261 if (m_hide) return;
263 switch(inc.type())
264 {
266 {
267 if (!m_firstCol) m_t << "\n";
268 m_t << ".PP\n";
269 m_t << ".nf\n";
270 FileInfo cfi( inc.file().str() );
271 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
273 inc.text(),
274 langExt,
276 inc.isExample(),
277 inc.exampleFile(),
278 fd.get(), // fileDef,
279 -1, // start line
280 -1, // end line
281 FALSE, // inline fragment
282 nullptr, // memberDef
283 TRUE
284 );
285 m_t << ".fi\n";
286 m_t << ".PP\n";
288 }
289 break;
291 if (!m_firstCol) m_t << "\n";
292 m_t << ".PP\n";
293 m_t << ".nf\n";
295 inc.text(),
296 langExt,
298 inc.isExample(),
299 inc.exampleFile(),
300 nullptr, // fileDef
301 -1, // startLine
302 -1, // endLine
303 TRUE, // inlineFragment
304 nullptr, // memberDef
305 FALSE
306 );
307 m_t << ".fi\n";
308 m_t << ".PP\n";
310 break;
318 break;
320 m_t << inc.text();
321 break;
323 if (!m_firstCol) m_t << "\n";
324 m_t << ".PP\n";
325 m_t << ".nf\n";
326 m_t << inc.text();
327 if (!m_firstCol) m_t << "\n";
328 m_t << ".fi\n";
329 m_t << ".PP\n";
331 break;
334 if (!m_firstCol) m_t << "\n";
335 m_t << ".PP\n";
336 m_t << ".nf\n";
338 inc.file(),
339 inc.blockId(),
340 inc.context(),
342 inc.trimLeft(),
344 );
345 m_t << ".fi\n";
346 m_t << ".PP\n";
348 break;
349 }
350}

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::SnippetWithLines, QCString::str, DocInclude::stripCodeComments, DocInclude::text, DocInclude::trimLeft, TRUE, DocInclude::type, DocInclude::VerbInclude and DocInclude::XmlInclude.

operator()()

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

Declaration at line 54 of file mandocvisitor.h, definition at line 352 of file mandocvisitor.cpp.

353{
355 if (locLangExt.isEmpty()) locLangExt = m_langExt;
356 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
357 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
358 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
359 if (op.isFirst())
360 {
361 if (!m_hide)
362 {
363 if (!m_firstCol) m_t << "\n";
364 m_t << ".PP\n";
365 m_t << ".nf\n";
366 }
368 m_hide = TRUE;
369 }
370 if (op.type()!=DocIncOperator::Skip)
371 {
372 m_hide = popHidden();
373 if (!m_hide)
374 {
375 std::unique_ptr<FileDef> fd;
376 if (!op.includeFileName().isEmpty())
377 {
378 FileInfo cfi( op.includeFileName().str() );
379 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
380 }
381
382 getCodeParser(locLangExt).parseCode(m_ci,op.context(),op.text(),langExt,
384 op.isExample(),op.exampleFile(),
385 fd.get(), // fileDef
386 op.line(), // startLine
387 -1, // endLine
388 FALSE, // inline fragment
389 nullptr, // memberDef
390 op.showLineNo() // show line numbers
391 );
392 }
395 }
396 if (op.isLast())
397 {
398 m_hide = popHidden();
399 if (!m_hide)
400 {
401 if (!m_firstCol) m_t << "\n";
402 m_t << ".fi\n";
403 m_t << ".PP\n";
405 }
406 }
407 else
408 {
409 if (!m_hide) m_t << "\n";
410 }
411}

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::stripCodeComments, DocIncOperator::text, TRUE and DocIncOperator::type.

operator()()

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

Declaration at line 55 of file mandocvisitor.h, definition at line 413 of file mandocvisitor.cpp.

414{
415 if (m_hide) return;
416 m_t << f.text();
417}

References m_hide, m_t and DocFormula::text.

operator()()

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

Declaration at line 56 of file mandocvisitor.h, definition at line 419 of file mandocvisitor.cpp.

operator()()

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

Declaration at line 57 of file mandocvisitor.h, definition at line 423 of file mandocvisitor.cpp.

operator()()

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

Declaration at line 58 of file mandocvisitor.h, definition at line 427 of file mandocvisitor.cpp.

428{
429 if (m_hide) return;
430 m_t << "\\fB";
431 auto opt = cite.option();
432 QCString txt;
433 if (!cite.file().isEmpty())
434 {
435 txt = cite.getText();
436 }
437 else
438 {
439 if (!opt.noPar()) txt += "[";
440 txt += cite.target();
441 if (!opt.noPar()) txt += "]";
442 }
443 filter(txt);
444 m_t << "\\fP";
445}

References DocCite::file, filter, DocCite::getText, QCString::isEmpty, m_hide, m_t, DocCite::option and DocCite::target.

operator()()

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

Declaration at line 59 of file mandocvisitor.h, definition at line 447 of file mandocvisitor.cpp.

448{
449 if (m_hide) return;
450 m_t << s.chars();
451}

References DocSeparator::chars, m_hide and m_t.

operator()()

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

Declaration at line 65 of file mandocvisitor.h, definition at line 458 of file mandocvisitor.cpp.

459{
460 if (m_hide) return;
461 m_indent++;
463 m_indent--;
464 m_t << ".PP\n";
465}

References m_hide, m_indent, m_t and visitChildren.

operator()()

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

Declaration at line 66 of file mandocvisitor.h, definition at line 467 of file mandocvisitor.cpp.

468{
469 if (m_hide) return;
470 QCString ws;
471 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
472 if (!m_firstCol) m_t << "\n";
473 m_t << ".IP \"" << ws;
474 const DocAutoList *list = std::get_if<DocAutoList>(li.parent());
475 if (list && list->isEnumList())
476 {
477 m_t << li.itemNumber() << ".\" " << (2*(m_indent+1));
478 }
479 else // bullet list
480 {
481 switch (li.itemNumber())
482 {
483 case DocAutoList::Unchecked: // unchecked
484 m_t << "[ ]\" " << (2*m_indent) + 2;
485 break;
486 case DocAutoList::Checked_x: // checked with x
487 m_t << "[x]\" " << (2*m_indent) + 2;
488 break;
489 case DocAutoList::Checked_X: // checked with X
490 m_t << "[X]\" " << (2*m_indent) + 2;
491 break;
492 default:
493 m_t << "\\(bu\" " << (2*m_indent);
494 break;
495 }
496 }
497 m_t << "\n";
499 visitChildren(li);
500 m_t << "\n";
502}

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()()

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

Declaration at line 67 of file mandocvisitor.h, definition at line 504 of file mandocvisitor.cpp.

505{
506 if (m_hide) return;
508 if (!p.isLast() && // omit <p> for last paragraph
509 !(p.parent() && // and for parameter sections
510 std::get_if<DocParamSect>(p.parent())
511 )
512 )
513 {
514 if (!m_firstCol) m_t << "\n";
515 m_t << "\n.PP\n";
517 }
518}

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

operator()()

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

Declaration at line 68 of file mandocvisitor.h, definition at line 520 of file mandocvisitor.cpp.

521{
523}

Reference visitChildren.

operator()()

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

Declaration at line 69 of file mandocvisitor.h, definition at line 525 of file mandocvisitor.cpp.

526{
527 if (m_hide) return;
528 if (!m_firstCol)
529 {
530 m_t << "\n";
531 m_t << ".PP\n";
532 }
533 m_t << "\\fB";
534 switch(s.type())
535 {
537 m_t << theTranslator->trSeeAlso(); break;
539 m_t << theTranslator->trReturns(); break;
541 m_t << theTranslator->trAuthor(TRUE,TRUE); break;
543 m_t << theTranslator->trAuthor(TRUE,FALSE); break;
545 m_t << theTranslator->trVersion(); break;
547 m_t << theTranslator->trSince(); break;
549 m_t << theTranslator->trDate(); break;
551 m_t << theTranslator->trNote(); break;
553 m_t << theTranslator->trWarning(); break;
555 m_t << theTranslator->trPrecondition(); break;
557 m_t << theTranslator->trPostcondition(); break;
559 m_t << theTranslator->trCopyright(); break;
561 m_t << theTranslator->trInvariant(); break;
563 m_t << theTranslator->trRemarks(); break;
565 m_t << theTranslator->trAttention(); break;
567 m_t << theTranslator->trImportant(); break;
568 case DocSimpleSect::User: break;
569 case DocSimpleSect::Rcs: break;
570 case DocSimpleSect::Unknown: break;
571 }
572
573 // special case 1: user defined title
574 if (s.title())
575 {
576 std::visit(*this,*s.title());
577 }
578 m_t << "\\fP\n";
579 m_t << ".RS 4\n";
581 if (!m_firstCol) m_t << "\n";
582 m_t << ".RE\n";
583 m_t << ".PP\n";
585}

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, TRUE, DocSimpleSect::type, DocSimpleSect::Unknown, DocSimpleSect::User, DocSimpleSect::Version, visitChildren and DocSimpleSect::Warning.

operator()()

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

Declaration at line 70 of file mandocvisitor.h, definition at line 587 of file mandocvisitor.cpp.

588{
589 if (m_hide) return;
591}

References m_hide and visitChildren.

operator()()

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

Declaration at line 71 of file mandocvisitor.h, definition at line 593 of file mandocvisitor.cpp.

594{
595 if (m_hide) return;
596 m_indent++;
597 if (!m_firstCol) m_t << "\n";
598 m_t << ".PD 0\n";
599 m_firstCol=true;
601 m_indent--;
602 m_t << ".PP\n";
603}

References m_firstCol, m_hide, m_indent, m_t and visitChildren.

operator()()

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

Declaration at line 72 of file mandocvisitor.h, definition at line 605 of file mandocvisitor.cpp.

606{
607 if (m_hide) return;
608 QCString ws;
609 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
610 if (!m_firstCol) m_t << "\n";
611 m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << "\n";
613 if (li.paragraph())
614 {
615 visit(*this,*li.paragraph());
616 }
617 m_t << "\n";
619}

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

operator()()

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

Declaration at line 73 of file mandocvisitor.h, definition at line 621 of file mandocvisitor.cpp.

622{
623 if (m_hide) return;
624 if (!m_firstCol) m_t << "\n";
625 if (s.level()==1) m_t << ".SH"; else m_t << ".SS";
626 m_t << " \"";
627 if (s.title())
628 {
629 std::visit(*this,*s.title());
630 }
631 m_t << "\"\n";
632 if (s.level()==1) m_t << ".PP\n";
635}

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

operator()()

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

Declaration at line 74 of file mandocvisitor.h, definition at line 637 of file mandocvisitor.cpp.

638{
639 if (m_hide) return;
640 m_indent++;
641 if (!m_firstCol) m_t << "\n";
642 m_t << ".PD 0\n";
643 m_firstCol=true;
644 int indent = std::min(m_indent,maxIndentLevels-1);
645 m_listItemInfo[indent].number = 1;
646 m_listItemInfo[indent].type = '1';
647 for (const auto &opt : l.attribs())
648 {
649 if (opt.name=="type")
650 {
651 m_listItemInfo[indent].type = opt.value[0];
652 }
653 if (opt.name=="start")
654 {
655 bool ok = false;
656 int val = opt.value.toInt(&ok);
657 if (ok) m_listItemInfo[indent].number = val;
658 }
659 }
661 m_indent--;
662 if (!m_firstCol) m_t << "\n";
663 m_t << ".PP\n";
664}

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

operator()()

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

Declaration at line 75 of file mandocvisitor.h, definition at line 666 of file mandocvisitor.cpp.

667{
668 if (m_hide) return;
669 QCString ws;
670 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
671 if (!m_firstCol) m_t << "\n";
672 m_t << ".IP \"" << ws;
673 const DocHtmlList *list = std::get_if<DocHtmlList>(li.parent());
674 if (list && list->type()==DocHtmlList::Ordered)
675 {
676 int indent = std::min(m_indent,maxIndentLevels-1);
677 for (const auto &opt : li.attribs())
678 {
679 if (opt.name=="value")
680 {
681 bool ok = false;
682 int val = opt.value.toInt(&ok);
683 if (ok) m_listItemInfo[indent].number = val;
684 }
685 }
686 switch (m_listItemInfo[indent].type)
687 {
688 case '1':
689 m_t << m_listItemInfo[indent].number;
690 break;
691 case 'a':
692 m_t << integerToAlpha(m_listItemInfo[indent].number,false);
693 break;
694 case 'A':
695 m_t << integerToAlpha(m_listItemInfo[indent].number);
696 break;
697 case 'i':
698 m_t << integerToRoman(m_listItemInfo[indent].number,false);
699 break;
700 case 'I':
701 m_t << integerToRoman(m_listItemInfo[indent].number);
702 break;
703 default:
704 m_t << m_listItemInfo[indent].number;
705 break;
706 }
707 m_t << ".\" " << ((m_indent+1)*2);
708 m_listItemInfo[indent].number++;
709 }
710 else // bullet list
711 {
712 m_t << "\\(bu\" " << (m_indent*2);
713 }
714 m_t << "\n";
716 visitChildren(li);
717 m_t << "\n";
719}

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()()

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

Declaration at line 76 of file mandocvisitor.h, definition at line 721 of file mandocvisitor.cpp.

722{
723 if (m_hide) return;
724 m_indent+=2;
725 visitChildren(dl);
726 m_indent-=2;
727 if (!m_firstCol) m_t << "\n";
728 m_t << "\n.PP\n";
730}

References m_firstCol, m_hide, m_indent, m_t, TRUE and visitChildren.

operator()()

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

Declaration at line 77 of file mandocvisitor.h, definition at line 732 of file mandocvisitor.cpp.

733{
734 if (m_hide) return;
735 if (!m_firstCol) m_t << "\n";
736 m_t << "\n.PP";
737 m_t << "\n.IP \"\\fB";
739 visitChildren(dt);
740}

References FALSE, m_firstCol, m_hide, m_t and visitChildren.

operator()()

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

Declaration at line 78 of file mandocvisitor.h, definition at line 742 of file mandocvisitor.cpp.

743{
744 if (!m_firstCol) m_t << "\n";
745 m_t << ".IP \"\" 1c\n";
747 visitChildren(dd);
748}

References m_firstCol, m_t, TRUE and visitChildren.

operator()()

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

Declaration at line 79 of file mandocvisitor.h, definition at line 750 of file mandocvisitor.cpp.

751{
753}

Reference visitChildren.

operator()()

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

Declaration at line 80 of file mandocvisitor.h, definition at line 755 of file mandocvisitor.cpp.

756{
758}

Reference visitChildren.

operator()()

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

Declaration at line 81 of file mandocvisitor.h, definition at line 760 of file mandocvisitor.cpp.

761{
763}

Reference visitChildren.

operator()()

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

Declaration at line 82 of file mandocvisitor.h, definition at line 765 of file mandocvisitor.cpp.

766{
768}

Reference visitChildren.

operator()()

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

Declaration at line 83 of file mandocvisitor.h, definition at line 770 of file mandocvisitor.cpp.

771{
773}

Reference visitChildren.

operator()()

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

Declaration at line 84 of file mandocvisitor.h, definition at line 775 of file mandocvisitor.cpp.

776{
777 if (m_hide) return;
778 m_t << "\\fR";
779 visitChildren(href);
780 m_t << "\\fP";
781}

References m_hide, m_t and visitChildren.

operator()()

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

Declaration at line 85 of file mandocvisitor.h, definition at line 783 of file mandocvisitor.cpp.

784{
785 m_t << "\\fB";
787 m_t << "\\fP\n.PP\n";
788}

References m_t and visitChildren.

operator()()

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

Declaration at line 86 of file mandocvisitor.h, definition at line 790 of file mandocvisitor.cpp.

791{
792 if (m_hide) return;
793 if (!m_firstCol)
794 {
795 m_t << "\n";
796 m_t << ".PP\n";
797 }
798 auto summary = d.summary();
799 if (summary)
800 {
801 std::visit(*this,*summary);
802 m_t << ".PP\n";
803 m_t << ".RS 4\n";
804 }
806 if (!m_firstCol) m_t << "\n";
807 if (summary)
808 {
809 m_t << ".RE\n";
810 }
811 m_t << ".PP\n";
813}

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

operator()()

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

Declaration at line 87 of file mandocvisitor.h, definition at line 815 of file mandocvisitor.cpp.

816{
817 if (m_hide) return;
818 if (!m_firstCol) m_t << "\n";
819 if (header.level()==1) m_t << ".SH"; else m_t << ".SS";
820 m_t << " \"";
821 visitChildren(header);
822 m_t << "\"\n";
823 if (header.level()==1) m_t << ".PP\n";
825}

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

operator()()

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

Declaration at line 88 of file mandocvisitor.h, definition at line 827 of file mandocvisitor.cpp.

828{
829}

operator()()

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

Declaration at line 89 of file mandocvisitor.h, definition at line 831 of file mandocvisitor.cpp.

832{
833}

operator()()

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

Declaration at line 90 of file mandocvisitor.h, definition at line 835 of file mandocvisitor.cpp.

836{
837}

operator()()

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

Declaration at line 91 of file mandocvisitor.h, definition at line 839 of file mandocvisitor.cpp.

840{
841}

operator()()

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

Declaration at line 92 of file mandocvisitor.h, definition at line 843 of file mandocvisitor.cpp.

operator()()

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

Declaration at line 93 of file mandocvisitor.h, definition at line 847 of file mandocvisitor.cpp.

848{
849 if (m_hide) return;
850 m_t << "\\fB";
851 visitChildren(dl);
852 m_t << "\\fP";
853}

References m_hide, m_t and visitChildren.

operator()()

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

Declaration at line 94 of file mandocvisitor.h, definition at line 855 of file mandocvisitor.cpp.

856{
857 if (m_hide) return;
858 m_t << "\\fB";
859 if (!ref.hasLinkText()) filter(ref.targetTitle());
860 visitChildren(ref);
861 m_t << "\\fP";
862}

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

operator()()

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

Declaration at line 95 of file mandocvisitor.h, definition at line 864 of file mandocvisitor.cpp.

865{
866 if (m_hide) return;
867 QCString ws;
868 if (m_indent>0) ws.fill(' ',2*(m_indent-1));
869 if (!m_firstCol) m_t << "\n";
870 m_t << ".IP \"" << ws << "\\(bu\" " << (2*m_indent) << "\n";
872 visitChildren(ref);
873 m_t << "\n";
875}

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

operator()()

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

Declaration at line 96 of file mandocvisitor.h, definition at line 877 of file mandocvisitor.cpp.

878{
879 if (m_hide) return;
880 m_indent++;
882 m_indent--;
883 if (!m_firstCol) m_t << "\n";
884 m_t << ".PP\n";
885}

References m_firstCol, m_hide, m_indent, m_t and visitChildren.

operator()()

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

Declaration at line 97 of file mandocvisitor.h, definition at line 887 of file mandocvisitor.cpp.

888{
889 if (m_hide) return;
890 if (!m_firstCol)
891 {
892 m_t << "\n";
893 m_t << ".PP\n";
894 }
895 m_t << "\\fB";
896 switch(s.type())
897 {
899 m_t << theTranslator->trParameters(); break;
901 m_t << theTranslator->trReturnValues(); break;
903 m_t << theTranslator->trExceptions(); break;
905 m_t << theTranslator->trTemplateParameters(); break;
906 default:
907 ASSERT(0);
908 }
909 m_t << "\\fP\n";
910 m_t << ".RS 4\n";
912 if (!m_firstCol) m_t << "\n";
913 m_t << ".RE\n";
914 m_t << ".PP\n";
916}

References ASSERT, DocParamSect::Exception, m_firstCol, m_hide, m_t, DocParamSect::Param, DocParamSect::RetVal, DocParamSect::TemplateParam, theTranslator, TRUE, DocParamSect::type and visitChildren.

operator()()

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

Declaration at line 98 of file mandocvisitor.h, definition at line 918 of file mandocvisitor.cpp.

919{
920 if (m_hide) return;
921 m_t << "\\fI";
922 bool first=TRUE;
923 for (const auto &param : pl.parameters())
924 {
925 if (!first) m_t << ","; else first=FALSE;
926 std::visit(*this,param);
927 }
928 m_t << "\\fP ";
929 for (const auto &par : pl.paragraphs())
930 {
931 std::visit(*this,par);
932 }
933 if (!pl.isLast())
934 {
935 if (!m_firstCol) m_t << "\n";
936 m_t << ".br\n";
937 }
938}

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

operator()()

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

Declaration at line 99 of file mandocvisitor.h, definition at line 940 of file mandocvisitor.cpp.

941{
942 if (m_hide) return;
943 if (x.title().isEmpty()) return;
944 if (!m_firstCol)
945 {
946 m_t << "\n";
947 m_t << ".PP\n";
948 }
949 m_t << "\\fB";
950 filter(x.title());
951 m_t << "\\fP\n";
952 m_t << ".RS 4\n";
954 if (x.title().isEmpty()) return;
955 if (!m_firstCol) m_t << "\n";
956 m_t << ".RE\n";
957 m_t << ".PP\n";
959}

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

operator()()

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

Declaration at line 100 of file mandocvisitor.h, definition at line 961 of file mandocvisitor.cpp.

962{
963 if (m_hide) return;
964 m_t << "\\fB";
965 visitChildren(ref);
966 m_t << "\\fP";
967}

References m_hide, m_t and visitChildren.

operator()()

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

Declaration at line 101 of file mandocvisitor.h, definition at line 969 of file mandocvisitor.cpp.

970{
972}

Reference visitChildren.

operator()()

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

Declaration at line 102 of file mandocvisitor.h, definition at line 974 of file mandocvisitor.cpp.

975{
976 if (m_hide) return;
977 if (!m_firstCol)
978 {
979 m_t << "\n";
980 m_t << ".PP\n";
981 }
982 m_t << ".RS 4\n"; // TODO: add support for nested block quotes
984 if (!m_firstCol) m_t << "\n";
985 m_t << ".RE\n";
986 m_t << ".PP\n";
988}

References m_firstCol, m_hide, m_t, TRUE and visitChildren.

operator()()

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

Declaration at line 103 of file mandocvisitor.h, definition at line 990 of file mandocvisitor.cpp.

991{
992}

operator()()

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

Declaration at line 104 of file mandocvisitor.h, definition at line 994 of file mandocvisitor.cpp.

995{
996 visitChildren(pb);
997}

Reference visitChildren.

Private Member Functions

filter()

void ManDocVisitor::filter (const QCString & str, const bool retainNewline=false)

Declaration at line 120 of file mandocvisitor.h, definition at line 999 of file mandocvisitor.cpp.

999void ManDocVisitor::filter(const QCString &str, const bool retainNewline)
1000{
1001 if (!str.isEmpty())
1002 {
1003 const char *p=str.data();
1004 char c=0;
1005 bool insideDoubleQuote = false;
1006 while ((c=*p++))
1007 {
1008 switch(c)
1009 {
1010 case '.': m_t << "\\&."; break; // see bug652277
1011 case '\\': m_t << "\\\\"; break;
1012 case '\"': m_t << "\""; insideDoubleQuote = !insideDoubleQuote; break;
1013 case '\n': if (retainNewline || !insideDoubleQuote) m_t << c; break;
1014 default: m_t << c; break;
1015 }
1016 }
1017 }
1018}

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

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

visitChildren()

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

Private Member Attributes

m_ci

OutputCodeList& ManDocVisitor::m_ci

Definition at line 127 of file mandocvisitor.h.

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

m_firstCol

m_hide

m_indent

int ManDocVisitor::m_indent

m_insidePre

bool ManDocVisitor::m_insidePre

Definition at line 128 of file mandocvisitor.h.

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

m_langExt

QCString ManDocVisitor::m_langExt

Definition at line 132 of file mandocvisitor.h.

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

m_listItemInfo

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

Definition at line 141 of file mandocvisitor.h.

141 std::array<ManListItemInfo,maxIndentLevels> m_listItemInfo;

Referenced by operator() and operator().

m_t

Private Static Attributes

maxIndentLevels

const int ManDocVisitor::maxIndentLevels = 13
static

Definition at line 139 of file mandocvisitor.h.

139 static const int maxIndentLevels = 13;

Referenced by operator() and operator().


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.