Skip to main content

The latexdocvisitor.cpp File Reference

Included Headers

#include <algorithm> #include <array> #include "htmlattrib.h" #include "latexdocvisitor.h" #include "latexgen.h" #include "docparser.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "outputlist.h" #include "dot.h" #include "util.h" #include "message.h" #include "parserintf.h" #include "msc.h" #include "dia.h" #include "cite.h" #include "filedef.h" #include "config.h" #include "htmlentity.h" #include "emoji.h" #include "plantuml.h" #include "fileinfo.h" #include "regex.h" #include "portable.h" #include "codefragment.h"

Functions Index

static voidinsertDimension (TextStream &t, QCString dimension, const char *orientationString)
static voidvisitPreStart (TextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage=FALSE)
static voidvisitPostEnd (TextStream &t, bool hasCaption, bool inlineImage=FALSE)
static QCStringmakeShortName (const QCString &name)
static QCStringmakeBaseName (const QCString &name)
static boolclassEqualsReflist (const DocHtmlDescList &dl)
static boollistIsNested (const DocHtmlDescList &dl)

Variables Index

static const intg_maxLevels = 7
static const std::array< const char *, g_maxLevels >g_secLabels = ...
static const char *g_paragraphLabel = "doxyparagraph"
static const char *g_subparagraphLabel = "doxysubparagraph"

Functions

classEqualsReflist()

bool classEqualsReflist (const DocHtmlDescList & dl)
static

Definition at line 1174 of file latexdocvisitor.cpp.

1175{
1176 HtmlAttribList attrs = dl.attribs();
1177 auto it = std::find_if(attrs.begin(),attrs.end(),
1178 [](const auto &att) { return att.name=="class"; });
1179 if (it!=attrs.end() && it->value == "reflist") return true;
1180 return false;
1181}

Reference DocHtmlDescList::attribs.

Referenced by listIsNested and LatexDocVisitor::operator().

insertDimension()

void insertDimension (TextStream & t, QCString dimension, const char * orientationString)
static

Definition at line 90 of file latexdocvisitor.cpp.

90static void insertDimension(TextStream &t, QCString dimension, const char *orientationString)
91{
92 // dimensions for latex images can be a percentage, in this case they need some extra
93 // handling as the % symbol is used for comments
94 static const reg::Ex re(R"((\d+)%)");
95 std::string s = dimension.str();
96 reg::Match match;
97 if (reg::search(s,match,re))
98 {
99 bool ok = false;
100 double percent = QCString(match[1].str()).toInt(&ok);
101 if (ok)
102 {
103 t << percent/100.0 << "\\text" << orientationString;
104 return;
105 }
106 }
107 t << dimension;
108}

References reg::search, QCString::str and QCString::toInt.

Referenced by visitPreStart.

listIsNested()

bool listIsNested (const DocHtmlDescList & dl)
static

Definition at line 1183 of file latexdocvisitor.cpp.

1183static bool listIsNested(const DocHtmlDescList &dl)
1184{
1185 bool isNested=false;
1186 const DocNodeVariant *n = dl.parent();
1187 while (n && !isNested)
1188 {
1189 if (std::get_if<DocHtmlDescList>(n))
1190 {
1191 isNested = !classEqualsReflist(std::get<DocHtmlDescList>(*n));
1192 }
1193 n = ::parent(n);
1194 }
1195 return isNested;
1196}

References classEqualsReflist, DocNode::parent and parent.

Referenced by LatexDocVisitor::operator().

makeBaseName()

QCString makeBaseName (const QCString & name)
static

Definition at line 220 of file latexdocvisitor.cpp.

220static QCString makeBaseName(const QCString &name)
221{
222 QCString baseName = makeShortName(name);
223 int i=baseName.find('.');
224 if (i!=-1)
225 {
226 baseName=baseName.left(i);
227 }
228 return baseName;
229}

References QCString::find, QCString::left and makeShortName.

makeShortName()

QCString makeShortName (const QCString & name)
static

Definition at line 209 of file latexdocvisitor.cpp.

209static QCString makeShortName(const QCString &name)
210{
211 QCString shortName = name;
212 int i = shortName.findRev('/');
213 if (i!=-1)
214 {
215 shortName=shortName.mid(i+1);
216 }
217 return shortName;
218}

References QCString::findRev and QCString::mid.

Referenced by makeBaseName.

visitPostEnd()

void visitPostEnd (TextStream & t, bool hasCaption, bool inlineImage=FALSE)
static

Definition at line 189 of file latexdocvisitor.cpp.

189static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE)
190{
191 if (inlineImage)
192 {
193 t << "\n\\end{DoxyInlineImage}\n";
194 }
195 else
196 {
197 t << "}\n"; // end mbox or caption
198 if (hasCaption)
199 {
200 t << "\\end{DoxyImage}\n";
201 }
202 else
203 {
204 t << "\\end{DoxyImageNoCaption}\n";
205 }
206 }
207}

Reference FALSE.

Referenced by LatexDocVisitor::endDiaFile, LatexDocVisitor::endDotFile, LatexDocVisitor::endMscFile, LatexDocVisitor::endPlantUmlFile, LatexDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), LatexDocVisitor::writeDiaFile, LatexDocVisitor::writeMscFile and LatexDocVisitor::writePlantUMLFile.

visitPreStart()

void visitPreStart (TextStream & t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage=FALSE)
static

Definition at line 110 of file latexdocvisitor.cpp.

110static void visitPreStart(TextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage = FALSE)
111{
112 if (inlineImage)
113 {
114 t << "\n\\begin{DoxyInlineImage}\n";
115 }
116 else
117 {
118 if (hasCaption)
119 {
120 t << "\n\\begin{DoxyImage}\n";
121 }
122 else
123 {
124 t << "\n\\begin{DoxyImageNoCaption}\n"
125 " \\mbox{";
126 }
127 }
128
129 t << "\\includegraphics";
130 if (!width.isEmpty() || !height.isEmpty())
131 {
132 t << "[";
133 }
134 if (!width.isEmpty())
135 {
136 t << "width=";
137 insertDimension(t, width, "width");
138 }
139 if (!width.isEmpty() && !height.isEmpty())
140 {
141 t << ",";
142 }
143 if (!height.isEmpty())
144 {
145 t << "height=";
146 insertDimension(t, height, "height");
147 }
148 if (width.isEmpty() && height.isEmpty())
149 {
150 /* default setting */
151 if (inlineImage)
152 {
153 t << "[height=\\baselineskip,keepaspectratio=true]";
154 }
155 else
156 {
157 t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
158 }
159 }
160 else
161 {
162 t << "]";
163 }
164
165 t << "{" << name << "}";
166
167 if (hasCaption)
168 {
169 if (!inlineImage)
170 {
171 if (Config_getBool(PDF_HYPERLINKS))
172 {
173 t << "\n\\doxyfigcaption{";
174 }
175 else
176 {
177 t << "\n\\doxyfigcaptionnolink{";
178 }
179 }
180 else
181 {
182 t << "%"; // to catch the caption
183 }
184 }
185}

References Config_getBool, FALSE, insertDimension and QCString::isEmpty.

Referenced by LatexDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), XmlDocVisitor::operator(), LatexDocVisitor::startDiaFile, LatexDocVisitor::startDotFile, LatexDocVisitor::startMscFile, LatexDocVisitor::startPlantUmlFile, LatexDocVisitor::writeDiaFile, LatexDocVisitor::writeMscFile and LatexDocVisitor::writePlantUMLFile.

Variables

g_maxLevels

const int g_maxLevels = 7
static

Definition at line 45 of file latexdocvisitor.cpp.

45static const int g_maxLevels = 7;

Referenced by LatexDocVisitor::getSectionName.

g_paragraphLabel

const char* g_paragraphLabel = "doxyparagraph"
static

Definition at line 56 of file latexdocvisitor.cpp.

56static const char *g_paragraphLabel = "doxyparagraph";

Referenced by LatexDocVisitor::getSectionName.

g_secLabels

const std::array<const char *,g_maxLevels> g_secLabels
static
Initialiser
= { "doxysection", "doxysubsection", "doxysubsubsection", "doxysubsubsubsection", "doxysubsubsubsubsection", "doxysubsubsubsubsubsection", "doxysubsubsubsubsubsubsection" }

Definition at line 46 of file latexdocvisitor.cpp.

46static const std::array<const char *,g_maxLevels> g_secLabels =
47{ "doxysection",
48 "doxysubsection",
49 "doxysubsubsection",
50 "doxysubsubsubsection",
51 "doxysubsubsubsubsection",
52 "doxysubsubsubsubsubsection",
53 "doxysubsubsubsubsubsubsection"
54};

Referenced by LatexDocVisitor::getSectionName.

g_subparagraphLabel

const char* g_subparagraphLabel = "doxysubparagraph"
static

Definition at line 57 of file latexdocvisitor.cpp.

57static const char *g_subparagraphLabel = "doxysubparagraph";

Referenced by LatexDocVisitor::getSectionName.


Generated via doxygen2docusaurus by Doxygen 1.14.0.