Doxygen
Loading...
Searching...
No Matches
latexdocvisitor.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2022 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#include <algorithm>
17#include <array>
18
19#include "htmlattrib.h"
20#include "latexdocvisitor.h"
21#include "latexgen.h"
22#include "docparser.h"
23#include "language.h"
24#include "doxygen.h"
25#include "outputgen.h"
26#include "outputlist.h"
27#include "dot.h"
28#include "util.h"
29#include "message.h"
30#include "parserintf.h"
31#include "msc.h"
32#include "dia.h"
33#include "cite.h"
34#include "filedef.h"
35#include "config.h"
36#include "htmlentity.h"
37#include "emoji.h"
38#include "plantuml.h"
39#include "mermaid.h"
40#include "fileinfo.h"
41#include "regex.h"
42#include "portable.h"
43#include "codefragment.h"
44#include "md5.h"
45
46static const int g_maxLevels = 7;
47static const std::array<const char *,g_maxLevels> g_secLabels =
48{ "doxysection",
49 "doxysubsection",
50 "doxysubsubsection",
51 "doxysubsubsubsection",
52 "doxysubsubsubsubsection",
53 "doxysubsubsubsubsubsection",
54 "doxysubsubsubsubsubsubsection"
55};
56
57static const char *g_paragraphLabel = "doxyparagraph";
58static const char *g_subparagraphLabel = "doxysubparagraph";
59
60const char *LatexDocVisitor::getSectionName(int level) const
61{
62 bool compactLatex = Config_getBool(COMPACT_LATEX);
63 int l = level;
64 if (compactLatex) l++;
65
66 if (l < g_maxLevels)
67 {
68 l += m_hierarchyLevel; /* May be -1 if generating main page */
69 // Sections get special treatment because they inherit the parent's level
70 if (l >= g_maxLevels)
71 {
72 l = g_maxLevels - 1;
73 }
74 else if (l < 0)
75 {
76 /* Should not happen; level is always >= 1 and hierarchyLevel >= -1 */
77 l = 0;
78 }
79 return g_secLabels[l];
80 }
81 else if (l == 7)
82 {
83 return g_paragraphLabel;
84 }
85 else
86 {
88 }
89}
90
91static void insertDimension(TextStream &t, QCString dimension, const char *orientationString)
92{
93 // dimensions for latex images can be a percentage, in this case they need some extra
94 // handling as the % symbol is used for comments
95 static const reg::Ex re(R"((\d+)%)");
96 std::string s = dimension.str();
97 reg::Match match;
98 if (reg::search(s,match,re))
99 {
100 bool ok = false;
101 double percent = QCString(match[1].str()).toInt(&ok);
102 if (ok)
103 {
104 t << percent/100.0 << "\\text" << orientationString;
105 return;
106 }
107 }
108 t << dimension;
109}
110
111static void visitPreStart(TextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage = FALSE)
112{
113 if (inlineImage)
114 {
115 t << "\n\\begin{DoxyInlineImage}%\n";
116 }
117 else
118 {
119 if (hasCaption)
120 {
121 t << "\n\\begin{DoxyImage}%\n";
122 }
123 else
124 {
125 t << "\n\\begin{DoxyImageNoCaption}%\n"
126 " \\doxymbox{";
127 }
128 }
129
130 t << "\\includegraphics";
131 if (!width.isEmpty() || !height.isEmpty())
132 {
133 t << "[";
134 }
135 if (!width.isEmpty())
136 {
137 t << "width=";
138 insertDimension(t, width, "width");
139 }
140 if (!width.isEmpty() && !height.isEmpty())
141 {
142 t << ",";
143 }
144 if (!height.isEmpty())
145 {
146 t << "height=";
147 insertDimension(t, height, "height");
148 }
149 if (width.isEmpty() && height.isEmpty())
150 {
151 /* default setting */
152 if (inlineImage)
153 {
154 t << "[height=\\baselineskip,keepaspectratio=true]";
155 }
156 else
157 {
158 t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
159 }
160 }
161 else
162 {
163 t << "]";
164 }
165
166 t << "{" << name << "}";
167
168 if (hasCaption)
169 {
170 if (!inlineImage)
171 {
172 if (Config_getBool(PDF_HYPERLINKS))
173 {
174 t << "%\n\\doxyfigcaption{";
175 }
176 else
177 {
178 t << "%\n\\doxyfigcaptionnolink{";
179 }
180 }
181 else
182 {
183 t << "%"; // to catch the caption
184 }
185 }
186}
187
188
189
190static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE)
191{
192 if (inlineImage)
193 {
194 t << "%\n\\end{DoxyInlineImage}\n";
195 }
196 else
197 {
198 t << "}%\n"; // end doxymbox or caption
199 if (hasCaption)
200 {
201 t << "\\end{DoxyImage}\n";
202 }
203 else
204 {
205 t << "\\end{DoxyImageNoCaption}\n";
206 }
207 }
208}
209
211{
212 for (const auto &n : children)
213 {
214 std::visit(*this,n);
215 }
216}
217
219 const QCString &langExt, int hierarchyLevel)
220 : m_t(t), m_ci(ci), m_lcg(lcg), m_insidePre(FALSE),
222 m_langExt(langExt), m_hierarchyLevel(hierarchyLevel)
223{
224}
225
226 //--------------------------------------
227 // visitor functions for leaf nodes
228 //--------------------------------------
229
231{
232 if (m_hide) return;
233 filter(w.word());
234}
235
237{
238 if (m_hide) return;
239 startLink(w.ref(),w.file(),w.anchor());
240 filter(w.word());
241 endLink(w.ref(),w.file(),w.anchor());
242}
243
245{
246 if (m_hide) return;
247 if (m_insidePre)
248 {
249 m_t << w.chars();
250 }
251 else
252 {
253 m_t << " ";
254 }
255}
256
258{
259 if (m_hide) return;
260 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
261 const char *res = HtmlEntityMapper::instance().latex(s.symbol());
262 if (res)
263 {
265 {
266 if (pdfHyperlinks)
267 {
268 m_t << "\\texorpdfstring{$<$}{<}";
269 }
270 else
271 {
272 m_t << "$<$";
273 }
274 }
276 {
277 if (pdfHyperlinks)
278 {
279 m_t << "\\texorpdfstring{$>$}{>}";
280 }
281 else
282 {
283 m_t << "$>$";
284 }
285 }
286 else
287 {
288 m_t << res;
289 }
290 }
291 else
292 {
293 err("LaTeX: non supported HTML-entity found: {}\n",HtmlEntityMapper::instance().html(s.symbol(),TRUE));
294 }
295}
296
298{
299 if (m_hide) return;
301 if (!emojiName.isEmpty())
302 {
303 QCString imageName=emojiName.mid(1,emojiName.length()-2); // strip : at start and end
304 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxygenemoji{";
305 filter(emojiName);
306 if (m_texOrPdf != TexOrPdf::PDF) m_t << "}{" << imageName << "}";
307 }
308 else
309 {
310 m_t << s.name();
311 }
312}
313
315{
316 if (m_hide) return;
317 if (Config_getBool(PDF_HYPERLINKS))
318 {
319 m_t << "\\href{";
320 if (u.isEmail()) m_t << "mailto:";
321 m_t << latexFilterURL(u.url()) << "}";
322 }
323 m_t << "{\\texttt{";
324 filter(u.url());
325 m_t << "}}";
326}
327
329{
330 if (m_hide) return;
331 if (m_insideItem)
332 {
333 m_t << "\\\\\n";
334 }
335 else
336 {
337 m_t << "~\\newline\n";
338 }
339}
340
342{
343 if (m_hide) return;
344 if (insideTable())
345 m_t << "\\DoxyHorRuler{1}\n";
346 else
347 m_t << "\\DoxyHorRuler{0}\n";
348}
349
351{
352 if (m_hide) return;
353 switch (s.style())
354 {
356 if (s.enable()) m_t << "{\\bfseries{"; else m_t << "}}";
357 break;
361 if (s.enable()) m_t << "\\sout{"; else m_t << "}";
362 break;
365 if (s.enable()) m_t << "\\uline{"; else m_t << "}";
366 break;
368 if (s.enable()) m_t << "{\\itshape "; else m_t << "}";
369 break;
373 if (s.enable()) m_t << "{\\ttfamily "; else m_t << "}";
374 break;
376 if (s.enable()) m_t << "\\textsubscript{"; else m_t << "}";
377 break;
379 if (s.enable()) m_t << "\\textsuperscript{"; else m_t << "}";
380 break;
382 if (s.enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} ";
383 break;
385 if (s.enable()) m_t << "\n\\footnotesize "; else m_t << "\n\\normalsize ";
386 break;
388 if (s.enable()) m_t << "{\\itshape "; else m_t << "}";
389 break;
391 if (s.enable())
392 {
393 m_t << "\n\\begin{DoxyPre}";
395 }
396 else
397 {
399 m_t << "\\end{DoxyPre}\n";
400 }
401 break;
402 case DocStyleChange::Div: /* HTML only */ break;
403 case DocStyleChange::Span: /* HTML only */ break;
404 }
405}
406
408{
409 if (m_hide) return;
410 QCString lang = m_langExt;
411 if (!s.language().isEmpty()) // explicit language setting
412 {
413 lang = s.language();
414 }
415 SrcLangExt langExt = getLanguageFromCodeLang(lang);
416 switch(s.type())
417 {
419 {
420 m_ci.startCodeFragment("DoxyCode");
421 getCodeParser(lang).parseCode(m_ci,s.context(),s.text(),langExt,
422 Config_getBool(STRIP_CODE_COMMENTS),
423 CodeParserOptions().setExample(s.isExample(),s.exampleFile()));
424 m_ci.endCodeFragment("DoxyCode");
425 }
426 break;
428 filter(s.text(), true);
429 break;
431 m_t << "{\\ttfamily ";
432 filter(s.text(), true);
433 m_t << "}";
434 break;
436 if (isTableNested(s.parent())) // in table
437 {
438 m_t << "\\begin{DoxyCode}{0}";
439 filter(s.text(), true);
440 m_t << "\\end{DoxyCode}\n";
441 }
442 else
443 {
444 m_t << "\\begin{DoxyVerb}";
445 m_t << s.text();
446 m_t << "\\end{DoxyVerb}\n";
447 }
448 break;
454 /* nothing */
455 break;
457 m_t << s.text();
458 break;
459 case DocVerbatim::Dot:
460 {
461 bool exists = false;
462 auto fileName = writeFileContents(Config_getString(LATEX_OUTPUT)+"/inline_dotgraph_", // baseName
463 ".dot", // extension
464 s.text(), // contents
465 exists);
466 if (!fileName.isEmpty())
467 {
468 startDotFile(fileName,s.width(),s.height(),s.hasCaption(),s.srcFile(),s.srcLine(),!exists);
469 visitChildren(s);
471 }
472 }
473 break;
474 case DocVerbatim::Msc:
475 {
476 bool exists = false;
477 auto fileName = writeFileContents(Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_", // baseName
478 ".msc", // extension
479 "msc {"+s.text()+"}", // contents
480 exists);
481 if (!fileName.isEmpty())
482 {
483 writeMscFile(fileName, s, !exists);
484 }
485 }
486 break;
488 {
489 QCString latexOutput = Config_getString(LATEX_OUTPUT);
490 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
491 latexOutput,s.exampleFile(),s.text(),
493 s.engine(),s.srcFile(),s.srcLine(),true);
494
495 for (const auto &baseName: baseNameVector)
496 {
497 writePlantUMLFile(baseName, s);
498 }
499 }
500 break;
502 {
503 QCString latexOutput = Config_getString(LATEX_OUTPUT);
505 latexOutput,s.exampleFile(),s.text(),
507 s.srcFile(),s.srcLine());
508 writeMermaidFile(baseName, s);
509 }
510 break;
511 }
512}
513
515{
516 if (m_hide) return;
517 m_t << "\\label{" << stripPath(anc.file()) << "_" << anc.anchor() << "}%\n";
518 if (!anc.file().isEmpty() && Config_getBool(PDF_HYPERLINKS))
519 {
520 m_t << "\\Hypertarget{" << stripPath(anc.file()) << "_" << anc.anchor()
521 << "}%\n";
522 }
523}
524
526{
527 if (m_hide) return;
529 switch(inc.type())
530 {
532 {
533 m_ci.startCodeFragment("DoxyCodeInclude");
534 FileInfo cfi( inc.file().str() );
535 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
537 inc.text(),
538 langExt,
539 inc.stripCodeComments(),
541 .setExample(inc.isExample(), inc.exampleFile())
542 .setFileDef(fd.get())
543 .setInlineFragment(true)
544 );
545 m_ci.endCodeFragment("DoxyCodeInclude");
546 }
547 break;
549 {
550 m_ci.startCodeFragment("DoxyCodeInclude");
552 inc.text(),langExt,
553 inc.stripCodeComments(),
555 .setExample(inc.isExample(), inc.exampleFile())
556 .setInlineFragment(true)
557 .setShowLineNumbers(false)
558 );
559 m_ci.endCodeFragment("DoxyCodeInclude");
560 }
561 break;
569 break;
571 m_t << inc.text();
572 break;
574 if (isTableNested(inc.parent())) // in table
575 {
576 m_t << "\\begin{DoxyCode}{0}";
577 filter(inc.text(), true);
578 m_t << "\\end{DoxyCode}\n";
579 }
580 else
581 {
582 m_t << "\n\\begin{DoxyVerbInclude}\n";
583 m_t << inc.text();
584 m_t << "\\end{DoxyVerbInclude}\n";
585 }
586 break;
589 {
590 m_ci.startCodeFragment("DoxyCodeInclude");
592 inc.file(),
593 inc.blockId(),
594 inc.context(),
596 inc.trimLeft(),
598 );
599 m_ci.endCodeFragment("DoxyCodeInclude");
600 }
601 break;
602 }
603}
604
606{
607 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
608 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
609 if (op.isFirst())
610 {
611 if (!m_hide) m_ci.startCodeFragment("DoxyCodeInclude");
613 m_hide = TRUE;
614 }
616 if (locLangExt.isEmpty()) locLangExt = m_langExt;
617 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
618 if (op.type()!=DocIncOperator::Skip)
619 {
620 m_hide = popHidden();
621 if (!m_hide)
622 {
623 std::unique_ptr<FileDef> fd;
624 if (!op.includeFileName().isEmpty())
625 {
626 FileInfo cfi( op.includeFileName().str() );
627 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
628 }
629
630 getCodeParser(locLangExt).parseCode(m_ci,op.context(),op.text(),langExt,
633 .setExample(op.isExample(),op.exampleFile())
634 .setFileDef(fd.get())
635 .setStartLine(op.line())
637 );
638 }
640 m_hide=TRUE;
641 }
642 if (op.isLast())
643 {
645 if (!m_hide) m_ci.endCodeFragment("DoxyCodeInclude");
646 }
647 else
648 {
649 if (!m_hide) m_t << "\n";
650 }
651}
652
654{
655 if (m_hide) return;
656 QCString s = f.text();
657 const char *p = s.data();
658 char c = 0;
659 if (p)
660 {
661 while ((c=*p++))
662 {
663 switch (c)
664 {
665 case '\'': m_t << "\\textnormal{\\textquotesingle}"; break;
666 default: m_t << c; break;
667 }
668 }
669 }
670}
671
673{
674 if (m_hide) return;
676}
677
681
683{
684 if (m_hide) return;
685 auto opt = cite.option();
686 QCString txt;
687 if (opt.noCite())
688 {
689 if (!cite.file().isEmpty())
690 {
691 txt = cite.getText();
692 }
693 else
694 {
695 if (!opt.noPar()) txt += "[";
696 txt += cite.target();
697 if (!opt.noPar()) txt += "]";
698 }
699 m_t << "{\\bfseries ";
700 filter(txt);
701 m_t << "}";
702 }
703 else
704 {
705 if (!cite.file().isEmpty())
706 {
707 QCString anchor = cite.anchor();
709 anchor = anchor.mid(anchorPrefix.length()); // strip prefix
710
711 txt = "\\DoxyCite{" + anchor + "}";
712 if (opt.isNumber())
713 {
714 txt += "{number}";
715 }
716 else if (opt.isShortAuthor())
717 {
718 txt += "{shortauthor}";
719 }
720 else if (opt.isYear())
721 {
722 txt += "{year}";
723 }
724 if (!opt.noPar()) txt += "{1}";
725 else txt += "{0}";
726
727 m_t << txt;
728 }
729 else
730 {
731 if (!opt.noPar()) txt += "[";
732 txt += cite.target();
733 if (!opt.noPar()) txt += "]";
734 m_t << "{\\bfseries ";
735 filter(txt);
736 m_t << "}";
737 }
738 }
739}
740
741//--------------------------------------
742// visitor functions for compound nodes
743//--------------------------------------
744
746{
747 if (m_hide) return;
748 if (m_indentLevel>=maxIndentLevels-1) return;
749 if (l.isEnumList())
750 {
751 m_t << "\n\\begin{DoxyEnumerate}";
752 m_listItemInfo[indentLevel()].isEnum = true;
753 }
754 else
755 {
756 m_listItemInfo[indentLevel()].isEnum = false;
757 m_t << "\n\\begin{DoxyItemize}";
758 }
759 visitChildren(l);
760 if (l.isEnumList())
761 {
762 m_t << "\n\\end{DoxyEnumerate}";
763 }
764 else
765 {
766 m_t << "\n\\end{DoxyItemize}";
767 }
768}
769
771{
772 if (m_hide) return;
773 switch (li.itemNumber())
774 {
775 case DocAutoList::Unchecked: // unchecked
776 m_t << "\n\\item[\\DoxyUnchecked] ";
777 break;
778 case DocAutoList::Checked_x: // checked with x
779 case DocAutoList::Checked_X: // checked with X
780 m_t << "\n\\item[\\DoxyChecked] ";
781 break;
782 default:
783 m_t << "\n\\item ";
784 break;
785 }
787 visitChildren(li);
789}
790
792{
793 if (m_hide) return;
794 visitChildren(p);
795 if (!p.isLast() && // omit <p> for last paragraph
796 !(p.parent() && // and for parameter sections
797 std::get_if<DocParamSect>(p.parent())
798 )
799 )
800 {
801 if (insideTable())
802 {
803 m_t << "~\\newline\n";
804 }
805 else
806 {
807 m_t << "\n\n";
808 }
809 }
810}
811
813{
814 visitChildren(r);
815}
816
818{
819 if (m_hide) return;
820 switch(s.type())
821 {
823 m_t << "\\begin{DoxySeeAlso}{";
824 filter(theTranslator->trSeeAlso());
825 break;
827 m_t << "\\begin{DoxyReturn}{";
828 filter(theTranslator->trReturns());
829 break;
831 m_t << "\\begin{DoxyAuthor}{";
832 filter(theTranslator->trAuthor(TRUE,TRUE));
833 break;
835 m_t << "\\begin{DoxyAuthor}{";
836 filter(theTranslator->trAuthor(TRUE,FALSE));
837 break;
839 m_t << "\\begin{DoxyVersion}{";
840 filter(theTranslator->trVersion());
841 break;
843 m_t << "\\begin{DoxySince}{";
844 filter(theTranslator->trSince());
845 break;
847 m_t << "\\begin{DoxyDate}{";
848 filter(theTranslator->trDate());
849 break;
851 m_t << "\\begin{DoxyNote}{";
852 filter(theTranslator->trNote());
853 break;
855 m_t << "\\begin{DoxyWarning}{";
856 filter(theTranslator->trWarning());
857 break;
859 m_t << "\\begin{DoxyPrecond}{";
860 filter(theTranslator->trPrecondition());
861 break;
863 m_t << "\\begin{DoxyPostcond}{";
864 filter(theTranslator->trPostcondition());
865 break;
867 m_t << "\\begin{DoxyCopyright}{";
868 filter(theTranslator->trCopyright());
869 break;
871 m_t << "\\begin{DoxyInvariant}{";
872 filter(theTranslator->trInvariant());
873 break;
875 m_t << "\\begin{DoxyRemark}{";
876 filter(theTranslator->trRemarks());
877 break;
879 m_t << "\\begin{DoxyAttention}{";
880 filter(theTranslator->trAttention());
881 break;
883 m_t << "\\begin{DoxyImportant}{";
884 filter(theTranslator->trImportant());
885 break;
887 m_t << "\\begin{DoxyParagraph}{";
888 break;
890 m_t << "\\begin{DoxyParagraph}{";
891 break;
892 case DocSimpleSect::Unknown: break;
893 }
894
895 if (s.title())
896 {
898 std::visit(*this,*s.title());
900 }
901 m_t << "}\n";
903 visitChildren(s);
904 switch(s.type())
905 {
907 m_t << "\n\\end{DoxySeeAlso}\n";
908 break;
910 m_t << "\n\\end{DoxyReturn}\n";
911 break;
913 m_t << "\n\\end{DoxyAuthor}\n";
914 break;
916 m_t << "\n\\end{DoxyAuthor}\n";
917 break;
919 m_t << "\n\\end{DoxyVersion}\n";
920 break;
922 m_t << "\n\\end{DoxySince}\n";
923 break;
925 m_t << "\n\\end{DoxyDate}\n";
926 break;
928 m_t << "\n\\end{DoxyNote}\n";
929 break;
931 m_t << "\n\\end{DoxyWarning}\n";
932 break;
934 m_t << "\n\\end{DoxyPrecond}\n";
935 break;
937 m_t << "\n\\end{DoxyPostcond}\n";
938 break;
940 m_t << "\n\\end{DoxyCopyright}\n";
941 break;
943 m_t << "\n\\end{DoxyInvariant}\n";
944 break;
946 m_t << "\n\\end{DoxyRemark}\n";
947 break;
949 m_t << "\n\\end{DoxyAttention}\n";
950 break;
952 m_t << "\n\\end{DoxyImportant}\n";
953 break;
955 m_t << "\n\\end{DoxyParagraph}\n";
956 break;
958 m_t << "\n\\end{DoxyParagraph}\n";
959 break;
960 default:
961 break;
962 }
964}
965
967{
968 if (m_hide) return;
969 visitChildren(t);
970}
971
973{
974 if (m_hide) return;
975 m_t << "\\begin{DoxyItemize}\n";
976 m_listItemInfo[indentLevel()].isEnum = false;
977 visitChildren(l);
978 m_t << "\\end{DoxyItemize}\n";
979}
980
982{
983 if (m_hide) return;
984 m_t << "\\item ";
986 if (li.paragraph())
987 {
988 visit(*this,*li.paragraph());
989 }
991}
992
994{
995 if (m_hide) return;
996 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
997 if (pdfHyperlinks)
998 {
999 m_t << "\\hypertarget{" << stripPath(s.file()) << "_" << s.anchor() << "}{}";
1000 }
1001 m_t << "\\" << getSectionName(s.level()) << "{";
1002 if (pdfHyperlinks)
1003 {
1004 m_t << "\\texorpdfstring{";
1005 }
1006 if (s.title())
1007 {
1008 if (pdfHyperlinks) m_texOrPdf = TexOrPdf::TEX;
1009 std::visit(*this,*s.title());
1011 }
1012 if (pdfHyperlinks)
1013 {
1014 m_t << "}{";
1015 if (s.title())
1016 {
1017 if (pdfHyperlinks) m_texOrPdf = TexOrPdf::PDF;
1018 std::visit(*this,*s.title());
1020 }
1021 m_t << "}";
1022 }
1023 m_t << "}\\label{" << stripPath(s.file()) << "_" << s.anchor() << "}\n";
1024 visitChildren(s);
1025}
1026
1028{
1029 if (m_hide) return;
1030 if (m_indentLevel>=maxIndentLevels-1) return;
1032 if (s.type()==DocHtmlList::Ordered)
1033 {
1034 bool first = true;
1035 m_t << "\n\\begin{DoxyEnumerate}";
1036 for (const auto &opt : s.attribs())
1037 {
1038 if (opt.name=="type")
1039 {
1040 if (opt.value=="1")
1041 {
1042 m_t << (first ? "[": ",");
1043 m_t << "label=\\arabic*";
1044 first = false;
1045 }
1046 else if (opt.value=="a")
1047 {
1048 m_t << (first ? "[": ",");
1049 m_t << "label=\\enumalphalphcnt*";
1050 first = false;
1051 }
1052 else if (opt.value=="A")
1053 {
1054 m_t << (first ? "[": ",");
1055 m_t << "label=\\enumAlphAlphcnt*";
1056 first = false;
1057 }
1058 else if (opt.value=="i")
1059 {
1060 m_t << (first ? "[": ",");
1061 m_t << "label=\\roman*";
1062 first = false;
1063 }
1064 else if (opt.value=="I")
1065 {
1066 m_t << (first ? "[": ",");
1067 m_t << "label=\\Roman*";
1068 first = false;
1069 }
1070 }
1071 else if (opt.name=="start")
1072 {
1073 m_t << (first ? "[": ",");
1074 bool ok = false;
1075 int val = opt.value.toInt(&ok);
1076 if (ok) m_t << "start=" << val;
1077 first = false;
1078 }
1079 }
1080 if (!first) m_t << "]\n";
1081 }
1082 else
1083 {
1084 m_t << "\n\\begin{DoxyItemize}";
1085 }
1086 visitChildren(s);
1087 if (m_indentLevel>=maxIndentLevels-1) return;
1088 if (s.type()==DocHtmlList::Ordered)
1089 m_t << "\n\\end{DoxyEnumerate}";
1090 else
1091 m_t << "\n\\end{DoxyItemize}";
1092}
1093
1095{
1096 if (m_hide) return;
1097 if (m_listItemInfo[indentLevel()].isEnum)
1098 {
1099 for (const auto &opt : l.attribs())
1100 {
1101 if (opt.name=="value")
1102 {
1103 bool ok = false;
1104 int val = opt.value.toInt(&ok);
1105 if (ok)
1106 {
1107 m_t << "\n\\setcounter{DoxyEnumerate" << integerToRoman(indentLevel()+1,false) << "}{" << (val - 1) << "}";
1108 }
1109 }
1110 }
1111 }
1112 m_t << "\n\\item ";
1114 visitChildren(l);
1116}
1117
1118
1120{
1121 HtmlAttribList attrs = dl.attribs();
1122 auto it = std::find_if(attrs.begin(),attrs.end(),
1123 [](const auto &att) { return att.name=="class"; });
1124 if (it!=attrs.end() && it->value == "reflist") return true;
1125 return false;
1126}
1127
1128static bool listIsNested(const DocHtmlDescList &dl)
1129{
1130 bool isNested=false;
1131 const DocNodeVariant *n = dl.parent();
1132 while (n && !isNested)
1133 {
1134 if (std::get_if<DocHtmlDescList>(n))
1135 {
1136 isNested = !classEqualsReflist(std::get<DocHtmlDescList>(*n));
1137 }
1138 n = ::parent(n);
1139 }
1140 return isNested;
1141}
1142
1144{
1145 if (m_hide) return;
1146 bool eq = classEqualsReflist(dl);
1147 if (eq)
1148 {
1149 m_t << "\n\\begin{DoxyRefList}";
1150 }
1151 else
1152 {
1153 if (listIsNested(dl)) m_t << "\n\\hfill";
1154 m_t << "\n\\begin{DoxyDescription}";
1155 }
1156 visitChildren(dl);
1157 if (eq)
1158 {
1159 m_t << "\n\\end{DoxyRefList}";
1160 }
1161 else
1162 {
1163 m_t << "\n\\end{DoxyDescription}";
1164 }
1165}
1166
1168{
1169 if (m_hide) return;
1170 m_t << "\n\\item[{\\parbox[t]{\\linewidth}{";
1172 visitChildren(dt);
1174 m_t << "}}]";
1175}
1176
1178{
1180 if (!m_insideItem) m_t << "\\hfill";
1181 m_t << " \\\\\n";
1182 visitChildren(dd);
1184}
1185
1187{
1188 bool isNested=m_lcg.usedTableLevel()>0;
1189 while (n && !isNested)
1190 {
1192 n = ::parent(n);
1193 }
1194 return isNested;
1195}
1196
1198{
1199 if (isTableNested(n))
1200 {
1201 m_t << "\\begin{DoxyTableNested}{" << cols << "}";
1202 }
1203 else
1204 {
1205 m_t << "\n\\begin{DoxyTable}{" << cols << "}";
1206 }
1207}
1208
1210{
1211 if (isTableNested(n))
1212 {
1213 m_t << "\\end{DoxyTableNested}\n";
1214 }
1215 else
1216 {
1217 m_t << "\\end{DoxyTable}\n";
1218 }
1219}
1220
1222{
1223 if (m_hide) return;
1225 const DocHtmlCaption *c = t.caption() ? &std::get<DocHtmlCaption>(*t.caption()) : nullptr;
1226 if (c)
1227 {
1228 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1229 if (!c->file().isEmpty() && pdfHyperLinks)
1230 {
1231 m_t << "\\hypertarget{" << stripPath(c->file()) << "_" << c->anchor()
1232 << "}{}";
1233 }
1234 m_t << "\n";
1235 }
1236
1238 if (!isTableNested(t.parent()))
1239 {
1240 // write caption
1241 m_t << "{";
1242 if (c)
1243 {
1244 std::visit(*this, *t.caption());
1245 }
1246 m_t << "}";
1247 // write label
1248 m_t << "{";
1249 if (c && (!stripPath(c->file()).isEmpty() || !c->anchor().isEmpty()))
1250 {
1251 m_t << stripPath(c->file()) << "_" << c->anchor();
1252 }
1253 m_t << "}";
1254 }
1255
1256 // write head row(s)
1257 m_t << "{" << t.numberHeaderRows() << "}\n";
1258
1260
1261 visitChildren(t);
1263 popTableState();
1264}
1265
1267{
1268 if (m_hide) return;
1269 visitChildren(c);
1270}
1271
1273{
1274 if (m_hide) return;
1276
1277 visitChildren(row);
1278
1279 m_t << "\\\\";
1280
1281 size_t col = 1;
1282 for (auto &span : rowSpans())
1283 {
1284 if (span.rowSpan>0) span.rowSpan--;
1285 if (span.rowSpan<=0)
1286 {
1287 // inactive span
1288 }
1289 else if (span.column>col)
1290 {
1291 col = span.column+span.colSpan;
1292 }
1293 else
1294 {
1295 col = span.column+span.colSpan;
1296 }
1297 }
1298
1299 m_t << "\n";
1300}
1301
1303{
1304 if (m_hide) return;
1305 //printf("Cell(r=%u,c=%u) rowSpan=%d colSpan=%d currentColumn()=%zu\n",c.rowIndex(),c.columnIndex(),c.rowSpan(),c.colSpan(),currentColumn());
1306
1308
1309 QCString cellOpts;
1310 QCString cellSpec;
1311 auto appendOpt = [&cellOpts](const QCString &s)
1312 {
1313 if (!cellOpts.isEmpty()) cellOpts+=",";
1314 cellOpts+=s;
1315 };
1316 auto appendSpec = [&cellSpec](const QCString &s)
1317 {
1318 if (!cellSpec.isEmpty()) cellSpec+=",";
1319 cellSpec+=s;
1320 };
1321 auto writeCell = [this,&cellOpts,&cellSpec]()
1322 {
1323 if (!cellOpts.isEmpty() || !cellSpec.isEmpty())
1324 {
1325 m_t << "\\SetCell";
1326 if (!cellOpts.isEmpty())
1327 {
1328 m_t << "[" << cellOpts << "]";
1329 }
1330 m_t << "{" << cellSpec << "}";
1331 }
1332 };
1333
1334 // skip over columns that have a row span starting at an earlier row
1335 for (const auto &span : rowSpans())
1336 {
1337 //printf("span(r=%u,c=%u): column=%zu colSpan=%zu,rowSpan=%zu currentColumn()=%zu\n",
1338 // span.cell.rowIndex(),span.cell.columnIndex(),
1339 // span.column,span.colSpan,span.rowSpan,
1340 // currentColumn());
1341 if (span.rowSpan>0 && span.column==currentColumn())
1342 {
1343 setCurrentColumn(currentColumn()+span.colSpan);
1344 for (size_t i=0;i<span.colSpan;i++)
1345 {
1346 m_t << "&";
1347 }
1348 }
1349 }
1350
1351 int cs = c.colSpan();
1352 int ha = c.alignment();
1353 int rs = c.rowSpan();
1354 int va = c.valignment();
1355
1356 switch (ha) // horizontal alignment
1357 {
1358 case DocHtmlCell::Right:
1359 appendSpec("r");
1360 break;
1362 appendSpec("c");
1363 break;
1364 default:
1365 // default
1366 break;
1367 }
1368 if (rs>0) // row span
1369 {
1370 appendOpt("r="+QCString().setNum(rs));
1371 //printf("adding row span: cell={r=%d c=%d rs=%d cs=%d} curCol=%zu\n",
1372 // c.rowIndex(),c.columnIndex(),c.rowSpan(),c.colSpan(),
1373 // currentColumn());
1375 }
1376 if (cs>1) // column span
1377 {
1378 // update column to the end of the span, needs to be done *after* calling addRowSpan()
1380 appendOpt("c="+QCString().setNum(cs));
1381 }
1382 if (c.isHeading())
1383 {
1384 appendSpec("bg=\\tableheadbgcolor");
1385 appendSpec("font=\\bfseries");
1386 }
1387 switch(va) // vertical alignment
1388 {
1389 case DocHtmlCell::Top:
1390 appendSpec("h");
1391 break;
1393 appendSpec("f");
1394 break;
1396 // default
1397 break;
1398 }
1399 writeCell();
1400
1401 visitChildren(c);
1402
1403 for (int i=0;i<cs-1;i++)
1404 {
1405 m_t << "&"; // placeholder for invisible cell
1406 }
1407
1408 if (!c.isLast()) m_t << "&";
1409}
1410
1412{
1413 if (m_hide) return;
1414 visitChildren(i);
1415}
1416
1418{
1419 if (m_hide) return;
1420 if (Config_getBool(PDF_HYPERLINKS))
1421 {
1422 m_t << "\\href{";
1423 m_t << latexFilterURL(href.url());
1424 m_t << "}";
1425 }
1426 m_t << "{\\texttt{";
1427 visitChildren(href);
1428 m_t << "}}";
1429}
1430
1432{
1433 if (m_hide) return;
1434 m_t << "{\\bfseries{";
1435 visitChildren(d);
1436 m_t << "}}";
1437}
1438
1440{
1441 if (m_hide) return;
1442 m_t << "\n\n";
1443 auto summary = d.summary();
1444 if (summary)
1445 {
1446 std::visit(*this,*summary);
1447 m_t << "\\begin{adjustwidth}{1em}{0em}\n";
1448 }
1449 visitChildren(d);
1450 if (summary)
1451 {
1452 m_t << "\\end{adjustwidth}\n";
1453 }
1454 else
1455 {
1456 m_t << "\n\n";
1457 }
1458}
1459
1461{
1462 if (m_hide) return;
1463 m_t << "\\" << getSectionName(header.level()) << "*{";
1464 visitChildren(header);
1465 m_t << "}";
1466}
1467
1469{
1470 if (img.type()==DocImage::Latex)
1471 {
1472 if (m_hide) return;
1473 QCString gfxName = img.name();
1474 if (gfxName.endsWith(".eps") || gfxName.endsWith(".pdf"))
1475 {
1476 gfxName=gfxName.left(gfxName.length()-4);
1477 }
1478
1479 visitPreStart(m_t,img.hasCaption(), gfxName, img.width(), img.height(), img.isInlineImage());
1480 visitChildren(img);
1482 }
1483 else // other format -> skip
1484 {
1485 }
1486}
1487
1489{
1490 if (m_hide) return;
1491 bool exists = false;
1492 std::string inBuf;
1493 if (readInputFile(df.file(),inBuf))
1494 {
1495 auto fileName = writeFileContents(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1496 ".dot", // extension
1497 inBuf, // contents
1498 exists);
1499 if (!fileName.isEmpty())
1500 {
1501 startDotFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1502 visitChildren(df);
1503 endDotFile(df.hasCaption());
1504 }
1505 }
1506}
1507
1509{
1510 if (m_hide) return;
1511 bool exists = false;
1512 std::string inBuf;
1513 if (readInputFile(df.file(),inBuf))
1514 {
1515 auto fileName = writeFileContents(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1516 ".msc", // extension
1517 inBuf, // contents
1518 exists);
1519 if (!fileName.isEmpty())
1520 {
1521 startMscFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1522 visitChildren(df);
1523 endMscFile(df.hasCaption());
1524 }
1525 }
1526}
1527
1529{
1530 if (m_hide) return;
1531 bool exists = false;
1532 std::string inBuf;
1533 if (readInputFile(df.file(),inBuf))
1534 {
1535 auto fileName = writeFileContents(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1536 ".dia", // extension
1537 inBuf, // contents
1538 exists);
1539 if (!fileName.isEmpty())
1540 {
1541 startDiaFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1542 visitChildren(df);
1543 endDiaFile(df.hasCaption());
1544 }
1545 }
1546}
1547
1549{
1550 if (m_hide) return;
1551 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file()));
1552 startPlantUmlFile(df.file(),df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine());
1553 visitChildren(df);
1555}
1556
1558{
1559 if (m_hide) return;
1560 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file()));
1561 startMermaidFile(df.file(),df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine());
1562 visitChildren(df);
1564}
1565
1567{
1568 if (m_hide) return;
1569 startLink(lnk.ref(),lnk.file(),lnk.anchor());
1570 visitChildren(lnk);
1571 endLink(lnk.ref(),lnk.file(),lnk.anchor());
1572}
1573
1575{
1576 if (m_hide) return;
1577 // when ref.isSubPage()==TRUE we use ref.file() for HTML and
1578 // ref.anchor() for LaTeX/RTF
1579 if (ref.isSubPage())
1580 {
1581 startLink(ref.ref(),QCString(),ref.anchor());
1582 }
1583 else
1584 {
1585 if (!ref.file().isEmpty()) startLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable(),ref.refToSection());
1586 }
1587 if (!ref.hasLinkText())
1588 {
1589 filter(ref.targetTitle());
1590 }
1591 visitChildren(ref);
1592 if (ref.isSubPage())
1593 {
1594 endLink(ref.ref(),QCString(),ref.anchor());
1595 }
1596 else
1597 {
1598 if (!ref.file().isEmpty()) endLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable(),ref.refToSection(),ref.sectionType());
1599 }
1600}
1601
1603{
1604 if (m_hide) return;
1605 m_t << "\\item \\contentsline{section}{";
1606 if (ref.isSubPage())
1607 {
1608 startLink(ref.ref(),QCString(),ref.anchor());
1609 }
1610 else
1611 {
1612 if (!ref.file().isEmpty())
1613 {
1614 startLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable());
1615 }
1616 }
1617 visitChildren(ref);
1618 if (ref.isSubPage())
1619 {
1620 endLink(ref.ref(),QCString(),ref.anchor());
1621 }
1622 else
1623 {
1624 if (!ref.file().isEmpty()) endLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable());
1625 }
1626 m_t << "}{\\ref{";
1627 if (!ref.file().isEmpty()) m_t << stripPath(ref.file());
1628 if (!ref.file().isEmpty() && !ref.anchor().isEmpty()) m_t << "_";
1629 if (!ref.anchor().isEmpty()) m_t << ref.anchor();
1630 m_t << "}}{}\n";
1631}
1632
1634{
1635 if (m_hide) return;
1636 m_t << "\\footnotesize\n";
1637 m_t << "\\begin{multicols}{2}\n";
1638 m_t << "\\begin{DoxyCompactList}\n";
1640 visitChildren(l);
1642 m_t << "\\end{DoxyCompactList}\n";
1643 m_t << "\\end{multicols}\n";
1644 m_t << "\\normalsize\n";
1645}
1646
1648{
1649 if (m_hide) return;
1650 bool hasInOutSpecs = s.hasInOutSpecifier();
1651 bool hasTypeSpecs = s.hasTypeSpecifier();
1652 m_lcg.incUsedTableLevel();
1653 switch(s.type())
1654 {
1656 m_t << "\n\\begin{DoxyParams}";
1657 if (hasInOutSpecs && hasTypeSpecs) m_t << "[2]"; // 2 extra cols
1658 else if (hasInOutSpecs || hasTypeSpecs) m_t << "[1]"; // 1 extra col
1659 m_t << "{";
1660 filter(theTranslator->trParameters());
1661 break;
1663 m_t << "\n\\begin{DoxyRetVals}{";
1664 filter(theTranslator->trReturnValues());
1665 break;
1667 m_t << "\n\\begin{DoxyExceptions}{";
1668 filter(theTranslator->trExceptions());
1669 break;
1671 m_t << "\n\\begin{DoxyTemplParams}{";
1672 filter(theTranslator->trTemplateParameters());
1673 break;
1674 default:
1675 ASSERT(0);
1677 }
1678 m_t << "}\n";
1679 visitChildren(s);
1680 m_lcg.decUsedTableLevel();
1681 switch(s.type())
1682 {
1684 m_t << "\\end{DoxyParams}\n";
1685 break;
1687 m_t << "\\end{DoxyRetVals}\n";
1688 break;
1690 m_t << "\\end{DoxyExceptions}\n";
1691 break;
1693 m_t << "\\end{DoxyTemplParams}\n";
1694 break;
1695 default:
1696 ASSERT(0);
1698 }
1699}
1700
1702{
1703 m_t << " " << sep.chars() << " ";
1704}
1705
1707{
1708 if (m_hide) return;
1710 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
1711 if (sect)
1712 {
1713 parentType = sect->type();
1714 }
1715 bool useTable = parentType==DocParamSect::Param ||
1716 parentType==DocParamSect::RetVal ||
1717 parentType==DocParamSect::Exception ||
1718 parentType==DocParamSect::TemplateParam;
1719 if (!useTable)
1720 {
1721 m_t << "\\item[";
1722 }
1723 if (sect && sect->hasInOutSpecifier())
1724 {
1726 {
1727 m_t << "\\doxymbox{\\texttt{";
1728 if (pl.direction()==DocParamSect::In)
1729 {
1730 m_t << "in";
1731 }
1732 else if (pl.direction()==DocParamSect::Out)
1733 {
1734 m_t << "out";
1735 }
1736 else if (pl.direction()==DocParamSect::InOut)
1737 {
1738 m_t << "in,out";
1739 }
1740 m_t << "}} ";
1741 }
1742 if (useTable) m_t << " & ";
1743 }
1744 if (sect && sect->hasTypeSpecifier())
1745 {
1746 for (const auto &type : pl.paramTypes())
1747 {
1748 std::visit(*this,type);
1749 }
1750 if (useTable) m_t << " & ";
1751 }
1752 m_t << "{\\em ";
1753 bool first=TRUE;
1754 for (const auto &param : pl.parameters())
1755 {
1756 if (!first) m_t << ","; else first=FALSE;
1758 std::visit(*this,param);
1760 }
1761 m_t << "}";
1762 if (useTable)
1763 {
1764 m_t << " & ";
1765 }
1766 else
1767 {
1768 m_t << "]";
1769 }
1770 for (const auto &par : pl.paragraphs())
1771 {
1772 std::visit(*this,par);
1773 }
1774 if (useTable)
1775 {
1776 m_t << "\\\\\n"
1777 << "\\hline\n";
1778 }
1779}
1780
1782{
1783 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1784 if (m_hide) return;
1785 if (x.title().isEmpty()) return;
1787 m_t << "\\begin{DoxyRefDesc}{";
1788 filter(x.title());
1789 m_t << "}\n";
1790 bool anonymousEnum = x.file()=="@";
1791 m_t << "\\item[";
1792 if (pdfHyperlinks && !anonymousEnum)
1793 {
1794 m_t << "\\doxymbox{\\hyperlink{" << stripPath(x.file()) << "_" << x.anchor() << "}{";
1795 }
1796 else
1797 {
1798 m_t << "\\textbf{ ";
1799 }
1801 filter(x.title());
1803 if (pdfHyperlinks && !anonymousEnum)
1804 {
1805 m_t << "}";
1806 }
1807 m_t << "}]";
1808 visitChildren(x);
1809 if (x.title().isEmpty()) return;
1811 m_t << "\\end{DoxyRefDesc}\n";
1812}
1813
1815{
1816 if (m_hide) return;
1817 startLink(QCString(),ref.file(),ref.anchor());
1818 visitChildren(ref);
1819 endLink(QCString(),ref.file(),ref.anchor());
1820}
1821
1823{
1824 if (m_hide) return;
1825 visitChildren(t);
1826}
1827
1829{
1830 if (m_hide) return;
1831 m_t << "\\begin{quote}\n";
1833 visitChildren(q);
1834 m_t << "\\end{quote}\n";
1836}
1837
1841
1843{
1844 if (m_hide) return;
1845 visitChildren(pb);
1846}
1847
1848void LatexDocVisitor::filter(const QCString &str, const bool retainNewLine)
1849{
1850 //printf("LatexDocVisitor::filter(%s) m_insideTabbing=%d m_insideTable=%d\n",qPrint(str),m_lcg.insideTabbing(),m_lcg.usedTableLevel()>0);
1852 m_lcg.insideTabbing(),
1855 m_lcg.usedTableLevel()>0, // insideTable
1856 false, // keepSpaces
1857 retainNewLine
1858 );
1859}
1860
1861void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor,
1862 bool refToTable,bool refToSection)
1863{
1864 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1865 if (ref.isEmpty() && pdfHyperLinks) // internal PDF link
1866 {
1867 if (refToTable)
1868 {
1869 m_t << "\\doxytablelink{";
1870 }
1871 else if (refToSection)
1872 {
1873 if (m_texOrPdf == TexOrPdf::TEX) m_t << "\\protect";
1874 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxysectlink{";
1875 }
1876 else
1877 {
1878 if (m_texOrPdf == TexOrPdf::TEX) m_t << "\\protect";
1879 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxylink{";
1880 }
1881 if (refToTable || m_texOrPdf != TexOrPdf::PDF)
1882 {
1883 if (!file.isEmpty()) m_t << stripPath(file);
1884 if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_";
1885 if (!anchor.isEmpty()) m_t << anchor;
1886 m_t << "}";
1887 }
1888 m_t << "{";
1889 }
1890 else if (ref.isEmpty() && refToSection)
1891 {
1892 m_t << "\\doxysectref{";
1893 }
1894 else if (ref.isEmpty() && refToTable)
1895 {
1896 m_t << "\\doxytableref{";
1897 }
1898 else if (ref.isEmpty()) // internal non-PDF link
1899 {
1900 m_t << "\\doxyref{";
1901 }
1902 else // external link
1903 {
1904 m_t << "\\textbf{ ";
1905 }
1906}
1907
1908void LatexDocVisitor::endLink(const QCString &ref,const QCString &file,const QCString &anchor,bool /*refToTable*/,bool refToSection, SectionType sectionType)
1909{
1910 m_t << "}";
1911 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1912 if (ref.isEmpty() && !pdfHyperLinks)
1913 {
1914 m_t << "{";
1915 filter(theTranslator->trPageAbbreviation());
1916 m_t << "}{" << file;
1917 if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_";
1918 m_t << anchor << "}";
1919 if (refToSection)
1920 {
1921 m_t << "{" << sectionType.level() << "}";
1922 }
1923 }
1924 if (ref.isEmpty() && pdfHyperLinks) // internal PDF link
1925 {
1926 if (refToSection)
1927 {
1928 if (m_texOrPdf != TexOrPdf::PDF) m_t << "{" << sectionType.level() << "}";
1929 }
1930 }
1931}
1932
1934 const QCString &width,
1935 const QCString &height,
1936 bool hasCaption,
1937 const QCString &srcFile,
1938 int srcLine, bool newFile
1939 )
1940{
1941 QCString baseName=makeBaseName(fileName,".dot");
1942 baseName.prepend("dot_");
1943 QCString outDir = Config_getString(LATEX_OUTPUT);
1944 if (newFile) writeDotGraphFromFile(fileName,outDir,baseName,GraphOutputFormat::EPS,srcFile,srcLine);
1945 visitPreStart(m_t,hasCaption, baseName, width, height);
1946}
1947
1948void LatexDocVisitor::endDotFile(bool hasCaption)
1949{
1950 if (m_hide) return;
1951 visitPostEnd(m_t,hasCaption);
1952}
1953
1955 const QCString &width,
1956 const QCString &height,
1957 bool hasCaption,
1958 const QCString &srcFile,
1959 int srcLine, bool newFile
1960 )
1961{
1962 QCString baseName=makeBaseName(fileName,".msc");
1963 baseName.prepend("msc_");
1964
1965 QCString outDir = Config_getString(LATEX_OUTPUT);
1966 if (newFile) writeMscGraphFromFile(fileName,outDir,baseName,MscOutputFormat::EPS,srcFile,srcLine);
1967 visitPreStart(m_t,hasCaption, baseName, width, height);
1968}
1969
1970void LatexDocVisitor::endMscFile(bool hasCaption)
1971{
1972 if (m_hide) return;
1973 visitPostEnd(m_t,hasCaption);
1974}
1975
1976
1977void LatexDocVisitor::writeMscFile(const QCString &fileName, const DocVerbatim &s, bool newFile)
1978{
1979 QCString shortName=makeBaseName(fileName,".msc");
1980 QCString outDir = Config_getString(LATEX_OUTPUT);
1981 if (newFile) writeMscGraphFromFile(fileName,outDir,shortName,MscOutputFormat::EPS,s.srcFile(),s.srcLine());
1982 visitPreStart(m_t, s.hasCaption(), shortName, s.width(),s.height());
1985}
1986
1988 const QCString &width,
1989 const QCString &height,
1990 bool hasCaption,
1991 const QCString &srcFile,
1992 int srcLine, bool newFile
1993 )
1994{
1995 QCString baseName=makeBaseName(fileName,".dia");
1996 baseName.prepend("dia_");
1997
1998 QCString outDir = Config_getString(LATEX_OUTPUT);
1999 if (newFile) writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::EPS,srcFile,srcLine);
2000 visitPreStart(m_t,hasCaption, baseName, width, height);
2001}
2002
2003void LatexDocVisitor::endDiaFile(bool hasCaption)
2004{
2005 if (m_hide) return;
2006 visitPostEnd(m_t,hasCaption);
2007}
2008
2010{
2011 QCString shortName = stripPath(baseName);
2012 if (s.useBitmap())
2013 {
2014 if (shortName.find('.')==-1) shortName += ".png";
2015 }
2016 QCString outDir = Config_getString(LATEX_OUTPUT);
2019 visitPreStart(m_t, s.hasCaption(), shortName, s.width(), s.height());
2022}
2023
2025 const QCString &width,
2026 const QCString &height,
2027 bool hasCaption,
2028 const QCString &srcFile,
2029 int srcLine
2030 )
2031{
2032 QCString outDir = Config_getString(LATEX_OUTPUT);
2033 std::string inBuf;
2034 readInputFile(fileName,inBuf);
2035
2036 bool useBitmap = inBuf.find("@startditaa") != std::string::npos;
2037 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
2038 outDir,QCString(),inBuf,
2040 QCString(),srcFile,srcLine,false);
2041 bool first = true;
2042 for (const auto &bName: baseNameVector)
2043 {
2044 QCString baseName = makeBaseName(bName,".pu");
2045 QCString shortName = stripPath(baseName);
2046 if (useBitmap)
2047 {
2048 if (shortName.find('.')==-1) shortName += ".png";
2049 }
2052 if (!first) endPlantUmlFile(hasCaption);
2053 first = false;
2054 visitPreStart(m_t,hasCaption, shortName, width, height);
2055 }
2056}
2057
2059{
2060 if (m_hide) return;
2061 visitPostEnd(m_t,hasCaption);
2062}
2063
2065{
2066 QCString shortName = stripPath(baseName);
2067 if (shortName.find('.')==-1) shortName += ".png";
2068 QCString outDir = Config_getString(LATEX_OUTPUT);
2070 visitPreStart(m_t, s.hasCaption(), shortName, s.width(), s.height());
2073}
2074
2076 const QCString &width,
2077 const QCString &height,
2078 bool hasCaption,
2079 const QCString &srcFile,
2080 int srcLine
2081 )
2082{
2083 QCString outDir = Config_getString(LATEX_OUTPUT);
2084 std::string inBuf;
2085 readInputFile(fileName,inBuf);
2086
2088 outDir,QCString(),inBuf,
2090 srcFile,srcLine);
2091 QCString shortName = stripPath(baseName);
2092 if (shortName.find('.')==-1) shortName += ".png";
2094 visitPreStart(m_t,hasCaption, shortName, width, height);
2095}
2096
2098{
2099 if (m_hide) return;
2100 visitPostEnd(m_t,hasCaption);
2101}
2102
2104{
2105 return std::min(m_indentLevel,maxIndentLevels-1);
2106}
2107
2109{
2110 m_indentLevel++;
2112 {
2113 err("Maximum indent level ({}) exceeded while generating LaTeX output!\n",maxIndentLevels-1);
2114 }
2115}
2116
2118{
2119 if (m_indentLevel>0)
2120 {
2121 m_indentLevel--;
2122 }
2123}
2124
QCString anchorPrefix() const
Definition cite.cpp:126
static CitationManager & instance()
Definition cite.cpp:85
void parseCodeFragment(OutputCodeList &codeOutList, const QCString &fileName, const QCString &blockId, const QCString &scopeName, bool showLineNumbers, bool trimLeft, bool stripCodeComments)
static CodeFragmentManager & instance()
virtual void parseCode(OutputCodeList &codeOutList, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options)=0
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
Node representing an anchor.
Definition docnode.h:229
QCString anchor() const
Definition docnode.h:232
QCString file() const
Definition docnode.h:233
Node representing an auto List.
Definition docnode.h:571
bool isEnumList() const
Definition docnode.h:580
Node representing an item of a auto list.
Definition docnode.h:595
int itemNumber() const
Definition docnode.h:598
Node representing a citation of some bibliographic reference.
Definition docnode.h:245
QCString getText() const
Definition docnode.cpp:974
CiteInfoOption option() const
Definition docnode.h:253
QCString target() const
Definition docnode.h:252
QCString anchor() const
Definition docnode.h:251
QCString file() const
Definition docnode.h:248
Node representing a dia file.
Definition docnode.h:731
QCString height() const
Definition docnode.h:689
QCString srcFile() const
Definition docnode.h:691
QCString file() const
Definition docnode.h:685
int srcLine() const
Definition docnode.h:692
bool hasCaption() const
Definition docnode.h:687
QCString width() const
Definition docnode.h:688
Node representing a dot file.
Definition docnode.h:713
Node representing an emoji.
Definition docnode.h:341
int index() const
Definition docnode.h:345
QCString name() const
Definition docnode.h:344
Node representing an item of a cross-referenced list.
Definition docnode.h:529
QCString text() const
Definition docnode.h:533
Node representing a Hypertext reference.
Definition docnode.h:832
QCString url() const
Definition docnode.h:839
Node representing a horizontal ruler.
Definition docnode.h:216
Node representing an HTML blockquote.
Definition docnode.h:1297
Node representing a HTML table caption.
Definition docnode.h:1234
QCString anchor() const
Definition docnode.h:1241
QCString file() const
Definition docnode.h:1240
Node representing a HTML table cell.
Definition docnode.h:1199
Valignment valignment() const
Definition docnode.cpp:1980
uint32_t rowSpan() const
Definition docnode.cpp:1918
Alignment alignment() const
Definition docnode.cpp:1942
bool isLast() const
Definition docnode.h:1208
bool isHeading() const
Definition docnode.h:1206
uint32_t colSpan() const
Definition docnode.cpp:1930
Node representing a HTML description data.
Definition docnode.h:1187
Node representing a Html description list.
Definition docnode.h:910
const HtmlAttribList & attribs() const
Definition docnode.h:914
Node representing a Html description item.
Definition docnode.h:897
Node Html details.
Definition docnode.h:866
const DocNodeVariant * summary() const
Definition docnode.h:873
Node Html heading.
Definition docnode.h:882
int level() const
Definition docnode.h:886
Node representing a Html list.
Definition docnode.h:1009
const HtmlAttribList & attribs() const
Definition docnode.h:1015
Type type() const
Definition docnode.h:1014
Node representing a HTML list item.
Definition docnode.h:1171
const HtmlAttribList & attribs() const
Definition docnode.h:1176
Node representing a HTML table row.
Definition docnode.h:1252
Node Html summary.
Definition docnode.h:853
Node representing a HTML table.
Definition docnode.h:1275
size_t numberHeaderRows() const
Definition docnode.cpp:2255
size_t numColumns() const
Definition docnode.h:1284
const DocNodeVariant * caption() const
Definition docnode.cpp:2250
Node representing an image.
Definition docnode.h:642
QCString name() const
Definition docnode.h:648
QCString height() const
Definition docnode.h:651
Type type() const
Definition docnode.h:647
QCString width() const
Definition docnode.h:650
bool isInlineImage() const
Definition docnode.h:654
bool hasCaption() const
Definition docnode.h:649
Node representing a include/dontinclude operator block.
Definition docnode.h:477
bool stripCodeComments() const
Definition docnode.h:506
bool isLast() const
Definition docnode.h:503
QCString includeFileName() const
Definition docnode.h:509
QCString text() const
Definition docnode.h:499
QCString context() const
Definition docnode.h:501
QCString exampleFile() const
Definition docnode.h:508
int line() const
Definition docnode.h:497
Type type() const
Definition docnode.h:485
bool isFirst() const
Definition docnode.h:502
bool showLineNo() const
Definition docnode.h:498
bool isExample() const
Definition docnode.h:507
Node representing an included text block from file.
Definition docnode.h:435
QCString blockId() const
Definition docnode.h:454
QCString extension() const
Definition docnode.h:450
bool stripCodeComments() const
Definition docnode.h:455
@ LatexInclude
Definition docnode.h:437
@ SnippetWithLines
Definition docnode.h:438
@ DontIncWithLines
Definition docnode.h:439
@ IncWithLines
Definition docnode.h:438
@ HtmlInclude
Definition docnode.h:437
@ VerbInclude
Definition docnode.h:437
@ DontInclude
Definition docnode.h:437
@ DocbookInclude
Definition docnode.h:439
Type type() const
Definition docnode.h:451
QCString exampleFile() const
Definition docnode.h:457
QCString text() const
Definition docnode.h:452
QCString file() const
Definition docnode.h:449
bool trimLeft() const
Definition docnode.h:459
bool isExample() const
Definition docnode.h:456
QCString context() const
Definition docnode.h:453
Node representing an entry in the index.
Definition docnode.h:552
QCString entry() const
Definition docnode.h:559
Node representing an internal section of documentation.
Definition docnode.h:978
Node representing an internal reference to some item.
Definition docnode.h:816
QCString file() const
Definition docnode.h:820
QCString anchor() const
Definition docnode.h:822
Node representing a line break.
Definition docnode.h:202
Node representing a word that can be linked to something.
Definition docnode.h:165
QCString file() const
Definition docnode.h:171
QCString ref() const
Definition docnode.h:173
QCString word() const
Definition docnode.h:170
QCString anchor() const
Definition docnode.h:174
Node representing a mermaid file.
Definition docnode.h:749
Node representing a msc file.
Definition docnode.h:722
DocNodeVariant * parent()
Definition docnode.h:90
Node representing an block of paragraphs.
Definition docnode.h:988
Node representing a paragraph in the documentation tree.
Definition docnode.h:1089
bool isLast() const
Definition docnode.h:1097
Node representing a parameter list.
Definition docnode.h:1131
const DocNodeList & parameters() const
Definition docnode.h:1135
const DocNodeList & paramTypes() const
Definition docnode.h:1136
DocParamSect::Direction direction() const
Definition docnode.h:1139
const DocNodeList & paragraphs() const
Definition docnode.h:1137
Node representing a parameter section.
Definition docnode.h:1062
bool hasInOutSpecifier() const
Definition docnode.h:1078
bool hasTypeSpecifier() const
Definition docnode.h:1079
Type type() const
Definition docnode.h:1077
Node representing a uml file.
Definition docnode.h:740
Node representing a reference to some item.
Definition docnode.h:787
QCString anchor() const
Definition docnode.h:794
SectionType sectionType() const
Definition docnode.h:796
QCString targetTitle() const
Definition docnode.h:795
bool isSubPage() const
Definition docnode.h:801
bool refToTable() const
Definition docnode.h:800
QCString file() const
Definition docnode.h:791
QCString ref() const
Definition docnode.h:793
bool refToSection() const
Definition docnode.h:799
bool hasLinkText() const
Definition docnode.h:797
Root node of documentation tree.
Definition docnode.h:1319
Node representing a reference to a section.
Definition docnode.h:944
bool refToTable() const
Definition docnode.h:952
QCString file() const
Definition docnode.h:948
QCString anchor() const
Definition docnode.h:949
QCString ref() const
Definition docnode.h:951
bool isSubPage() const
Definition docnode.h:953
Node representing a list of section references.
Definition docnode.h:968
Node representing a normal section.
Definition docnode.h:923
QCString file() const
Definition docnode.h:931
int level() const
Definition docnode.h:927
QCString anchor() const
Definition docnode.h:929
const DocNodeVariant * title() const
Definition docnode.h:928
Node representing a separator.
Definition docnode.h:365
QCString chars() const
Definition docnode.h:369
Node representing a simple list.
Definition docnode.h:999
Node representing a simple list item.
Definition docnode.h:1159
const DocNodeVariant * paragraph() const
Definition docnode.h:1163
Node representing a simple section.
Definition docnode.h:1026
Type type() const
Definition docnode.h:1035
const DocNodeVariant * title() const
Definition docnode.h:1042
Node representing a separator between two simple sections of the same type.
Definition docnode.h:1053
Node representing a style change.
Definition docnode.h:268
Style style() const
Definition docnode.h:307
bool enable() const
Definition docnode.h:309
Node representing a special symbol.
Definition docnode.h:328
HtmlEntityMapper::SymType symbol() const
Definition docnode.h:332
Root node of a text fragment.
Definition docnode.h:1310
Node representing a simple section title.
Definition docnode.h:608
Node representing a URL (or email address).
Definition docnode.h:188
QCString url() const
Definition docnode.h:192
bool isEmail() const
Definition docnode.h:193
Node representing a verbatim, unparsed text fragment.
Definition docnode.h:376
QCString srcFile() const
Definition docnode.h:397
int srcLine() const
Definition docnode.h:398
QCString height() const
Definition docnode.h:392
bool hasCaption() const
Definition docnode.h:390
QCString language() const
Definition docnode.h:388
const DocNodeList & children() const
Definition docnode.h:395
bool isExample() const
Definition docnode.h:385
QCString context() const
Definition docnode.h:384
Type type() const
Definition docnode.h:382
QCString text() const
Definition docnode.h:383
QCString exampleFile() const
Definition docnode.h:386
QCString engine() const
Definition docnode.h:393
bool useBitmap() const
Definition docnode.h:394
@ JavaDocLiteral
Definition docnode.h:378
QCString width() const
Definition docnode.h:391
Node representing a VHDL flow chart.
Definition docnode.h:758
CodeParserInterface & getCodeParser(const QCString &langExt)
void pushHidden(bool hide)
bool popHidden()
Node representing some amount of white space.
Definition docnode.h:354
QCString chars() const
Definition docnode.h:358
Node representing a word.
Definition docnode.h:153
QCString word() const
Definition docnode.h:156
Node representing an item of a cross-referenced list.
Definition docnode.h:621
QCString anchor() const
Definition docnode.h:625
QCString file() const
Definition docnode.h:624
QCString title() const
Definition docnode.h:626
const char * name(int index) const
Access routine to the name of the Emoji entity.
Definition emoji.cpp:2026
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1978
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
std::string fileName() const
Definition fileinfo.cpp:118
std::string dirPath(bool absPath=true) const
Definition fileinfo.cpp:137
Class representing a list of HTML attributes.
Definition htmlattrib.h:33
const char * latex(SymType symb) const
Access routine to the LaTeX code of the HTML entity.
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
Generator for LaTeX code fragments.
Definition latexgen.h:28
void startMermaidFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, const QCString &srcFile, int srcLine)
void startDiaFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, const QCString &srcFile, int srcLine, bool newFile=true)
RowSpanList & rowSpans()
void setCurrentColumn(size_t col)
static const int maxIndentLevels
void endLink(const QCString &ref, const QCString &file, const QCString &anchor, bool refToTable=false, bool refToSection=false, SectionType sectionType=SectionType::Anchor)
void startMscFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, const QCString &srcFile, int srcLine, bool newFile=true)
void writeMermaidFile(const QCString &baseName, const DocVerbatim &s)
void endDotFile(bool hasCaption)
void operator()(const DocWord &)
void visitCaption(const DocNodeList &children)
void addRowSpan(ActiveRowSpan &&span)
void setNumCols(size_t num)
void writeStartTableCommand(const DocNodeVariant *n, size_t cols)
void writeEndTableCommand(const DocNodeVariant *n)
void startLink(const QCString &ref, const QCString &file, const QCString &anchor, bool refToTable=false, bool refToSection=false)
OutputCodeList & m_ci
LatexDocVisitor(TextStream &t, OutputCodeList &ci, LatexCodeGenerator &lcg, const QCString &langExt, int hierarchyLevel=0)
size_t currentColumn() const
void writePlantUMLFile(const QCString &fileName, const DocVerbatim &s)
void filter(const QCString &str, const bool retainNewLine=false)
void endMscFile(bool hasCaption)
bool isTableNested(const DocNodeVariant *n) const
void startPlantUmlFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, const QCString &srcFile, int srcLine)
void startDotFile(const QCString &fileName, const QCString &width, const QCString &height, bool hasCaption, const QCString &srcFile, int srcLine, bool newFile=true)
LatexListItemInfo m_listItemInfo[maxIndentLevels]
bool insideTable() const
void endDiaFile(bool hasCaption)
void endMermaidFile(bool hasCaption)
const char * getSectionName(int level) const
void endPlantUmlFile(bool hasCaption)
void writeMscFile(const QCString &fileName, const DocVerbatim &s, bool newFile=true)
void visitChildren(const T &t)
LatexCodeGenerator & m_lcg
QCString writeMermaidSource(const QCString &outDirArg, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &srcFile, int srcLine)
Write a Mermaid source file and register it for CLI rendering.
Definition mermaid.cpp:52
void generateMermaidOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Register a generated Mermaid image with the index.
Definition mermaid.cpp:104
static MermaidManager & instance()
Definition mermaid.cpp:32
Class representing a list of different code generators.
Definition outputlist.h:165
StringVector writePlantUMLSource(const QCString &outDirArg, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &engine, const QCString &srcFile, int srcLine, bool inlineCode)
Write a PlantUML compatible file.
Definition plantuml.cpp:31
static PlantumlManager & instance()
Definition plantuml.cpp:231
void generatePlantUMLOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Convert a PlantUML file to an image.
Definition plantuml.cpp:202
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
QCString & prepend(const char *s)
Definition qcstring.h:422
int toInt(bool *ok=nullptr, int base=10) const
Definition qcstring.cpp:254
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
bool endsWith(const char *s) const
Definition qcstring.h:524
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
const std::string & str() const
Definition qcstring.h:552
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:172
QCString left(size_t len) const
Definition qcstring.h:229
constexpr int level() const
Definition section.h:46
Text streaming class that buffers data.
Definition textstream.h:36
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
void writeDiaGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, DiaOutputFormat format, const QCString &srcFile, int srcLine)
Definition dia.cpp:26
constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
returns true iff v holds one of types passed as template parameters
Definition docnode.h:1372
std::variant< DocWord, DocLinkedWord, DocURL, DocLineBreak, DocHorRuler, DocAnchor, DocCite, DocStyleChange, DocSymbol, DocEmoji, DocWhiteSpace, DocSeparator, DocVerbatim, DocInclude, DocIncOperator, DocFormula, DocIndexEntry, DocAutoList, DocAutoListItem, DocTitle, DocXRefItem, DocImage, DocDotFile, DocMscFile, DocDiaFile, DocVhdlFlow, DocLink, DocRef, DocInternalRef, DocHRef, DocHtmlHeader, DocHtmlDescTitle, DocHtmlDescList, DocSection, DocSecRefItem, DocSecRefList, DocInternal, DocParBlock, DocSimpleList, DocHtmlList, DocSimpleSect, DocSimpleSectSep, DocParamSect, DocPara, DocParamList, DocSimpleListItem, DocHtmlListItem, DocHtmlDescData, DocHtmlCell, DocHtmlCaption, DocHtmlRow, DocHtmlTable, DocHtmlBlockQuote, DocText, DocRoot, DocHtmlDetails, DocHtmlSummary, DocPlantUmlFile, DocMermaidFile > DocNodeVariant
Definition docnode.h:67
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1336
void writeDotGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, GraphOutputFormat format, const QCString &srcFile, int srcLine)
Definition dot.cpp:230
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
Definition filedef.cpp:268
Translator * theTranslator
Definition language.cpp:71
static const char * g_subparagraphLabel
static const int g_maxLevels
static const std::array< const char *, g_maxLevels > g_secLabels
static bool listIsNested(const DocHtmlDescList &dl)
static void insertDimension(TextStream &t, QCString dimension, const char *orientationString)
static void visitPreStart(TextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage=FALSE)
static const char * g_paragraphLabel
static bool classEqualsReflist(const DocHtmlDescList &dl)
static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage=FALSE)
@ TEX
called through texorpdf as TeX (first) part
@ PDF
called through texorpdf as PDF (second) part
@ NO
not called through texorpdf
QCString latexFilterURL(const QCString &s)
void filterLatexString(TextStream &t, const QCString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline)
void latexWriteIndexItem(TextStream &m_t, const QCString &s1, const QCString &s2)
#define err(fmt,...)
Definition message.h:127
void writeMscGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, MscOutputFormat format, const QCString &srcFile, int srcLine)
Definition msc.cpp:157
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:844
Portable versions of functions that are platform dependent.
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
#define ASSERT(x)
Definition qcstring.h:39
Options to configure the code parser.
Definition parserintf.h:78
CodeParserOptions & setStartLine(int lineNr)
Definition parserintf.h:101
CodeParserOptions & setInlineFragment(bool enable)
Definition parserintf.h:107
CodeParserOptions & setShowLineNumbers(bool enable)
Definition parserintf.h:113
CodeParserOptions & setFileDef(const FileDef *fd)
Definition parserintf.h:98
SrcLangExt
Definition types.h:207
QCString writeFileContents(const QCString &baseName, const QCString &extension, const QCString &content, bool &exists)
Thread-safe function to write a string to a file.
Definition util.cpp:6982
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5214
QCString integerToRoman(int n, bool upper)
Definition util.cpp:6721
QCString stripPath(const QCString &s)
Definition util.cpp:4952
bool readInputFile(const QCString &fileName, std::string &contents, bool filter, bool isSourceCode)
read a file name fileName and optionally filter and transcode it
Definition util.cpp:5553
SrcLangExt getLanguageFromCodeLang(QCString &fileName)
Routine to handle the language attribute of the \code command.
Definition util.cpp:5232
QCString makeBaseName(const QCString &name, const QCString &ext)
Definition util.cpp:4968
bool copyFile(const QCString &src, const QCString &dest)
Copies the contents of file with name src to the newly created file with name dest.
Definition util.cpp:5880
QCString getFileNameExtension(const QCString &fn)
Definition util.cpp:5256
A bunch of utility functions.