Doxygen
Loading...
Searching...
No Matches
latexdocvisitor.cpp File Reference
#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"
#include "md5.h"
Include dependency graph for latexdocvisitor.cpp:

Go to the source code of this file.

Functions

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 void visitPostEnd (TextStream &t, bool hasCaption, bool inlineImage=FALSE)
static bool classEqualsReflist (const DocHtmlDescList &dl)
static bool listIsNested (const DocHtmlDescList &dl)

Variables

static const int g_maxLevels = 7
static const std::array< const char *, g_maxLevelsg_secLabels
static const char * g_paragraphLabel = "doxyparagraph"
static const char * g_subparagraphLabel = "doxysubparagraph"

Function Documentation

◆ classEqualsReflist()

bool classEqualsReflist ( const DocHtmlDescList & dl)
static

Definition at line 1109 of file latexdocvisitor.cpp.

1110{
1111 HtmlAttribList attrs = dl.attribs();
1112 auto it = std::find_if(attrs.begin(),attrs.end(),
1113 [](const auto &att) { return att.name=="class"; });
1114 if (it!=attrs.end() && it->value == "reflist") return true;
1115 return false;
1116}
const HtmlAttribList & attribs() const
Definition docnode.h:905
Class representing a list of HTML attributes.
Definition htmlattrib.h:33

References DocHtmlDescList::attribs().

Referenced by listIsNested(), and LatexDocVisitor::operator()().

◆ insertDimension()

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

Definition at line 91 of file latexdocvisitor.cpp.

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();
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}
This is an alternative implementation of QCString.
Definition qcstring.h:101
int toInt(bool *ok=nullptr, int base=10) const
Definition qcstring.cpp:254
const std::string & str() const
Definition qcstring.h:552
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
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
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:855

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

Referenced by visitPreStart().

◆ listIsNested()

bool listIsNested ( const DocHtmlDescList & dl)
static

Definition at line 1118 of file latexdocvisitor.cpp.

1119{
1120 bool isNested=false;
1121 const DocNodeVariant *n = dl.parent();
1122 while (n && !isNested)
1123 {
1124 if (std::get_if<DocHtmlDescList>(n))
1125 {
1126 isNested = !classEqualsReflist(std::get<DocHtmlDescList>(*n));
1127 }
1128 n = ::parent(n);
1129 }
1130 return isNested;
1131}
DocNodeVariant * parent()
Definition docnode.h:90
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 > 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:1330
static bool classEqualsReflist(const DocHtmlDescList &dl)

References classEqualsReflist(), DocNode::parent(), and parent().

Referenced by LatexDocVisitor::operator()().

◆ visitPostEnd()

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

Definition at line 190 of file latexdocvisitor.cpp.

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}

References 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::writeMscFile(), and LatexDocVisitor::writePlantUMLFile().

◆ visitPreStart()

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

Definition at line 111 of file latexdocvisitor.cpp.

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}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
#define Config_getBool(name)
Definition config.h:33
static void insertDimension(TextStream &t, QCString dimension, const char *orientationString)

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::writeMscFile(), and LatexDocVisitor::writePlantUMLFile().

Variable Documentation

◆ g_maxLevels

const int g_maxLevels = 7
static

Definition at line 46 of file latexdocvisitor.cpp.

Referenced by LatexDocVisitor::getSectionName().

◆ g_paragraphLabel

const char* g_paragraphLabel = "doxyparagraph"
static

Definition at line 57 of file latexdocvisitor.cpp.

Referenced by LatexDocVisitor::getSectionName().

◆ g_secLabels

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

Definition at line 47 of file latexdocvisitor.cpp.

48{ "doxysection",
49 "doxysubsection",
50 "doxysubsubsection",
51 "doxysubsubsubsection",
52 "doxysubsubsubsubsection",
53 "doxysubsubsubsubsubsection",
54 "doxysubsubsubsubsubsubsection"
55};

Referenced by LatexDocVisitor::getSectionName().

◆ g_subparagraphLabel

const char* g_subparagraphLabel = "doxysubparagraph"
static

Definition at line 58 of file latexdocvisitor.cpp.

Referenced by LatexDocVisitor::getSectionName().