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

Concrete visitor implementation for HTML output. More...

#include <src/htmldocvisitor.h>

Inheritance diagram for HtmlDocVisitor:
Collaboration diagram for HtmlDocVisitor:

Public Member Functions

 HtmlDocVisitor (TextStream &t, OutputCodeList &ci, const Definition *ctx, const QCString &fn=QCString())
void operator() (const DocWord &)
void operator() (const DocLinkedWord &)
void operator() (const DocWhiteSpace &)
void operator() (const DocSymbol &)
void operator() (const DocEmoji &)
void operator() (const DocURL &)
void operator() (const DocLineBreak &)
void operator() (const DocHorRuler &)
void operator() (const DocStyleChange &)
void operator() (const DocVerbatim &)
void operator() (const DocAnchor &)
void operator() (const DocInclude &)
void operator() (const DocIncOperator &)
void operator() (const DocFormula &)
void operator() (const DocIndexEntry &)
void operator() (const DocSimpleSectSep &)
void operator() (const DocCite &)
void operator() (const DocSeparator &)
void operator() (const DocAutoList &)
void operator() (const DocAutoListItem &)
void operator() (const DocPara &)
void operator() (const DocRoot &)
void operator() (const DocSimpleSect &)
void operator() (const DocTitle &)
void operator() (const DocSimpleList &)
void operator() (const DocSimpleListItem &)
void operator() (const DocSection &)
void operator() (const DocHtmlList &)
void operator() (const DocHtmlListItem &)
void operator() (const DocHtmlDescList &)
void operator() (const DocHtmlDescTitle &)
void operator() (const DocHtmlDescData &)
void operator() (const DocHtmlTable &)
void operator() (const DocHtmlRow &)
void operator() (const DocHtmlCell &)
void operator() (const DocHtmlCaption &)
void operator() (const DocInternal &)
void operator() (const DocHRef &)
void operator() (const DocHtmlSummary &)
void operator() (const DocHtmlDetails &)
void operator() (const DocHtmlHeader &)
void operator() (const DocImage &)
void operator() (const DocDotFile &)
void operator() (const DocMscFile &)
void operator() (const DocDiaFile &)
void operator() (const DocPlantUmlFile &)
void operator() (const DocMermaidFile &)
void operator() (const DocLink &)
void operator() (const DocRef &)
void operator() (const DocSecRefItem &)
void operator() (const DocSecRefList &)
void operator() (const DocParamSect &)
void operator() (const DocParamList &)
void operator() (const DocXRefItem &)
void operator() (const DocInternalRef &)
void operator() (const DocText &)
void operator() (const DocHtmlBlockQuote &)
void operator() (const DocVhdlFlow &)
void operator() (const DocParBlock &)
template<class Node>
void forceEndParagraph (const Node &n)
 Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph.
template<class Node>
void forceStartParagraph (const Node &n)
 Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph.
Public Member Functions inherited from DocVisitor
 DocVisitor ()
virtual ~DocVisitor ()
CodeParserInterfacegetCodeParser (const QCString &langExt)
void pushHidden (bool hide)
bool popHidden ()

Private Member Functions

template<class T>
void visitChildren (const T &t)
template<class T>
void visitCaption (TextStream &t, const T &n)
void writeObfuscatedMailAddress (const QCString &url)
void filter (const QCString &str, const bool retainNewline=false)
QCString filterQuotedCdataAttr (const QCString &str)
 Escape basic entities to produce a valid CDATA attribute value, assume that the outer quoting will be using the double quote ".
void startLink (const QCString &ref, const QCString &file, const QCString &relPath, const QCString &anchor, const QCString &tooltip="")
void endLink ()
void writeDotFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine, bool newFile=true)
void writeMscFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine, bool newFile=true)
void writeDiaFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine, bool newFile=true)
void writePlantUMLFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
void writeMermaidFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
template<class DocNode>
void forceEndParagraph (const DocNode &n)
template<class DocNode>
void forceStartParagraph (const DocNode &n)

Private Attributes

TextStreamm_t
OutputCodeListm_ci
bool m_insidePre = false
bool m_hide = false
bool m_insideTitle = false
const Definitionm_ctx
QCString m_fileName
QCString m_langExt

Detailed Description

Concrete visitor implementation for HTML output.

Definition at line 29 of file htmldocvisitor.h.

Constructor & Destructor Documentation

◆ HtmlDocVisitor()

HtmlDocVisitor::HtmlDocVisitor ( TextStream & t,
OutputCodeList & ci,
const Definition * ctx,
const QCString & fn = QCString() )

Definition at line 234 of file htmldocvisitor.cpp.

236 : m_t(t), m_ci(ci), m_ctx(ctx), m_fileName(fn)
237{
238 if (ctx) m_langExt=ctx->getDefFileExtension();
239}
virtual QCString getDefFileExtension() const =0
TextStream & m_t
OutputCodeList & m_ci
const Definition * m_ctx

References Definition::getDefFileExtension(), m_ci, m_ctx, m_fileName, m_langExt, and m_t.

Member Function Documentation

◆ endLink()

void HtmlDocVisitor::endLink ( )
private

Definition at line 2267 of file htmldocvisitor.cpp.

2268{
2269 m_t << "</a>";
2270}

References m_t.

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

◆ filter()

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

Definition at line 2156 of file htmldocvisitor.cpp.

2157{
2158 if (str.isEmpty()) return;
2159 const char *p=str.data();
2160 while (*p)
2161 {
2162 char c=*p++;
2163 switch(c)
2164 {
2165 case '\n': if(retainNewline) m_t << "<br/>"; m_t << c; break;
2166 case '<': m_t << "&lt;"; break;
2167 case '>': m_t << "&gt;"; break;
2168 case '&': m_t << "&amp;"; break;
2169 case '\\':
2170 if ((*p == '(') || (*p == ')') || (*p == '[') || (*p == ']'))
2171 m_t << "\\&zwj;" << *p++;
2172 else
2173 m_t << c;
2174 break;
2175 default:
2176 {
2177 uint8_t uc = static_cast<uint8_t>(c);
2178 if (uc<32 && !isspace(c)) // non-printable control characters
2179 {
2180 m_t << "&#x24" << hex[uc>>4] << hex[uc&0xF] << ";";
2181 }
2182 else
2183 {
2184 m_t << c;
2185 }
2186 }
2187 break;
2188 }
2189 }
2190}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
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
static constexpr auto hex

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

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

◆ filterQuotedCdataAttr()

QCString HtmlDocVisitor::filterQuotedCdataAttr ( const QCString & str)
private

Escape basic entities to produce a valid CDATA attribute value, assume that the outer quoting will be using the double quote ".

Definition at line 2194 of file htmldocvisitor.cpp.

2195{
2196 if (str.isEmpty()) return str;
2197 QCString result;
2198 result.reserve(str.length()+8);
2199 const char *p=str.data();
2200 while (*p)
2201 {
2202 char c=*p++;
2203 switch(c)
2204 {
2205 case '&': result+="&amp;"; break;
2206 case '"': result+="&quot;"; break;
2207 case '<': result+="&lt;"; break;
2208 case '>': result+="&gt;"; break;
2209 case '\\':
2210 if ((*p == '(') || (*p == ')') || (*p == '[') || (*p == ']'))
2211 {
2212 result+="\\&zwj;";
2213 result+=*p++;
2214 }
2215 else
2216 {
2217 result+=c;
2218 }
2219 break;
2220 default:
2221 {
2222 uint8_t uc = static_cast<uint8_t>(c);
2223 if (uc<32 && !isspace(c)) // non-printable control characters
2224 {
2225 result+="&#x24";
2226 result+=hex[uc>>4];
2227 result+=hex[uc&0xF];
2228 result+=";";
2229 }
2230 else
2231 {
2232 result+=c;
2233 }
2234 }
2235 break;
2236 }
2237 }
2238 return result;
2239}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
Definition qcstring.h:185

References QCString::data(), hex, QCString::isEmpty(), QCString::length(), and QCString::reserve().

Referenced by operator()().

◆ forceEndParagraph() [1/2]

◆ forceEndParagraph() [2/2]

template<class Node>
void HtmlDocVisitor::forceEndParagraph ( const Node & n)

Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph.

This method will forcefully end the current paragraph and forceStartParagraph() will restart it.

Definition at line 2394 of file htmldocvisitor.cpp.

2395{
2396 const DocPara *para=std::get_if<DocPara>(n.parent());
2397 if (para)
2398 {
2399 const DocNodeList &children = para->children();
2400
2401 //printf("forceEndParagraph\n");
2402 //dumpDocNodeList(children);
2403
2404 auto it = std::find_if(std::begin(children),std::end(children),
2405 [&n](const auto &np) { return holds_value(&n,np); });
2406 if (it==std::end(children)) return;
2407 if (it==std::begin(children)) return; // first node in paragraph
2408 it = std::prev(it);
2409 bool found=false;
2410 while (!found)
2411 {
2412 found = !isInvisibleNode(*it);
2413 if (found) break;
2414 if (it!=std::begin(children))
2415 {
2416 --it;
2417 }
2418 else
2419 {
2420 break;
2421 }
2422 }
2423 if (!found) return; // first visible node in paragraph
2424 const DocNodeVariant &v = *it;
2425 if (mustBeOutsideParagraph(v)) return; // previous node already outside paragraph context
2426 bool styleOutsideParagraph=false;
2427 if (it!=std::begin(children))
2428 {
2429 it = std::prev(it);
2430 styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,it);
2431 }
2432 bool isFirst = false;
2433 bool isLast = false;
2434 getParagraphContext(*para,isFirst,isLast);
2435 //printf("forceEnd first=%d last=%d styleOutsideParagraph=%d\n",isFirst,isLast,styleOutsideParagraph);
2436 if (isFirst && isLast) return;
2437 if (styleOutsideParagraph) return;
2438
2439 //printf("adding </p>\n");
2440 m_t << "</p>";
2441 }
2442}
DocNodeList & children()
Definition docnode.h:143
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
static bool isInvisibleNode(const DocNodeVariant &node)
static contexts_t getParagraphContext(const DocPara &p, bool &isFirst, bool &isLast)
static bool mustBeOutsideParagraph(const DocNodeVariant &n)
static bool insideStyleChangeThatIsOutsideParagraph(const DocPara *para, DocNodeList::const_iterator it)
Returns TRUE if the child nodes in paragraph para until nodeIndex contain a style change node that is...
static bool holds_value(const Node *val, const DocNodeVariant &v)

References DocCompoundNode::children(), getParagraphContext(), holds_value(), insideStyleChangeThatIsOutsideParagraph(), isInvisibleNode(), m_t, and mustBeOutsideParagraph().

◆ forceStartParagraph() [1/2]

◆ forceStartParagraph() [2/2]

template<class Node>
void HtmlDocVisitor::forceStartParagraph ( const Node & n)

Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph.

This method will forcefully start the paragraph, that was previously ended by forceEndParagraph().

Definition at line 2449 of file htmldocvisitor.cpp.

2450{
2451 //printf("> forceStartParagraph(%s)\n",docNodeName(n));
2452 const DocPara *para=nullptr;
2453 if (n.parent() && (para = std::get_if<DocPara>(n.parent()))) // if we are inside a paragraph
2454 {
2455 const DocNodeList &children = para->children();
2456
2457 auto it = std::find_if(std::begin(children),
2458 std::end(children),
2459 [&n](const auto &np)
2460 { return holds_value(&n,np); });
2461 if (it==std::end(children)) return;
2462 bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,it);
2463 //printf("it=%s (%p) styleOutsideParagraph=%d\n",
2464 // docNodeName(*it), (void *)&*it, styleOutsideParagraph);
2465 if (styleOutsideParagraph) return;
2466 it = std::next(it);
2467 while (it!=std::end(children) && isInvisibleNode(*it))
2468 {
2469 ++it;
2470 }
2471 if (it!=std::end(children))
2472 {
2473 const DocNodeVariant &v = *it;
2474 if (mustBeOutsideParagraph(v)) return; // next element also outside paragraph
2475 }
2476 else
2477 {
2478 return; // only whitespace at the end!
2479 }
2480
2481 bool needsTag = true;
2482 bool isFirst = false;
2483 bool isLast = false;
2484 getParagraphContext(*para,isFirst,isLast);
2485 if (isFirst && isLast) needsTag = false;
2486 //printf("forceStart first=%d last=%d needsTag=%d\n",isFirst,isLast,needsTag);
2487
2488 if (needsTag) m_t << "<p>";
2489 }
2490}

References DocCompoundNode::children(), getParagraphContext(), holds_value(), insideStyleChangeThatIsOutsideParagraph(), isInvisibleNode(), m_t, and mustBeOutsideParagraph().

◆ operator()() [1/59]

void HtmlDocVisitor::operator() ( const DocAnchor & anc)

Definition at line 684 of file htmldocvisitor.cpp.

685{
686 if (m_hide) return;
687 m_t << "<a class=\"anchor\" id=\"" << anc.anchor() << "\"" << anc.attribs().toString() << "></a>";
688}
const HtmlAttribList & attribs() const
Definition docnode.h:235
QCString anchor() const
Definition docnode.h:232
QCString toString(QCString *pAltValue=nullptr) const
Definition htmlattrib.h:49

References DocAnchor::anchor(), DocAnchor::attribs(), m_hide, m_t, and HtmlAttribList::toString().

◆ operator()() [2/59]

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

Definition at line 989 of file htmldocvisitor.cpp.

990{
991 //printf("DocAutoList::visitPre\n");
992 if (m_hide) return;
994 if (l.isEnumList())
995 {
996 //
997 // Do list type based on depth:
998 // 1.
999 // a.
1000 // i.
1001 // A.
1002 // 1. (repeat)...
1003 //
1004 m_t << "<ol type=\"" << g_types[l.depth() % NUM_HTML_LIST_TYPES] << "\">";
1005 }
1006 else
1007 {
1008 if (l.isCheckedList())
1009 {
1010 m_t << "<ul class=\"check\">";
1011 }
1012 else
1013 {
1014 m_t << "<ul>";
1015 }
1016 }
1017 if (!l.isPreformatted()) m_t << "\n";
1018 visitChildren(l);
1019 if (l.isEnumList())
1020 {
1021 m_t << "</ol>";
1022 }
1023 else
1024 {
1025 m_t << "</ul>";
1026 }
1027 if (!l.isPreformatted()) m_t << "\n";
1029}
bool isCheckedList() const
Definition docnode.h:582
bool isEnumList() const
Definition docnode.h:580
int depth() const
Definition docnode.h:583
bool isPreformatted() const
Definition docnode.h:105
void forceStartParagraph(const DocNode &n)
void visitChildren(const T &t)
void forceEndParagraph(const DocNode &n)
static const char g_types[][NUM_HTML_LIST_TYPES]
static const int NUM_HTML_LIST_TYPES

References DocAutoList::depth(), forceEndParagraph(), forceStartParagraph(), g_types, DocAutoList::isCheckedList(), DocAutoList::isEnumList(), DocNode::isPreformatted(), m_hide, m_t, NUM_HTML_LIST_TYPES, and visitChildren().

◆ operator()() [3/59]

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

Definition at line 1031 of file htmldocvisitor.cpp.

1032{
1033 if (m_hide) return;
1034 switch (li.itemNumber())
1035 {
1036 case DocAutoList::Unchecked: // unchecked
1037 m_t << "<li class=\"unchecked\">";
1038 break;
1039 case DocAutoList::Checked_x: // checked with x
1040 case DocAutoList::Checked_X: // checked with X
1041 m_t << "<li class=\"checked\">";
1042 break;
1043 default:
1044 m_t << "<li>";
1045 break;
1046 }
1047 visitChildren(li);
1048 m_t << "</li>";
1049 if (!li.isPreformatted()) m_t << "\n";
1050}
int itemNumber() const
Definition docnode.h:598

References DocAutoList::Checked_X, DocAutoList::Checked_x, DocNode::isPreformatted(), DocAutoListItem::itemNumber(), m_hide, m_t, DocAutoList::Unchecked, and visitChildren().

◆ operator()() [4/59]

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

Definition at line 963 of file htmldocvisitor.cpp.

964{
965 if (m_hide) return;
966 auto opt = cite.option();
967 if (!cite.file().isEmpty())
968 {
969 if (!opt.noCite()) startLink(cite.ref(),cite.file(),cite.relPath(),cite.anchor());
970 filter(cite.getText());
971 if (!opt.noCite()) endLink();
972 }
973 else
974 {
975 m_t << "<b>";
976 if (!opt.noPar()) filter("[");
977 filter(cite.target());
978 if (!opt.noPar()) filter("]");
979 m_t << "</b>";
980 }
981}
QCString getText() const
Definition docnode.cpp:974
QCString relPath() const
Definition docnode.h:249
CiteInfoOption option() const
Definition docnode.h:253
QCString target() const
Definition docnode.h:252
QCString anchor() const
Definition docnode.h:251
QCString ref() const
Definition docnode.h:250
QCString file() const
Definition docnode.h:248
void startLink(const QCString &ref, const QCString &file, const QCString &relPath, const QCString &anchor, const QCString &tooltip="")
void filter(const QCString &str, const bool retainNewline=false)

References DocCite::anchor(), endLink(), DocCite::file(), filter(), DocCite::getText(), QCString::isEmpty(), m_hide, m_t, DocCite::option(), DocCite::ref(), DocCite::relPath(), startLink(), and DocCite::target().

◆ operator()() [5/59]

void HtmlDocVisitor::operator() ( const DocDiaFile & df)

Definition at line 1807 of file htmldocvisitor.cpp.

1808{
1809 if (m_hide) return;
1811 bool exists = false;
1812 std::string inBuf;
1813 if (readInputFile(df.file(),inBuf))
1814 {
1815 auto fileName = writeFileContents(Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1816 ".dia", // extension
1817 inBuf, // contents
1818 exists);
1819 if (!fileName.isEmpty())
1820 {
1821 m_t << "<div class=\"diagraph\">\n";
1822 writeDiaFile(fileName,df.relPath(),df.context(),df.srcFile(),df.srcLine(),!exists);
1823 if (df.hasCaption())
1824 {
1825 m_t << "<div class=\"caption\">\n";
1826 }
1827 visitChildren(df);
1828 if (df.hasCaption())
1829 {
1830 m_t << "</div>\n";
1831 }
1832 m_t << "</div>\n";
1833 }
1834 }
1836}
QCString relPath() const
Definition docnode.h:686
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 context() const
Definition docnode.h:690
void writeDiaFile(const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine, bool newFile=true)
#define Config_getString(name)
Definition config.h:32
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:6977
QCString stripPath(const QCString &s)
Definition util.cpp:4969
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:5570

References Config_getString, DocDiagramFileBase::context(), DocDiagramFileBase::file(), forceEndParagraph(), forceStartParagraph(), DocDiagramFileBase::hasCaption(), m_hide, m_t, readInputFile(), DocDiagramFileBase::relPath(), DocDiagramFileBase::srcFile(), DocDiagramFileBase::srcLine(), stripPath(), visitChildren(), writeDiaFile(), and writeFileContents().

◆ operator()() [6/59]

void HtmlDocVisitor::operator() ( const DocDotFile & df)

Definition at line 1745 of file htmldocvisitor.cpp.

1746{
1747 if (m_hide) return;
1749 bool exists = false;
1750 std::string inBuf;
1751 if (readInputFile(df.file(),inBuf))
1752 {
1753 auto fileName = writeFileContents(Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1754 ".dot", // extension
1755 inBuf, // contents
1756 exists);
1757 if (!fileName.isEmpty())
1758 {
1759 m_t << "<div class=\"dotgraph\">\n";
1760 writeDotFile(fileName,df.relPath(),df.context(),df.srcFile(),df.srcLine(),!exists);
1761 if (df.hasCaption())
1762 {
1763 m_t << "<div class=\"caption\">\n";
1764 }
1765 visitChildren(df);
1766 if (df.hasCaption())
1767 {
1768 m_t << "</div>\n";
1769 }
1770 m_t << "</div>\n";
1771 }
1772 }
1774}
void writeDotFile(const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine, bool newFile=true)

References Config_getString, DocDiagramFileBase::context(), DocDiagramFileBase::file(), forceEndParagraph(), forceStartParagraph(), DocDiagramFileBase::hasCaption(), m_hide, m_t, readInputFile(), DocDiagramFileBase::relPath(), DocDiagramFileBase::srcFile(), DocDiagramFileBase::srcLine(), stripPath(), visitChildren(), writeDotFile(), and writeFileContents().

◆ operator()() [7/59]

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

Definition at line 310 of file htmldocvisitor.cpp.

311{
312 if (m_hide) return;
313 const char *res = EmojiEntityMapper::instance().unicode(s.index());
314 if (res)
315 {
316 m_t << "<span class=\"emoji\">" << res << "</span>";
317 }
318 else
319 {
320 m_t << s.name();
321 }
322}
int index() const
Definition docnode.h:345
QCString name() const
Definition docnode.h:344
const char * unicode(int index) const
Access routine to the unicode sequence for the Emoji entity.
Definition emoji.cpp:2016
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1978

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

◆ operator()() [8/59]

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

Definition at line 828 of file htmldocvisitor.cpp.

829{
830 if (m_hide) return;
831 bool bDisplay = !f.isInline();
832 if (bDisplay)
833 {
835 m_t << "<p class=\"formulaDsp\">\n";
836 }
837
838 if (Config_getBool(USE_MATHJAX))
839 {
840 QCString text = f.text();
841 bool closeInline = FALSE;
842 if (!bDisplay && !text.isEmpty() && text.at(0)=='$' &&
843 text.at(text.length()-1)=='$')
844 {
845 closeInline=TRUE;
846 text = text.mid(1,text.length()-2);
847 m_t << "\\(";
848 }
849 else if (!bDisplay && !text.isEmpty())
850 {
851 closeInline=TRUE;
852 m_t << "\\(";
853 }
854 m_t << convertToHtml(text);
855 if (closeInline)
856 {
857 m_t << "\\)";
858 }
859 }
860 else
861 {
862 const Formula *formula = FormulaManager::instance().findFormula(f.id());
863
864 enum class ImageType { Light, Dark };
865 enum class Visibility { Always, Dark, Light, AutoDark, AutoLight };
866 auto writeFormula = [&](ImageType imgType,Visibility visibility) -> QCString {
867 // see https://chipcullen.com/how-to-have-dark-mode-image-that-works-with-user-choice for the design idea
868 TextStream t;
869 QCString extension = Config_getEnum(HTML_FORMULA_FORMAT)==HTML_FORMULA_FORMAT_t::svg ? ".svg":".png" ;
870 if (visibility==Visibility::AutoDark || visibility==Visibility::AutoLight)
871 {
872 t << "<picture>";
873 t << "<source srcset=\"" << f.relPath() << f.name();
874 if (visibility==Visibility::AutoDark)
875 {
876 t << extension;
877 t << "\" media=\"(prefers-color-scheme: light)\"";
878 }
879 else // AutoLight
880 {
881 t << "_dark";
882 t << extension;
883 t << "\" media=\"(prefers-color-scheme: dark)\"";
884 }
885 t << "/>";
886 }
887 t << "<img class=\"formula";
888 t << (bDisplay ? "Dsp" : "Inl");
889 if (visibility==Visibility::Light) t << " light-mode-visible";
890 else if (visibility==Visibility::Dark) t << " dark-mode-visible";
891 t << "\" alt=\"" << filterQuotedCdataAttr(f.text()) << "\"" << " src=\"" << f.relPath() << f.name();
892 if (imgType==ImageType::Dark) t << "_dark";
893 t << extension;
894 if (formula && formula->width()!=-1)
895 {
896 t << "\" width=\"";
897 t << formula->width();
898 }
899 if (formula && formula->height()!=-1)
900 {
901 t << "\" height=\"";
902 t << formula->height();
903 }
904 t << "\"/>";
905 if (visibility==Visibility::AutoDark || visibility==Visibility::AutoLight)
906 {
907 t << "</picture>";
908 }
909 return t.str();
910 };
911
912 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
913 switch(colorStyle)
914 {
915 case HTML_COLORSTYLE_t::LIGHT:
916 m_t << writeFormula(ImageType::Light,Visibility::Always);
917 break;
918 case HTML_COLORSTYLE_t::DARK:
919 m_t << writeFormula(ImageType::Dark, Visibility::Always);
920 break;
921 case HTML_COLORSTYLE_t::AUTO_LIGHT:
922 m_t << writeFormula(ImageType::Light, Visibility::AutoLight);
923 break;
924 case HTML_COLORSTYLE_t::AUTO_DARK:
925 m_t << writeFormula(ImageType::Dark, Visibility::AutoDark);
926 break;
927 case HTML_COLORSTYLE_t::TOGGLE:
928 // write the image twice and use javascript (darkmode_toggle.js) to show only one of them
929 m_t << writeFormula(ImageType::Light,Visibility::Light);
930 m_t << writeFormula(ImageType::Dark, Visibility::Dark);
931 break;
932 }
933 }
934 if (bDisplay)
935 {
936 m_t << "\n</p>\n";
938 }
939}
QCString text() const
Definition docnode.h:533
QCString name() const
Definition docnode.h:532
bool isInline() const
Definition docnode.h:536
int id() const
Definition docnode.h:535
QCString relPath() const
Definition docnode.h:534
int width() const
Definition formula.h:34
int height() const
Definition formula.h:35
const Formula * findFormula(int formulaId) const
Definition formula.cpp:705
static FormulaManager & instance()
Definition formula.cpp:53
QCString filterQuotedCdataAttr(const QCString &str)
Escape basic entities to produce a valid CDATA attribute value, assume that the outer quoting will be...
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:216
#define Config_getBool(name)
Definition config.h:33
#define Config_getEnum(name)
Definition config.h:35
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:3984

References QCString::at(), Config_getBool, Config_getEnum, convertToHtml(), FALSE, filterQuotedCdataAttr(), FormulaManager::findFormula(), forceEndParagraph(), forceStartParagraph(), Formula::height(), DocFormula::id(), FormulaManager::instance(), QCString::isEmpty(), DocFormula::isInline(), QCString::length(), m_hide, m_t, QCString::mid(), DocFormula::name(), DocFormula::relPath(), TextStream::str(), DocFormula::text(), TRUE, and Formula::width().

◆ operator()() [9/59]

void HtmlDocVisitor::operator() ( const DocHorRuler & hr)

Definition at line 397 of file htmldocvisitor.cpp.

398{
399 if (m_hide) return;
401 m_t << "<hr "<< hr.attribs().toString() << " />\n";
403}
const HtmlAttribList & attribs() const
Definition docnode.h:221

References DocHorRuler::attribs(), forceEndParagraph(), forceStartParagraph(), m_hide, m_t, and HtmlAttribList::toString().

◆ operator()() [10/59]

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

Definition at line 1586 of file htmldocvisitor.cpp.

1587{
1588 if (m_hide) return;
1589 if (href.url().startsWith("mailto:"))
1590 {
1592 }
1593 else
1594 {
1595 QCString url = correctURL(href.url(),href.relPath());
1596 m_t << "<a href=\"" << convertToHtml(url) << "\""
1597 << href.attribs().toString() << ">";
1598 }
1599 visitChildren(href);
1600 m_t << "</a>";
1601}
QCString url() const
Definition docnode.h:839
QCString relPath() const
Definition docnode.h:841
const HtmlAttribList & attribs() const
Definition docnode.h:842
void writeObfuscatedMailAddress(const QCString &url)
bool startsWith(const char *s) const
Definition qcstring.h:507
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:5943

References DocHRef::attribs(), convertToHtml(), correctURL(), m_hide, m_t, QCString::mid(), DocHRef::relPath(), QCString::startsWith(), HtmlAttribList::toString(), DocHRef::url(), visitChildren(), and writeObfuscatedMailAddress().

◆ operator()() [11/59]

void HtmlDocVisitor::operator() ( const DocHtmlBlockQuote & b)

Definition at line 2112 of file htmldocvisitor.cpp.

2113{
2114 if (m_hide) return;
2116 m_t << "<blockquote class=\"doxtable\"" << b.attribs().toString() << ">\n";
2117 visitChildren(b);
2118 m_t << "</blockquote>\n";
2120}
const HtmlAttribList & attribs() const
Definition docnode.h:1302

References DocHtmlBlockQuote::attribs(), forceEndParagraph(), forceStartParagraph(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [12/59]

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

Definition at line 1572 of file htmldocvisitor.cpp.

1573{
1574 if (m_hide) return;
1575 m_t << "<caption" << c.attribs().toString() << ">";
1576 visitChildren(c);
1577 m_t << "</caption>\n";
1578}
const HtmlAttribList & attribs() const
Definition docnode.h:1237

References DocHtmlCaption::attribs(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [13/59]

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

Definition at line 1557 of file htmldocvisitor.cpp.

1558{
1559 if (m_hide) return;
1560 if (c.isHeading())
1561 {
1562 m_t << "<th" << c.attribs().toString() << ">";
1563 }
1564 else
1565 {
1566 m_t << "<td" << c.attribs().toString() << ">";
1567 }
1568 visitChildren(c);
1569 if (c.isHeading()) m_t << "</th>"; else m_t << "</td>";
1570}
bool isHeading() const
Definition docnode.h:1206
const HtmlAttribList & attribs() const
Definition docnode.h:1211

References DocHtmlCell::attribs(), DocHtmlCell::isHeading(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [14/59]

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

Definition at line 1508 of file htmldocvisitor.cpp.

1509{
1510 if (m_hide) return;
1511 m_t << "<dd" << dd.attribs().toString() << ">";
1512 visitChildren(dd);
1513 m_t << "</dd>\n";
1514}
const HtmlAttribList & attribs() const
Definition docnode.h:1190

References DocHtmlDescData::attribs(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [15/59]

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

Definition at line 1490 of file htmldocvisitor.cpp.

1491{
1492 if (m_hide) return;
1494 m_t << "<dl" << dl.attribs().toString() << ">\n";
1495 visitChildren(dl);
1496 m_t << "</dl>\n";
1498}
const HtmlAttribList & attribs() const
Definition docnode.h:914

References DocHtmlDescList::attribs(), forceEndParagraph(), forceStartParagraph(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [16/59]

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

Definition at line 1500 of file htmldocvisitor.cpp.

1501{
1502 if (m_hide) return;
1503 m_t << "<dt" << dt.attribs().toString() << ">";
1504 visitChildren(dt);
1505 m_t << "</dt>\n";
1506}
const HtmlAttribList & attribs() const
Definition docnode.h:901

References DocHtmlDescTitle::attribs(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [17/59]

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

Definition at line 1611 of file htmldocvisitor.cpp.

1612{
1613 if (m_hide) return;
1615 m_t << "<details " << d.attribs().toString() << ">\n";
1616 auto summary = d.summary();
1617 if (summary)
1618 {
1619 std::visit(*this,*summary);
1620 }
1621 visitChildren(d);
1622 m_t << "</details>\n";
1624}
const HtmlAttribList & attribs() const
Definition docnode.h:870
const DocNodeVariant * summary() const
Definition docnode.h:873

References DocHtmlDetails::attribs(), forceEndParagraph(), forceStartParagraph(), m_hide, m_t, DocHtmlDetails::summary(), HtmlAttribList::toString(), and visitChildren().

◆ operator()() [18/59]

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

Definition at line 1626 of file htmldocvisitor.cpp.

1627{
1628 if (m_hide) return;
1629 forceEndParagraph(header);
1630 m_t << "<h" << header.level() << header.attribs().toString() << ">";
1631 visitChildren(header);
1632 m_t << "</h" << header.level() << ">\n";
1633 forceStartParagraph(header);
1634}
const HtmlAttribList & attribs() const
Definition docnode.h:887
int level() const
Definition docnode.h:886

References DocHtmlHeader::attribs(), forceEndParagraph(), forceStartParagraph(), DocHtmlHeader::level(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [19/59]

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

Definition at line 1455 of file htmldocvisitor.cpp.

1456{
1457 if (m_hide) return;
1459 if (s.type()==DocHtmlList::Ordered)
1460 {
1461 m_t << "<ol" << s.attribs().toString();
1462 }
1463 else
1464 {
1465 m_t << "<ul" << s.attribs().toString();
1466 }
1467 m_t << ">\n";
1468 visitChildren(s);
1469 if (s.type()==DocHtmlList::Ordered)
1470 {
1471 m_t << "</ol>";
1472 }
1473 else
1474 {
1475 m_t << "</ul>";
1476 }
1477 if (!s.isPreformatted()) m_t << "\n";
1479}
const HtmlAttribList & attribs() const
Definition docnode.h:1015
Type type() const
Definition docnode.h:1014

References DocHtmlList::attribs(), forceEndParagraph(), forceStartParagraph(), DocNode::isPreformatted(), m_hide, m_t, DocHtmlList::Ordered, HtmlAttribList::toString(), DocHtmlList::type(), and visitChildren().

◆ operator()() [20/59]

void HtmlDocVisitor::operator() ( const DocHtmlListItem & i)

Definition at line 1481 of file htmldocvisitor.cpp.

1482{
1483 if (m_hide) return;
1484 m_t << "<li" << i.attribs().toString() << ">";
1485 if (!i.isPreformatted()) m_t << "\n";
1486 visitChildren(i);
1487 m_t << "</li>\n";
1488}
const HtmlAttribList & attribs() const
Definition docnode.h:1176

References DocHtmlListItem::attribs(), DocNode::isPreformatted(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [21/59]

void HtmlDocVisitor::operator() ( const DocHtmlRow & tr)

Definition at line 1549 of file htmldocvisitor.cpp.

1550{
1551 if (m_hide) return;
1552 m_t << "<tr" << tr.attribs().toString() << ">\n";
1553 visitChildren(tr);
1554 m_t << "</tr>\n";
1555}
const HtmlAttribList & attribs() const
Definition docnode.h:1258

References DocHtmlRow::attribs(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [22/59]

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

Definition at line 1603 of file htmldocvisitor.cpp.

1604{
1605 if (m_hide) return;
1606 m_t << "<summary " << s.attribs().toString() << ">\n";
1607 visitChildren(s);
1608 m_t << "</summary>\n";
1609}
const HtmlAttribList & attribs() const
Definition docnode.h:857

References DocHtmlSummary::attribs(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [23/59]

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

Definition at line 1516 of file htmldocvisitor.cpp.

1517{
1518 if (m_hide) return;
1519
1521
1522 if (t.caption())
1523 {
1524 QCString anc = std::get<DocHtmlCaption>(*t.caption()).anchor();
1525 if (!anc.isEmpty())
1526 {
1527 m_t << "<a class=\"anchor\" id=\"" << anc << "\"></a>\n";
1528 }
1529 }
1530
1531 QCString attrs = t.attribs().toString();
1532 if (attrs.isEmpty())
1533 {
1534 m_t << "<table class=\"doxtable\">\n";
1535 }
1536 else
1537 {
1538 m_t << "<table" << t.attribs().toString() << ">\n";
1539 }
1540 if (t.caption())
1541 {
1542 std::visit(*this,*t.caption());
1543 }
1544 visitChildren(t);
1545 m_t << "</table>\n";
1547}
const DocNodeVariant * caption() const
Definition docnode.cpp:2250
const HtmlAttribList & attribs() const
Definition docnode.h:1281

References DocHtmlTable::attribs(), DocHtmlTable::caption(), forceEndParagraph(), forceStartParagraph(), QCString::isEmpty(), m_hide, m_t, HtmlAttribList::toString(), and visitChildren().

◆ operator()() [24/59]

void HtmlDocVisitor::operator() ( const DocImage & img)

Definition at line 1636 of file htmldocvisitor.cpp.

1637{
1638 if (img.type()==DocImage::Html)
1639 {
1640 bool inlineImage = img.isInlineImage();
1641 bool typeSVG = img.isSVG();
1642 QCString url = img.url();
1643
1644 if (!inlineImage)
1645 {
1646 forceEndParagraph(img);
1647 }
1648 if (m_hide) return;
1649 QCString baseName=stripPath(img.name());
1650 if (!inlineImage) m_t << "<div class=\"image\">\n";
1651 QCString sizeAttribs;
1652 if (!img.width().isEmpty())
1653 {
1654 sizeAttribs+=" width=\""+img.width()+"\"";
1655 }
1656 if (!img.height().isEmpty()) // link to local file
1657 {
1658 sizeAttribs+=" height=\""+img.height()+"\"";
1659 }
1660 // 16 cases: url.isEmpty() | typeSVG | inlineImage | img.hasCaption()
1661
1662 HtmlAttribList attribs = img.attribs();
1663 if (typeSVG)
1664 {
1665 attribs.mergeAttribute("style","pointer-events: none;");
1666 }
1667 QCString alt;
1668 QCString attrs = attribs.toString(&alt);
1669 QCString src;
1670 if (url.isEmpty())
1671 {
1672 src = img.relPath()+img.name();
1673 }
1674 else
1675 {
1676 src = correctURL(url,img.relPath());
1677 }
1678 if (typeSVG && !inlineImage && !src.startsWith("http://") && !src.startsWith("https://"))
1679 {
1680 m_t << "<object type=\"image/svg+xml\" data=\"" << convertToHtml(src)
1681 << "\"" << sizeAttribs << attrs;
1682 if (inlineImage)
1683 {
1684 // skip closing tag
1685 }
1686 else
1687 {
1688 m_t << ">" << alt << "</object>\n";
1689 }
1690 }
1691 else
1692 {
1693 m_t << "<img src=\"" << convertToHtml(src) << "\" alt=\"" << alt << "\"" << sizeAttribs << attrs;
1694 if (inlineImage)
1695 {
1696 m_t << " class=\"inline\"";
1697 }
1698 else
1699 {
1700 m_t << "/>\n";
1701 }
1702 }
1703 if (img.hasCaption())
1704 {
1705 if (inlineImage)
1706 {
1707 m_t << " title=\"";
1708 m_insideTitle=true;
1709 }
1710 else
1711 {
1712 m_t << "<div class=\"caption\">\n";
1713 }
1714 }
1715 else if (inlineImage)
1716 {
1717 m_t << "/>";
1718 }
1719
1720 visitChildren(img);
1721
1722 if (img.hasCaption())
1723 {
1724 if (inlineImage)
1725 {
1726 m_t << "\"/>";
1727 m_insideTitle=false;
1728 }
1729 else // end <div class="caption">
1730 {
1731 m_t << "</div>";
1732 }
1733 }
1734 if (!inlineImage) // end <div class="image">
1735 {
1736 m_t << "</div>\n";
1738 }
1739 }
1740 else // other format -> skip
1741 {
1742 }
1743}
const HtmlAttribList & attribs() const
Definition docnode.h:656
QCString relPath() const
Definition docnode.h:652
QCString name() const
Definition docnode.h:648
QCString url() const
Definition docnode.h:653
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 isSVG() const
Definition docnode.cpp:1362
bool hasCaption() const
Definition docnode.h:649
void mergeAttribute(const QCString &optName, const QCString &optValue)
Definition htmlattrib.h:35

References DocImage::attribs(), convertToHtml(), correctURL(), forceEndParagraph(), forceStartParagraph(), DocImage::hasCaption(), DocImage::height(), DocImage::Html, QCString::isEmpty(), DocImage::isInlineImage(), DocImage::isSVG(), m_hide, m_insideTitle, m_t, HtmlAttribList::mergeAttribute(), DocImage::name(), DocImage::relPath(), QCString::startsWith(), stripPath(), HtmlAttribList::toString(), DocImage::type(), DocImage::url(), visitChildren(), and DocImage::width().

◆ operator()() [25/59]

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

Definition at line 690 of file htmldocvisitor.cpp.

691{
692 if (m_hide) return;
694 switch(inc.type())
695 {
698 m_ci.startCodeFragment("DoxyCode");
700 inc.context(),
701 inc.text(),
702 langExt,
703 inc.stripCodeComments(),
704 CodeParserOptions()
705 .setExample(inc.isExample(), inc.exampleFile())
706 .setInlineFragment(true)
707 .setShowLineNumbers(false)
708 .setSearchCtx(m_ctx)
709 );
710 m_ci.endCodeFragment("DoxyCode");
712 break;
714 {
716 m_ci.startCodeFragment("DoxyCode");
717 FileInfo cfi( inc.file().str() );
718 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
720 inc.context(),
721 inc.text(),
722 langExt,
723 inc.stripCodeComments(),
724 CodeParserOptions()
725 .setExample(inc.isExample(), inc.exampleFile())
726 .setFileDef(fd.get())
727 .setInlineFragment(true)
728 .setSearchCtx(m_ctx)
729 );
730 m_ci.endCodeFragment("DoxyCode");
732 }
733 break;
741 break;
743 {
744 if (inc.isBlock()) forceEndParagraph(inc);
745 m_t << inc.text();
746 if (inc.isBlock()) forceStartParagraph(inc);
747 }
748 break;
751 m_t << "<pre class=\"fragment\">";
752 filter(inc.text());
753 m_t << "</pre>";
755 break;
759 m_ci.startCodeFragment("DoxyCode");
761 inc.file(),
762 inc.blockId(),
763 inc.context(),
765 inc.trimLeft(),
767 );
768 m_ci.endCodeFragment("DoxyCode");
770 break;
771 }
772}
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.
QCString blockId() const
Definition docnode.h:454
QCString extension() const
Definition docnode.h:450
bool isBlock() const
Definition docnode.h:458
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
CodeParserInterface & getCodeParser(const QCString &langExt)
const std::string & str() const
Definition qcstring.h:552
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
Definition filedef.cpp:268
SrcLangExt
Definition types.h:207
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5231

References DocInclude::blockId(), DocInclude::context(), createFileDef(), FileInfo::dirPath(), DocInclude::DocbookInclude, DocInclude::DontInclude, DocInclude::DontIncWithLines, DocInclude::exampleFile(), DocInclude::extension(), DocInclude::file(), FileInfo::fileName(), filter(), forceEndParagraph(), forceStartParagraph(), DocVisitor::getCodeParser(), getLanguageFromFileName(), DocInclude::HtmlInclude, DocInclude::Include, DocInclude::IncWithLines, CodeFragmentManager::instance(), DocInclude::isBlock(), DocInclude::isExample(), DocInclude::LatexInclude, m_ci, m_ctx, m_hide, m_t, DocInclude::ManInclude, CodeParserInterface::parseCode(), CodeFragmentManager::parseCodeFragment(), DocInclude::RtfInclude, CodeParserOptions::setFileDef(), CodeParserOptions::setInlineFragment(), CodeParserOptions::setSearchCtx(), CodeParserOptions::setShowLineNumbers(), DocInclude::Snippet, DocInclude::SnippetWithLines, QCString::str(), DocInclude::stripCodeComments(), DocInclude::text(), DocInclude::trimLeft(), DocInclude::type(), DocInclude::VerbInclude, and DocInclude::XmlInclude.

◆ operator()() [26/59]

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

Definition at line 774 of file htmldocvisitor.cpp.

775{
776 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
777 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
778 if (op.isFirst())
779 {
781 if (!m_hide) m_ci.startCodeFragment("DoxyCode");
783 m_hide=TRUE;
784 }
785 QCString locLangExt = getFileNameExtension(op.includeFileName());
786 if (locLangExt.isEmpty()) locLangExt = m_langExt;
787 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
788 if (op.type()!=DocIncOperator::Skip)
789 {
790 m_hide = popHidden();
791 if (!m_hide)
792 {
793 std::unique_ptr<FileDef> fd;
794 if (!op.includeFileName().isEmpty())
795 {
796 FileInfo cfi( op.includeFileName().str() );
797 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
798 }
799 getCodeParser(locLangExt).parseCode(
800 m_ci,
801 op.context(),
802 op.text(),
803 langExt,
805 CodeParserOptions()
806 .setExample(op.isExample(), op.exampleFile())
807 .setFileDef(fd.get())
808 .setStartLine(op.line())
809 .setShowLineNumbers(op.showLineNo())
810 .setSearchCtx(m_ctx)
811 );
812 }
814 m_hide=TRUE;
815 }
816 if (op.isLast())
817 {
818 m_hide = popHidden();
819 if (!m_hide) m_ci.endCodeFragment("DoxyCode");
821 }
822 else
823 {
824 if (!m_hide) m_t << "\n";
825 }
826}
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
void pushHidden(bool hide)
bool popHidden()
QCString getFileNameExtension(const QCString &fn)
Definition util.cpp:5273

References DocIncOperator::context(), createFileDef(), FileInfo::dirPath(), DocIncOperator::exampleFile(), FileInfo::fileName(), forceEndParagraph(), forceStartParagraph(), DocVisitor::getCodeParser(), getFileNameExtension(), getLanguageFromFileName(), DocIncOperator::includeFileName(), QCString::isEmpty(), DocIncOperator::isExample(), DocIncOperator::isFirst(), DocIncOperator::isLast(), DocIncOperator::line(), m_ci, m_ctx, m_hide, m_langExt, m_t, CodeParserInterface::parseCode(), DocVisitor::popHidden(), DocVisitor::pushHidden(), CodeParserOptions::setFileDef(), CodeParserOptions::setSearchCtx(), CodeParserOptions::setShowLineNumbers(), CodeParserOptions::setStartLine(), DocIncOperator::showLineNo(), DocIncOperator::Skip, QCString::str(), DocIncOperator::stripCodeComments(), DocIncOperator::text(), TRUE, and DocIncOperator::type().

◆ operator()() [27/59]

void HtmlDocVisitor::operator() ( const DocIndexEntry & e)

Definition at line 941 of file htmldocvisitor.cpp.

942{
943 QCString anchor = convertIndexWordToAnchor(e.entry());
944 if (e.member())
945 {
946 anchor.prepend(e.member()->anchor()+"_");
947 }
948 m_t << "<a id=\"" << anchor << "\" name=\"" << anchor << "\"></a>";
949 //printf("*** DocIndexEntry: word='%s' scope='%s' member='%s'\n",
950 // qPrint(e.entry()),
951 // e.scope() ? qPrint(e.scope()->name()) : "<null>",
952 // e.member() ? qPrint(e.member()->name()) : "<null>"
953 // );
954 Doxygen::indexList->addIndexItem(e.scope(),e.member(),anchor,e.entry());
955}
virtual QCString anchor() const =0
QCString entry() const
Definition docnode.h:559
const Definition * scope() const
Definition docnode.h:557
const MemberDef * member() const
Definition docnode.h:558
static IndexList * indexList
Definition doxygen.h:132
void addIndexItem(const Definition *context, const MemberDef *md, const QCString &sectionAnchor=QCString(), const QCString &title=QCString())
Definition indexlist.h:117
QCString & prepend(const char *s)
Definition qcstring.h:422
static QCString convertIndexWordToAnchor(const QCString &word)

References Definition::anchor(), convertIndexWordToAnchor(), DocIndexEntry::entry(), Doxygen::indexList, m_t, DocIndexEntry::member(), QCString::prepend(), and DocIndexEntry::scope().

◆ operator()() [28/59]

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

Definition at line 1580 of file htmldocvisitor.cpp.

1581{
1582 if (m_hide) return;
1583 visitChildren(i);
1584}

References m_hide, and visitChildren().

◆ operator()() [29/59]

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

Definition at line 2098 of file htmldocvisitor.cpp.

2099{
2100 if (m_hide) return;
2101 startLink(QCString(),ref.file(),ref.relPath(),ref.anchor());
2102 visitChildren(ref);
2103 endLink();
2104 m_t << " ";
2105}
QCString file() const
Definition docnode.h:820
QCString relPath() const
Definition docnode.h:821
QCString anchor() const
Definition docnode.h:822

References DocInternalRef::anchor(), endLink(), DocInternalRef::file(), m_hide, m_t, DocInternalRef::relPath(), startLink(), and visitChildren().

◆ operator()() [30/59]

void HtmlDocVisitor::operator() ( const DocLineBreak & br)

Definition at line 391 of file htmldocvisitor.cpp.

392{
393 if (m_hide) return;
394 m_t << "<br "<< br.attribs().toString() << " />\n";
395}
const HtmlAttribList & attribs() const
Definition docnode.h:208

References DocLineBreak::attribs(), m_hide, m_t, and HtmlAttribList::toString().

◆ operator()() [31/59]

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

Definition at line 1923 of file htmldocvisitor.cpp.

1924{
1925 if (m_hide) return;
1926 startLink(lnk.ref(),lnk.file(),lnk.relPath(),lnk.anchor());
1927 visitChildren(lnk);
1928 endLink();
1929}

References DocLink::anchor(), endLink(), DocLink::file(), m_hide, DocLink::ref(), DocLink::relPath(), startLink(), and visitChildren().

◆ operator()() [32/59]

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

Definition at line 265 of file htmldocvisitor.cpp.

266{
267 if (m_hide) return;
268 //printf("linked word: %s\n",qPrint(w.word()));
269 startLink(w.ref(),w.file(),w.relPath(),w.anchor(),w.tooltip());
270 filter(w.word());
271 endLink();
272}
QCString file() const
Definition docnode.h:171
QCString relPath() const
Definition docnode.h:172
QCString ref() const
Definition docnode.h:173
QCString word() const
Definition docnode.h:170
QCString anchor() const
Definition docnode.h:174
QCString tooltip() const
Definition docnode.h:175

References DocLinkedWord::anchor(), endLink(), DocLinkedWord::file(), filter(), m_hide, DocLinkedWord::ref(), DocLinkedWord::relPath(), startLink(), DocLinkedWord::tooltip(), and DocLinkedWord::word().

◆ operator()() [33/59]

void HtmlDocVisitor::operator() ( const DocMermaidFile & df)

Definition at line 1873 of file htmldocvisitor.cpp.

1874{
1875 if (m_hide) return;
1876 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file()));
1878 if (Config_getEnum(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLI)
1879 {
1880 std::string inBuf;
1881 readInputFile(df.file(),inBuf);
1882 auto htmlOutput = Config_getString(HTML_OUTPUT);
1883 auto outputFormat = MermaidManager::OutputFormat::HTML;
1884 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
1885 QCString baseName = MermaidManager::instance().writeMermaidSource(htmlOutput,QCString(),
1886 inBuf,imageFormat,df.srcFile(),df.srcLine());
1887 m_t << "<div class=\"mermaidgraph\">\n";
1888 writeMermaidFile(baseName,df.relPath(),QCString(),df.srcFile(),df.srcLine());
1889 if (df.hasCaption())
1890 {
1891 m_t << "<div class=\"caption\">\n";
1892 }
1893 visitChildren(df);
1894 if (df.hasCaption())
1895 {
1896 m_t << "</div>\n";
1897 }
1898 m_t << "</div>\n";
1899 }
1900 else // AUTO or CLIENT_SIDE
1901 {
1902 // CLIENT_SIDE or AUTO: embed mermaid source for client-side rendering
1903 std::string inBuf;
1904 readInputFile(df.file(),inBuf);
1905 m_t << "<div class=\"mermaidgraph\">\n";
1906 m_t << "<pre class=\"mermaid\">\n";
1907 m_t << convertToHtml(inBuf);
1908 m_t << "</pre>\n";
1909 if (df.hasCaption())
1910 {
1911 m_t << "<div class=\"caption\">\n";
1912 }
1913 visitChildren(df);
1914 if (df.hasCaption())
1915 {
1916 m_t << "</div>\n";
1917 }
1918 m_t << "</div>\n";
1919 }
1921}
void writeMermaidFile(const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
static MermaidManager & instance()
Definition mermaid.cpp:33
static ImageFormat convertToImageFormat(OutputFormat outputFormat)
Definition mermaid.cpp:54
QCString writeMermaidSource(const QCString &outDirArg, const QCString &fileName, const QCString &content, ImageFormat format, const QCString &srcFile, int srcLine)
Write a Mermaid source file and register it for CLI rendering.
Definition mermaid.cpp:70
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:5875

References Config_getBool, Config_getEnum, Config_getString, convertToHtml(), MermaidManager::convertToImageFormat(), copyFile(), DocDiagramFileBase::file(), forceEndParagraph(), forceStartParagraph(), DocDiagramFileBase::hasCaption(), MermaidManager::HTML, MermaidManager::instance(), m_hide, m_t, readInputFile(), DocDiagramFileBase::relPath(), DocDiagramFileBase::srcFile(), DocDiagramFileBase::srcLine(), stripPath(), visitChildren(), writeMermaidFile(), and MermaidManager::writeMermaidSource().

◆ operator()() [34/59]

void HtmlDocVisitor::operator() ( const DocMscFile & df)

Definition at line 1776 of file htmldocvisitor.cpp.

1777{
1778 if (m_hide) return;
1780 bool exists = false;
1781 std::string inBuf;
1782 if (readInputFile(df.file(),inBuf))
1783 {
1784 auto fileName = writeFileContents(Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1785 ".msc", // extension
1786 inBuf, // contents
1787 exists);
1788 if (!fileName.isEmpty())
1789 {
1790 m_t << "<div class=\"mscgraph\">\n";
1791 writeMscFile(fileName,df.relPath(),df.context(),df.srcFile(),df.srcLine(),!exists);
1792 if (df.hasCaption())
1793 {
1794 m_t << "<div class=\"caption\">\n";
1795 }
1796 visitChildren(df);
1797 if (df.hasCaption())
1798 {
1799 m_t << "</div>\n";
1800 }
1801 m_t << "</div>\n";
1802 }
1803 }
1805}
void writeMscFile(const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine, bool newFile=true)

References Config_getString, DocDiagramFileBase::context(), DocDiagramFileBase::file(), forceEndParagraph(), forceStartParagraph(), DocDiagramFileBase::hasCaption(), m_hide, m_t, readInputFile(), DocDiagramFileBase::relPath(), DocDiagramFileBase::srcFile(), DocDiagramFileBase::srcLine(), stripPath(), visitChildren(), writeFileContents(), and writeMscFile().

◆ operator()() [35/59]

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

Definition at line 1259 of file htmldocvisitor.cpp.

1260{
1261 if (m_hide) return;
1262
1263 //printf("> DocPara\n");
1264 //dumpDocNodeList(p.children());
1265
1266 bool needsTag = determineIfNeedsTag(p);
1267 //printf(" needsTag=%d\n",needsTag);
1268 bool needsTagBefore = needsTag;
1269 bool needsTagAfter = needsTag;
1270
1271 // if the first element of a paragraph is something that should be outside of
1272 // the paragraph (<ul>,<dl>,<table>,..) then that will already started the
1273 // paragraph and we don't need to do it here
1274 if (!p.children().empty())
1275 {
1276 auto it = std::find_if(std::begin(p.children()),std::end(p.children()),
1277 [](const auto &node) { return !isInvisibleNode(node); });
1278 if (it!=std::end(p.children()))
1279 {
1280 const DocNodeVariant &n = *it;
1282 {
1283 needsTagBefore = FALSE;
1284 }
1285 }
1286 }
1287
1288 // check if this paragraph is the first or last or intermediate child of a <li> or <dd>.
1289 // this allows us to mark the tag with a special class so we can
1290 // fix the otherwise ugly spacing.
1291 bool isFirst = false;
1292 bool isLast = false;
1293 contexts_t t = getParagraphContext(p,isFirst,isLast);
1294 //printf("startPara first=%d last=%d\n",isFirst,isLast);
1295 if (isFirst && isLast) needsTagBefore=FALSE;
1296
1297 //printf(" needsTagBefore=%d\n",needsTagBefore);
1298 // write the paragraph tag (if needed)
1299 if (needsTagBefore)
1300 {
1301 if (contexts(t))
1302 m_t << "<p class=\"" << contexts(t) << "\"" << p.attribs().toString() << ">";
1303 else
1304 m_t << "<p" << p.attribs().toString() << ">";
1305 }
1306
1307 visitChildren(p);
1308
1309 // if the last element of a paragraph is something that should be outside of
1310 // the paragraph (<ul>,<dl>,<table>) then that will already have ended the
1311 // paragraph and we don't need to do it here
1312 if (!p.children().empty())
1313 {
1314 auto it = std::prev(std::end(p.children()));
1315 for (;;)
1316 {
1317 const DocNodeVariant &n = *it;
1318 if (!isInvisibleNode(n))
1319 {
1321 {
1322 needsTagAfter = FALSE;
1323 }
1324 // stop searching if we found a node that is visible
1325 break;
1326 }
1327 if (it==std::begin(p.children()))
1328 {
1329 // stop searching if we are at the beginning of the list
1330 break;
1331 }
1332 else
1333 {
1334 --it;
1335 }
1336 }
1337 }
1338
1339 //printf("endPara first=%d last=%d\n",isFirst,isLast);
1340 if (isFirst && isLast) needsTagAfter=FALSE;
1341
1342 //printf(" needsTagAfter=%d\n",needsTagAfter);
1343 if (needsTagAfter) m_t << "</p>\n";
1344 //printf("< DocPara\n");
1345}
const HtmlAttribList & attribs() const
Definition docnode.h:1120
bool empty() const
checks whether the container is empty
Definition growvector.h:140
static bool determineIfNeedsTag(const DocPara &p)
static constexpr const char * contexts(contexts_t type)
contexts_t

References DocPara::attribs(), DocCompoundNode::children(), contexts(), determineIfNeedsTag(), GrowVector< T >::empty(), FALSE, getParagraphContext(), isInvisibleNode(), m_hide, m_t, mustBeOutsideParagraph(), HtmlAttribList::toString(), and visitChildren().

◆ operator()() [36/59]

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

Definition at line 2018 of file htmldocvisitor.cpp.

2019{
2020 //printf("DocParamList::visitPre\n");
2021 if (m_hide) return;
2022 m_t << " <tr>";
2023 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
2024 if (sect && sect->hasInOutSpecifier())
2025 {
2026 m_t << "<td class=\"paramdir\">";
2028 {
2029 m_t << "[";
2030 if (pl.direction()==DocParamSect::In)
2031 {
2032 m_t << "in";
2033 }
2034 else if (pl.direction()==DocParamSect::Out)
2035 {
2036 m_t << "out";
2037 }
2038 else if (pl.direction()==DocParamSect::InOut)
2039 {
2040 m_t << "in,out";
2041 }
2042 m_t << "]";
2043 }
2044 m_t << "</td>";
2045 }
2046 if (sect && sect->hasTypeSpecifier())
2047 {
2048 m_t << "<td class=\"paramtype\">";
2049 for (const auto &type : pl.paramTypes())
2050 {
2051 std::visit(*this,type);
2052 }
2053 m_t << "</td>";
2054 }
2055 m_t << "<td class=\"paramname\">";
2056 bool first=TRUE;
2057 for (const auto &param : pl.parameters())
2058 {
2059 if (!first) m_t << ","; else first=FALSE;
2060 std::visit(*this,param);
2061 }
2062 m_t << "</td><td>";
2063 for (const auto &par : pl.paragraphs())
2064 {
2065 std::visit(*this,par);
2066 }
2067 m_t << "</td></tr>\n";
2068}
DocNodeVariant * parent()
Definition docnode.h:90
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
bool hasInOutSpecifier() const
Definition docnode.h:1078
bool hasTypeSpecifier() const
Definition docnode.h:1079

References DocParamList::direction(), FALSE, DocParamSect::hasInOutSpecifier(), DocParamSect::hasTypeSpecifier(), DocParamSect::In, DocParamSect::InOut, m_hide, m_t, DocParamSect::Out, DocParamList::paragraphs(), DocParamList::parameters(), DocParamList::paramTypes(), DocNode::parent(), TRUE, and DocParamSect::Unspecified.

◆ operator()() [37/59]

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

Definition at line 1974 of file htmldocvisitor.cpp.

1975{
1976 if (m_hide) return;
1978 QCString className;
1979 QCString heading;
1980 switch(s.type())
1981 {
1983 heading=theTranslator->trParameters();
1984 className="params";
1985 break;
1987 heading=theTranslator->trReturnValues();
1988 className="retval";
1989 break;
1991 heading=theTranslator->trExceptions();
1992 className="exception";
1993 break;
1996 className="tparams";
1997 break;
1998 default:
1999 ASSERT(0);
2000 }
2001 m_t << "<dl class=\"" << className << "\"><dt>";
2002 m_t << heading;
2003 m_t << "</dt><dd>\n";
2004 m_t << " <table class=\"" << className << "\">\n";
2005 visitChildren(s);
2006 m_t << " </table>\n";
2007 m_t << " </dd>\n";
2008 m_t << "</dl>\n";
2010}
Type type() const
Definition docnode.h:1077
virtual QCString trExceptions()=0
virtual QCString trParameters()=0
virtual QCString trTemplateParameters()=0
virtual QCString trReturnValues()=0
Translator * theTranslator
Definition language.cpp:71
#define ASSERT(x)
Definition qcstring.h:39

References ASSERT, DocParamSect::Exception, forceEndParagraph(), forceStartParagraph(), m_hide, m_t, DocParamSect::Param, DocParamSect::RetVal, DocParamSect::TemplateParam, theTranslator, DocParamSect::type(), and visitChildren().

◆ operator()() [38/59]

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

Definition at line 2150 of file htmldocvisitor.cpp.

2151{
2152 if (m_hide) return;
2153 visitChildren(pb);
2154}

References m_hide, and visitChildren().

◆ operator()() [39/59]

void HtmlDocVisitor::operator() ( const DocPlantUmlFile & df)

Definition at line 1838 of file htmldocvisitor.cpp.

1839{
1840 if (m_hide) return;
1841 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file()));
1843 QCString htmlOutput = Config_getString(HTML_OUTPUT);
1844 QCString imgExt = getDotImageExtension();
1845 PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP
1846 if (imgExt=="svg")
1847 {
1849 }
1850 std::string inBuf;
1851 readInputFile(df.file(),inBuf);
1852 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(htmlOutput,QCString(),
1853 inBuf,format,QCString(),df.srcFile(),df.srcLine(),false);
1854 for (const auto &bName: baseNameVector)
1855 {
1856 QCString baseName=makeBaseName(bName,".pu");
1857 m_t << "<div class=\"plantumlgraph\">\n";
1858 writePlantUMLFile(baseName,df.relPath(),QCString(),df.srcFile(),df.srcLine());
1859 if (df.hasCaption())
1860 {
1861 m_t << "<div class=\"caption\">\n";
1862 }
1863 visitChildren(df);
1864 if (df.hasCaption())
1865 {
1866 m_t << "</div>\n";
1867 }
1868 m_t << "</div>\n";
1869 }
1871}
void writePlantUMLFile(const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
OutputFormat
Plant UML output image formats.
Definition plantuml.h:44
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:232
QCString getDotImageExtension()
Definition util.cpp:6307
QCString makeBaseName(const QCString &name, const QCString &ext)
Definition util.cpp:4985

References Config_getBool, Config_getString, copyFile(), DocDiagramFileBase::file(), forceEndParagraph(), forceStartParagraph(), getDotImageExtension(), DocDiagramFileBase::hasCaption(), PlantumlManager::instance(), m_hide, m_t, makeBaseName(), PlantumlManager::PUML_BITMAP, PlantumlManager::PUML_SVG, readInputFile(), DocDiagramFileBase::relPath(), DocDiagramFileBase::srcFile(), DocDiagramFileBase::srcLine(), stripPath(), visitChildren(), writePlantUMLFile(), and PlantumlManager::writePlantUMLSource().

◆ operator()() [40/59]

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

Definition at line 1931 of file htmldocvisitor.cpp.

1932{
1933 if (m_hide) return;
1934 if (!ref.file().isEmpty())
1935 {
1936 // when ref.isSubPage()==TRUE we use ref.file() for HTML and
1937 // ref.anchor() for LaTeX/RTF
1938 startLink(ref.ref(),ref.file(),ref.relPath(),ref.isSubPage() ? QCString() : ref.anchor(), ref.targetTitle());
1939 }
1940 if (!ref.hasLinkText()) filter(ref.targetTitle());
1941 visitChildren(ref);
1942 if (!ref.file().isEmpty()) endLink();
1943 //m_t << " ";
1944}
QCString anchor() const
Definition docnode.h:794
QCString relPath() const
Definition docnode.h:792
QCString targetTitle() const
Definition docnode.h:795
bool isSubPage() const
Definition docnode.h:801
QCString file() const
Definition docnode.h:791
QCString ref() const
Definition docnode.h:793
bool hasLinkText() const
Definition docnode.h:797

References DocRef::anchor(), endLink(), DocRef::file(), filter(), DocRef::hasLinkText(), QCString::isEmpty(), DocRef::isSubPage(), m_hide, DocRef::ref(), DocRef::relPath(), startLink(), DocRef::targetTitle(), and visitChildren().

◆ operator()() [41/59]

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

Definition at line 1347 of file htmldocvisitor.cpp.

1348{
1349 //printf("> DocRoot\n");
1350 //dumpDocNodeList(r.children());
1351 visitChildren(r);
1352 //printf("< DocRoot\n");
1353}

References visitChildren().

◆ operator()() [42/59]

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

Definition at line 1946 of file htmldocvisitor.cpp.

1947{
1948 if (m_hide) return;
1949 if (!ref.file().isEmpty())
1950 {
1951 m_t << "<li>";
1952 startLink(ref.ref(),ref.file(),ref.relPath(),ref.isSubPage() ? QCString() : ref.anchor());
1953 }
1954 visitChildren(ref);
1955 if (!ref.file().isEmpty())
1956 {
1957 endLink();
1958 m_t << "</li>\n";
1959 }
1960}
QCString relPath() const
Definition docnode.h:950
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

References DocSecRefItem::anchor(), endLink(), DocSecRefItem::file(), QCString::isEmpty(), DocSecRefItem::isSubPage(), m_hide, m_t, DocSecRefItem::ref(), DocSecRefItem::relPath(), startLink(), and visitChildren().

◆ operator()() [43/59]

void HtmlDocVisitor::operator() ( const DocSecRefList & s)

Definition at line 1962 of file htmldocvisitor.cpp.

1963{
1964 if (m_hide) return;
1966 m_t << "<div>\n";
1967 m_t << "<ul class=\"multicol\">\n";
1968 visitChildren(s);
1969 m_t << "</ul>\n";
1970 m_t << "</div>\n";
1972}

References forceEndParagraph(), forceStartParagraph(), m_hide, m_t, and visitChildren().

◆ operator()() [44/59]

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

Definition at line 1439 of file htmldocvisitor.cpp.

1440{
1441 if (m_hide) return;
1443 m_t << "<h" << s.level() << " class=\"doxsection\">";
1444 m_t << "<a class=\"anchor\" id=\"" << s.anchor();
1445 m_t << "\"></a>\n";
1446 if (s.title())
1447 {
1448 std::visit(*this,*s.title());
1449 }
1450 m_t << "</h" << s.level() << ">\n";
1451 visitChildren(s);
1453}
int level() const
Definition docnode.h:927
QCString anchor() const
Definition docnode.h:929
const DocNodeVariant * title() const
Definition docnode.h:928

References DocSection::anchor(), forceEndParagraph(), forceStartParagraph(), DocSection::level(), m_hide, m_t, DocSection::title(), and visitChildren().

◆ operator()() [45/59]

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

Definition at line 2012 of file htmldocvisitor.cpp.

2013{
2014 if (m_hide) return;
2015 m_t << "&#160;" << s.chars() << "&#160;";
2016}
QCString chars() const
Definition docnode.h:369

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

◆ operator()() [46/59]

void HtmlDocVisitor::operator() ( const DocSimpleList & sl)

Definition at line 1415 of file htmldocvisitor.cpp.

1416{
1417 if (m_hide) return;
1419 m_t << "<ul>";
1420 if (!sl.isPreformatted()) m_t << "\n";
1421 visitChildren(sl);
1422 m_t << "</ul>";
1423 if (!sl.isPreformatted()) m_t << "\n";
1425}

References forceEndParagraph(), forceStartParagraph(), DocNode::isPreformatted(), m_hide, m_t, and visitChildren().

◆ operator()() [47/59]

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

Definition at line 1427 of file htmldocvisitor.cpp.

1428{
1429 if (m_hide) return;
1430 m_t << "<li>";
1431 if (li.paragraph())
1432 {
1433 visit(*this,*li.paragraph());
1434 }
1435 m_t << "</li>";
1436 if (!li.isPreformatted()) m_t << "\n";
1437}
const DocNodeVariant * paragraph() const
Definition docnode.h:1163

References DocNode::isPreformatted(), m_hide, m_t, and DocSimpleListItem::paragraph().

◆ operator()() [48/59]

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

Definition at line 1355 of file htmldocvisitor.cpp.

1356{
1357 if (m_hide) return;
1359 m_t << "<dl class=\"section " << s.typeString() << "\"><dt>";
1360 switch(s.type())
1361 {
1362 case DocSimpleSect::See:
1363 m_t << theTranslator->trSeeAlso(); break;
1365 m_t << theTranslator->trReturns(); break;
1367 m_t << theTranslator->trAuthor(TRUE,TRUE); break;
1369 m_t << theTranslator->trAuthor(TRUE,FALSE); break;
1371 m_t << theTranslator->trVersion(); break;
1373 m_t << theTranslator->trSince(); break;
1375 m_t << theTranslator->trDate(); break;
1377 m_t << theTranslator->trNote(); break;
1379 m_t << theTranslator->trWarning(); break;
1380 case DocSimpleSect::Pre:
1381 m_t << theTranslator->trPrecondition(); break;
1383 m_t << theTranslator->trPostcondition(); break;
1385 m_t << theTranslator->trCopyright(); break;
1387 m_t << theTranslator->trInvariant(); break;
1389 m_t << theTranslator->trRemarks(); break;
1391 m_t << theTranslator->trAttention(); break;
1393 m_t << theTranslator->trImportant(); break;
1394 case DocSimpleSect::User: break;
1395 case DocSimpleSect::Rcs: break;
1396 case DocSimpleSect::Unknown: break;
1397 }
1398
1399 if (s.title())
1400 {
1401 std::visit(*this,*s.title());
1402 }
1403 m_t << "</dt><dd>";
1404 visitChildren(s);
1405 m_t << "</dd></dl>\n";
1407}
QCString typeString() const
Definition docnode.cpp:3260
Type type() const
Definition docnode.h:1035
const DocNodeVariant * title() const
Definition docnode.h:1042
virtual QCString trPrecondition()=0
virtual QCString trSince()=0
virtual QCString trVersion()=0
virtual QCString trReturns()=0
virtual QCString trRemarks()=0
virtual QCString trNote()=0
virtual QCString trPostcondition()=0
virtual QCString trAttention()=0
virtual QCString trCopyright()=0
virtual QCString trDate()=0
virtual QCString trAuthor(bool first_capital, bool singular)=0
virtual QCString trWarning()=0
virtual QCString trSeeAlso()=0
virtual QCString trImportant()=0
virtual QCString trInvariant()=0

References DocSimpleSect::Attention, DocSimpleSect::Author, DocSimpleSect::Authors, DocSimpleSect::Copyright, DocSimpleSect::Date, FALSE, forceEndParagraph(), forceStartParagraph(), DocSimpleSect::Important, DocSimpleSect::Invar, 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::typeString(), DocSimpleSect::Unknown, DocSimpleSect::User, DocSimpleSect::Version, visitChildren(), and DocSimpleSect::Warning.

◆ operator()() [49/59]

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

Definition at line 957 of file htmldocvisitor.cpp.

958{
959 m_t << "</dd>\n";
960 m_t << "<dd>\n";
961}

References m_t.

◆ operator()() [50/59]

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

Definition at line 405 of file htmldocvisitor.cpp.

406{
407 if (m_hide) return;
408 switch (s.style())
409 {
411 if (s.enable()) m_t << "<b" << s.attribs().toString() << ">"; else m_t << "</b>";
412 break;
414 if (s.enable()) m_t << "<s" << s.attribs().toString() << ">"; else m_t << "</s>";
415 break;
417 if (s.enable()) m_t << "<strike" << s.attribs().toString() << ">"; else m_t << "</strike>";
418 break;
420 if (s.enable()) m_t << "<del" << s.attribs().toString() << ">"; else m_t << "</del>";
421 break;
423 if (s.enable()) m_t << "<u" << s.attribs().toString() << ">"; else m_t << "</u>";
424 break;
426 if (s.enable()) m_t << "<ins" << s.attribs().toString() << ">"; else m_t << "</ins>";
427 break;
429 if (s.enable())
430 {
431 auto attribs = s.attribs();
432 if (s.tagName()=="a")
433 {
434 attribs.mergeAttribute("class","arg");
435 }
436 m_t << "<em" << attribs.toString() << ">";
437 }
438 else
439 {
440 m_t << "</em>";
441 }
442 break;
444 if (s.enable()) m_t << "<kbd" << s.attribs().toString() << ">"; else m_t << "</kbd>";
445 break;
447 if (s.enable())
448 {
449 m_t << "<span class=\"tt\"" << s.attribs().toString() << ">";
450 m_insidePre=true;
451 }
452 else
453 {
454 m_t << "</span>";
455 m_insidePre=false;
456 }
457 break;
459 if (s.enable())
460 {
461 auto attribs = s.attribs();
462 if (s.tagName()=="p")
463 {
464 attribs.mergeAttribute("class","param");
465 }
466 m_t << "<code" << attribs.toString() << ">";
467 m_insidePre=true;
468 }
469 else
470 {
471 m_insidePre=false;
472 m_t << "</code>";
473 }
474 break;
476 if (s.enable()) m_t << "<sub" << s.attribs().toString() << ">"; else m_t << "</sub>";
477 break;
479 if (s.enable()) m_t << "<sup" << s.attribs().toString() << ">"; else m_t << "</sup>";
480 break;
482 if (s.enable())
483 {
485 m_t << "<center" << s.attribs().toString() << ">";
486 }
487 else
488 {
489 m_t << "</center>";
491 }
492 break;
494 if (s.enable()) m_t << "<small" << s.attribs().toString() << ">"; else m_t << "</small>";
495 break;
497 if (s.enable()) m_t << "<cite" << s.attribs().toString() << ">"; else m_t << "</cite>";
498 break;
500 if (s.enable())
501 {
503 m_t << "<pre" << s.attribs().toString() << ">";
505 }
506 else
507 {
509 m_t << "</pre>";
511 }
512 break;
514 if (s.enable())
515 {
517 m_t << "<div" << s.attribs().toString() << ">";
518 }
519 else
520 {
521 m_t << "</div>";
523 }
524 break;
526 if (s.enable()) m_t << "<span" << s.attribs().toString() << ">"; else m_t << "</span>";
527 break;
528 }
529}
const HtmlAttribList & attribs() const
Definition docnode.h:311
QCString tagName() const
Definition docnode.h:312
Style style() const
Definition docnode.h:307
bool enable() const
Definition docnode.h:309

References DocStyleChange::attribs(), DocStyleChange::Bold, DocStyleChange::Center, DocStyleChange::Cite, DocStyleChange::Code, DocStyleChange::Del, DocStyleChange::Div, DocStyleChange::enable(), FALSE, forceEndParagraph(), forceStartParagraph(), DocStyleChange::Ins, DocStyleChange::Italic, DocStyleChange::Kbd, m_hide, m_insidePre, m_t, DocStyleChange::Preformatted, DocStyleChange::S, DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Strike, DocStyleChange::style(), DocStyleChange::Subscript, DocStyleChange::Superscript, DocStyleChange::tagName(), HtmlAttribList::toString(), TRUE, DocStyleChange::Typewriter, and DocStyleChange::Underline.

◆ operator()() [51/59]

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

Definition at line 287 of file htmldocvisitor.cpp.

288{
289 if (m_hide) return;
290 if (m_insideTitle &&
291 (s.symbol()==HtmlEntityMapper::Sym_Quot || s.symbol()==HtmlEntityMapper::Sym_quot)) // escape "'s inside title="..."
292 {
293 m_t << "&quot;";
294 }
295 else
296 {
297 const char *res = HtmlEntityMapper::instance().html(s.symbol());
298 if (res)
299 {
300 m_t << res;
301 }
302 else
303 {
304 err("HTML: non supported HTML-entity found: {}\n",
306 }
307 }
308}
HtmlEntityMapper::SymType symbol() const
Definition docnode.h:332
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
const char * html(SymType symb, bool useInPrintf=FALSE) const
Access routine to the html code of the HTML entity.
#define err(fmt,...)
Definition message.h:127

References err, HtmlEntityMapper::html(), HtmlEntityMapper::instance(), m_hide, m_insideTitle, m_t, HtmlEntityMapper::Sym_Quot, HtmlEntityMapper::Sym_quot, DocSymbol::symbol(), and TRUE.

◆ operator()() [52/59]

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

Definition at line 2107 of file htmldocvisitor.cpp.

2108{
2109 visitChildren(t);
2110}

References visitChildren().

◆ operator()() [53/59]

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

Definition at line 1409 of file htmldocvisitor.cpp.

1410{
1411 if (m_hide) return;
1412 visitChildren(t);
1413}

References m_hide, and visitChildren().

◆ operator()() [54/59]

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

Definition at line 352 of file htmldocvisitor.cpp.

353{
354 if (m_hide) return;
355 if (u.isEmail()) // mail address
356 {
357 QCString url = u.url();
358 // obfuscate the mail address link
360 if (!Config_getBool(OBFUSCATE_EMAILS))
361 {
362 m_t << url;
363 }
364 else
365 {
366 const char *p = url.data();
367 // also obfuscate the address as shown on the web page
368 uint32_t size=5;
369 while (*p)
370 {
371 for (uint32_t j=0;j<size && *p;j++)
372 {
373 p = writeUTF8Char(m_t,p);
374 }
375 if (*p) m_t << "<span class=\"obfuscator\">.nosp@m.</span>";
376 if (size==5) size=4; else size=5;
377 }
378 }
379 m_t << "</a>";
380 }
381 else // web address
382 {
383 m_t << "<a href=\"";
384 filter(u.url());
385 m_t << "\">";
386 filter(u.url());
387 m_t << "</a>";
388 }
389}
QCString url() const
Definition docnode.h:192
bool isEmail() const
Definition docnode.h:193
const char * writeUTF8Char(TextStream &t, const char *s)
Writes the UTF8 character pointed to by s to stream t and returns a pointer to the next character.
Definition utf8.cpp:197

References Config_getBool, QCString::data(), filter(), DocURL::isEmail(), m_hide, m_t, DocURL::url(), writeObfuscatedMailAddress(), and writeUTF8Char().

◆ operator()() [55/59]

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

Definition at line 533 of file htmldocvisitor.cpp.

534{
535 if (m_hide) return;
536 QCString lang = m_langExt;
537 if (!s.language().isEmpty()) // explicit language setting
538 {
539 lang = s.language();
540 }
541 SrcLangExt langExt = getLanguageFromCodeLang(lang);
542 switch(s.type())
543 {
546 m_ci.startCodeFragment("DoxyCode");
548 s.context(),
549 s.text(),
550 langExt,
551 Config_getBool(STRIP_CODE_COMMENTS),
552 CodeParserOptions()
553 .setExample(s.isExample(), s.exampleFile())
554 .setInlineFragment(true)
555 .setSearchCtx(m_ctx)
556 );
557 m_ci.endCodeFragment("DoxyCode");
559 break;
562 m_t << "<pre class=\"fragment\">";
563 filter(s.text());
564 m_t << "</pre>";
566 break;
568 filter(s.text(), true);
569 break;
571 m_t << "<code class=\"JavaDocCode\">";
572 filter(s.text(), true);
573 m_t << "</code>";
574 break;
576 {
577 if (s.isBlock()) forceEndParagraph(s);
578 m_t << s.text();
579 if (s.isBlock()) forceStartParagraph(s);
580 }
581 break;
587 /* nothing */
588 break;
589
590 case DocVerbatim::Dot:
591 {
593
594 bool exists = false;
595 auto fileName = writeFileContents(Config_getString(HTML_OUTPUT)+"/inline_dotgraph_", // baseName
596 ".dot", // extension
597 s.text(), // contents
598 exists);
599 if (!fileName.isEmpty())
600 {
601 m_t << "<div class=\"dotgraph\">\n";
602 writeDotFile(fileName,s.relPath(),s.context(),s.srcFile(),s.srcLine(),!exists);
603 visitCaption(m_t, s);
604 m_t << "</div>\n";
605 }
606
608 }
609 break;
610 case DocVerbatim::Msc:
611 {
613
614 bool exists = false;
615 auto fileName = writeFileContents(Config_getString(HTML_OUTPUT)+"/inline_mscgraph_", // baseName
616 ".msc", // extension
617 "msc {"+s.text()+"}", // contents
618 exists);
619 if (!fileName.isEmpty())
620 {
621 m_t << "<div class=\"mscgraph\">\n";
622 writeMscFile(fileName,s.relPath(),s.context(),s.srcFile(),s.srcLine(),!exists);
623 visitCaption(m_t, s);
624 m_t << "</div>\n";
625 }
626
628 }
629 break;
631 {
633 QCString htmlOutput = Config_getString(HTML_OUTPUT);
634 QCString imgExt = getDotImageExtension();
635 PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP
636 if (imgExt=="svg")
637 {
639 }
640 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
641 htmlOutput,s.exampleFile(),
642 s.text(),format,s.engine(),s.srcFile(),s.srcLine(),true);
643 for (const auto &baseName: baseNameVector)
644 {
645 m_t << "<div class=\"plantumlgraph\">\n";
646 writePlantUMLFile(baseName,s.relPath(),s.context(),s.srcFile(),s.srcLine());
647 visitCaption(m_t, s);
648 m_t << "</div>\n";
649 }
651 }
652 break;
654 {
656 if (Config_getEnum(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLI) // CLI mode: pre-generate image via mmdc
657 {
658 auto htmlOutput = Config_getString(HTML_OUTPUT);
659 auto outputFormat = MermaidManager::OutputFormat::HTML;
660 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
661 QCString baseName = MermaidManager::instance().writeMermaidSource(
662 htmlOutput,s.exampleFile(),
663 s.text(),imageFormat,s.srcFile(),s.srcLine());
664 m_t << "<div class=\"mermaidgraph\">\n";
665 writeMermaidFile(baseName,s.relPath(),s.context(),s.srcFile(),s.srcLine());
666 visitCaption(m_t, s);
667 m_t << "</div>\n";
668 }
669 else // CLIENT_SIDE or AUTO mode: embed for client-side rendering
670 {
671 m_t << "<div class=\"mermaidgraph\">\n";
672 m_t << "<pre class=\"mermaid\">\n";
673 m_t << convertToHtml(s.text());
674 m_t << "</pre>\n";
675 visitCaption(m_t, s);
676 m_t << "</div>\n";
677 }
679 }
680 break;
681 }
682}
QCString srcFile() const
Definition docnode.h:397
int srcLine() const
Definition docnode.h:398
QCString language() const
Definition docnode.h:388
bool isBlock() const
Definition docnode.h:389
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
QCString relPath() const
Definition docnode.h:387
@ JavaDocLiteral
Definition docnode.h:378
void visitCaption(TextStream &t, const T &n)
SrcLangExt getLanguageFromCodeLang(QCString &fileName)
Routine to handle the language attribute of the \code command.
Definition util.cpp:5249

References DocVerbatim::Code, Config_getBool, Config_getEnum, Config_getString, DocVerbatim::context(), convertToHtml(), MermaidManager::convertToImageFormat(), DocVerbatim::DocbookOnly, DocVerbatim::Dot, DocVerbatim::engine(), DocVerbatim::exampleFile(), filter(), forceEndParagraph(), forceStartParagraph(), DocVisitor::getCodeParser(), getDotImageExtension(), getLanguageFromCodeLang(), MermaidManager::HTML, DocVerbatim::HtmlOnly, MermaidManager::instance(), PlantumlManager::instance(), DocVerbatim::isBlock(), QCString::isEmpty(), DocVerbatim::isExample(), DocVerbatim::JavaDocCode, DocVerbatim::JavaDocLiteral, DocVerbatim::language(), DocVerbatim::LatexOnly, m_ci, m_ctx, m_hide, m_langExt, m_t, DocVerbatim::ManOnly, DocVerbatim::Mermaid, DocVerbatim::Msc, CodeParserInterface::parseCode(), DocVerbatim::PlantUML, PlantumlManager::PUML_BITMAP, PlantumlManager::PUML_SVG, DocVerbatim::relPath(), DocVerbatim::RtfOnly, CodeParserOptions::setInlineFragment(), CodeParserOptions::setSearchCtx(), DocVerbatim::srcFile(), DocVerbatim::srcLine(), DocVerbatim::text(), DocVerbatim::type(), DocVerbatim::Verbatim, visitCaption(), writeDotFile(), writeFileContents(), writeMermaidFile(), MermaidManager::writeMermaidSource(), writeMscFile(), writePlantUMLFile(), PlantumlManager::writePlantUMLSource(), and DocVerbatim::XmlOnly.

◆ operator()() [56/59]

void HtmlDocVisitor::operator() ( const DocVhdlFlow & vf)

Definition at line 2122 of file htmldocvisitor.cpp.

2123{
2124 if (m_hide) return;
2125 if (VhdlDocGen::getFlowMember()) // use VHDL flow chart creator
2126 {
2128 QCString fname=FlowChart::convertNameToFileName();
2129 m_t << "<p>";
2131 m_t << " ";
2132 m_t << "<a href=\"";
2133 m_t << fname;
2134 m_t << ".svg\">";
2136 m_t << "</a>";
2137 if (vf.hasCaption())
2138 {
2139 m_t << "<br />";
2140 }
2141 }
2142 visitChildren(vf);
2143 if (VhdlDocGen::getFlowMember()) // use VHDL flow chart creator
2144 {
2145 m_t << "</p>";
2147 }
2148}
virtual const QCString & name() const =0
bool hasCaption() const
Definition docnode.h:762
static QCString convertNameToFileName()
virtual QCString trFlowchart()=0
static const MemberDef * getFlowMember()

References FlowChart::convertNameToFileName(), forceEndParagraph(), forceStartParagraph(), VhdlDocGen::getFlowMember(), DocVhdlFlow::hasCaption(), m_hide, m_t, Definition::name(), theTranslator, and visitChildren().

◆ operator()() [57/59]

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

Definition at line 274 of file htmldocvisitor.cpp.

275{
276 if (m_hide) return;
277 if (m_insidePre)
278 {
279 m_t << w.chars();
280 }
281 else
282 {
283 m_t << " ";
284 }
285}
QCString chars() const
Definition docnode.h:358

References DocWhiteSpace::chars(), m_hide, m_insidePre, and m_t.

◆ operator()() [58/59]

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

Definition at line 259 of file htmldocvisitor.cpp.

260{
261 if (m_hide) return;
262 filter(w.word());
263}
QCString word() const
Definition docnode.h:156

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

◆ operator()() [59/59]

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

Definition at line 2070 of file htmldocvisitor.cpp.

2071{
2072 if (m_hide) return;
2073 if (x.title().isEmpty()) return;
2074
2076 bool anonymousEnum = x.file()=="@";
2077 if (!anonymousEnum)
2078 {
2079 QCString fn = x.file();
2081 m_t << "<dl class=\"" << x.key() << "\"><dt><b><a class=\"el\" href=\""
2082 << x.relPath() << fn
2083 << "#" << x.anchor() << "\">";
2084 }
2085 else
2086 {
2087 m_t << "<dl class=\"" << x.key() << "\"><dt><b>";
2088 }
2089 filter(x.title());
2090 if (!anonymousEnum) m_t << "</a>";
2091 m_t << "</b></dt><dd>";
2092 visitChildren(x);
2093 if (x.title().isEmpty()) return;
2094 m_t << "</dd></dl>\n";
2096}
QCString anchor() const
Definition docnode.h:625
QCString key() const
Definition docnode.h:628
QCString relPath() const
Definition docnode.h:627
QCString file() const
Definition docnode.h:624
QCString title() const
Definition docnode.h:626
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:4942

References addHtmlExtensionIfMissing(), DocXRefItem::anchor(), DocXRefItem::file(), filter(), forceEndParagraph(), forceStartParagraph(), QCString::isEmpty(), DocXRefItem::key(), m_hide, m_t, DocXRefItem::relPath(), DocXRefItem::title(), and visitChildren().

◆ startLink()

void HtmlDocVisitor::startLink ( const QCString & ref,
const QCString & file,
const QCString & relPath,
const QCString & anchor,
const QCString & tooltip = "" )
private

Definition at line 2241 of file htmldocvisitor.cpp.

2244{
2245 //printf("HtmlDocVisitor: file=%s anchor=%s\n",qPrint(file),qPrint(anchor));
2246 if (!ref.isEmpty()) // link to entity imported via tag file
2247 {
2248 m_t << "<a class=\"elRef\" ";
2250 }
2251 else // local link
2252 {
2253 m_t << "<a class=\"el\" ";
2254 }
2255 m_t << "href=\"";
2256 QCString fn = file;
2258 m_t << createHtmlUrl(relPath,ref,true,
2259 m_fileName == Config_getString(HTML_OUTPUT)+"/"+fn,
2260 fn,
2261 anchor);
2262 m_t << "\"";
2263 if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\"";
2264 m_t << ">";
2265}
QCString externalLinkTarget(const bool parent)
Definition util.cpp:5745
QCString createHtmlUrl(const QCString &relPath, const QCString &ref, bool href, bool isLocalFile, const QCString &targetFileName, const QCString &anchor)
Definition util.cpp:5756

References addHtmlExtensionIfMissing(), Config_getString, convertToHtml(), createHtmlUrl(), externalLinkTarget(), QCString::isEmpty(), m_fileName, and m_t.

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

◆ visitCaption()

template<class T>
void HtmlDocVisitor::visitCaption ( TextStream & t,
const T & n )
private

Definition at line 242 of file htmldocvisitor.cpp.

243{
244 if (n.hasCaption())
245 {
246 t << "<div class=\"caption\">\n";
247 for (const auto &child : n.children())
248 {
249 std::visit(*this, child);
250 }
251 t << "</div>\n";
252 }
253}

Referenced by operator()().

◆ visitChildren()

◆ writeDiaFile()

void HtmlDocVisitor::writeDiaFile ( const QCString & fileName,
const QCString & relPath,
const QCString & context,
const QCString & srcFile,
int srcLine,
bool newFile = true )
private

Definition at line 2294 of file htmldocvisitor.cpp.

2296{
2297 QCString baseName=makeBaseName(fileName,".dia");
2298 baseName.prepend("dia_");
2299 QCString outDir = Config_getString(HTML_OUTPUT);
2300 if (newFile) writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::BITMAP,srcFile,srcLine,true);
2301
2302 m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n";
2303}
void writeDiaGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, DiaOutputFormat format, const QCString &srcFile, int srcLine, bool toIndex)
Definition dia.cpp:28

References BITMAP, Config_getString, m_t, makeBaseName(), QCString::prepend(), and writeDiaGraphFromFile().

Referenced by operator()().

◆ writeDotFile()

void HtmlDocVisitor::writeDotFile ( const QCString & fileName,
const QCString & relPath,
const QCString & context,
const QCString & srcFile,
int srcLine,
bool newFile = true )
private

Definition at line 2272 of file htmldocvisitor.cpp.

2274{
2275 QCString baseName=makeBaseName(fileName,".dot");
2276 baseName.prepend("dot_");
2277 QCString outDir = Config_getString(HTML_OUTPUT);
2278 if (newFile) writeDotGraphFromFile(fileName,outDir,baseName,GraphOutputFormat::BITMAP,srcFile,srcLine,true);
2279 writeDotImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,-1,srcFile,srcLine,newFile);
2280}
void writeDotGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, GraphOutputFormat format, const QCString &srcFile, int srcLine, bool toIndex)
Definition dot.cpp:196
void writeDotImageMapFromFile(TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, int graphId, const QCString &srcFile, int srcLine, bool newFile)
Definition dot.cpp:249

References BITMAP, Config_getString, m_t, makeBaseName(), QCString::prepend(), writeDotGraphFromFile(), and writeDotImageMapFromFile().

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

◆ writeMermaidFile()

void HtmlDocVisitor::writeMermaidFile ( const QCString & fileName,
const QCString & relPath,
const QCString & context,
const QCString & srcFile,
int srcLine )
private

Definition at line 2326 of file htmldocvisitor.cpp.

2328{
2329 auto baseName = makeBaseName(fileName,".mmd");
2330 auto outDir = Config_getString(HTML_OUTPUT);
2331 auto outputFormat = MermaidManager::OutputFormat::HTML;
2332 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
2333 auto imgExt = MermaidManager::imageExtension(imageFormat);
2334 MermaidManager::instance().generateMermaidOutput(fileName,outDir,imageFormat,true);
2335 if (imageFormat == MermaidManager::ImageFormat::SVG)
2336 {
2337 m_t << "<object type=\"image/svg+xml\" data=\"" << relPath << baseName << "." << imgExt << "\"></object>\n";
2338 }
2339 else
2340 {
2341 m_t << "<img src=\"" << relPath << baseName << "." << imgExt << "\" />\n";
2342 }
2343}
void generateMermaidOutput(const QCString &baseName, const QCString &outDir, ImageFormat format, bool toIndex)
Register a generated Mermaid image with the index.
Definition mermaid.cpp:117
static QCString imageExtension(ImageFormat imageFormat)
Definition mermaid.cpp:43

References Config_getString, MermaidManager::convertToImageFormat(), MermaidManager::generateMermaidOutput(), MermaidManager::HTML, MermaidManager::imageExtension(), MermaidManager::instance(), m_t, makeBaseName(), and MermaidManager::SVG.

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

◆ writeMscFile()

void HtmlDocVisitor::writeMscFile ( const QCString & fileName,
const QCString & relPath,
const QCString & context,
const QCString & srcFile,
int srcLine,
bool newFile = true )
private

Definition at line 2282 of file htmldocvisitor.cpp.

2284{
2285 QCString baseName=makeBaseName(fileName,".msc");
2286 baseName.prepend("msc_");
2287 QCString outDir = Config_getString(HTML_OUTPUT);
2288 QCString imgExt = getDotImageExtension();
2289 MscOutputFormat mscFormat = imgExt=="svg" ? MscOutputFormat::SVG : MscOutputFormat::BITMAP;
2290 if (newFile) writeMscGraphFromFile(fileName,outDir,baseName,mscFormat,srcFile,srcLine,true);
2291 writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,mscFormat,srcFile,srcLine);
2292}
void writeMscImageMapFromFile(TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, MscOutputFormat format, const QCString &srcFile, int srcLine)
Definition msc.cpp:233
void writeMscGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, MscOutputFormat format, const QCString &srcFile, int srcLine, bool toIndex)
Definition msc.cpp:157
MscOutputFormat
Definition msc.h:22

References BITMAP, Config_getString, getDotImageExtension(), m_t, makeBaseName(), QCString::prepend(), SVG, writeMscGraphFromFile(), and writeMscImageMapFromFile().

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

◆ writeObfuscatedMailAddress()

void HtmlDocVisitor::writeObfuscatedMailAddress ( const QCString & url)
private

Definition at line 324 of file htmldocvisitor.cpp.

325{
326 if (!Config_getBool(OBFUSCATE_EMAILS))
327 {
328 m_t << "<a href=\"mailto:" << url << "\">";
329 }
330 else
331 {
332 m_t << "<a href=\"#\" onclick=\"location.href='mai'+'lto:'";
333 if (!url.isEmpty())
334 {
335 const char *p = url.data();
336 uint32_t size=3;
337 while (*p)
338 {
339 m_t << "+'";
340 for (uint32_t j=0;j<size && *p;j++)
341 {
342 p = writeUTF8Char(m_t,p);
343 }
344 m_t << "'";
345 if (size==3) size=2; else size=3;
346 }
347 }
348 m_t << "; return false;\">";
349 }
350}

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

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

◆ writePlantUMLFile()

void HtmlDocVisitor::writePlantUMLFile ( const QCString & fileName,
const QCString & relPath,
const QCString & context,
const QCString & srcFile,
int srcLine )
private

Definition at line 2305 of file htmldocvisitor.cpp.

2307{
2308 QCString baseName=makeBaseName(fileName,".pu");
2309 QCString outDir = Config_getString(HTML_OUTPUT);
2310 QCString imgExt = getDotImageExtension();
2311 if (imgExt=="svg")
2312 {
2314 //m_t << "<iframe scrolling=\"no\" frameborder=\"0\" src=\"" << relPath << baseName << ".svg" << "\" />\n";
2315 //m_t << "<p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p>";
2316 //m_t << "</iframe>\n";
2317 m_t << "<object type=\"image/svg+xml\" data=\"" << relPath << baseName << ".svg\"></object>\n";
2318 }
2319 else
2320 {
2322 m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n";
2323 }
2324}
void generatePlantUMLOutput(const QCString &baseName, const QCString &outDir, OutputFormat format, bool toIndex)
Convert a PlantUML file to an image.
Definition plantuml.cpp:202

References Config_getString, PlantumlManager::generatePlantUMLOutput(), getDotImageExtension(), PlantumlManager::instance(), m_t, makeBaseName(), PlantumlManager::PUML_BITMAP, and PlantumlManager::PUML_SVG.

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

Member Data Documentation

◆ m_ci

OutputCodeList& HtmlDocVisitor::m_ci
private

Definition at line 148 of file htmldocvisitor.h.

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

◆ m_ctx

const Definition* HtmlDocVisitor::m_ctx
private

Definition at line 152 of file htmldocvisitor.h.

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

◆ m_fileName

QCString HtmlDocVisitor::m_fileName
private

Definition at line 153 of file htmldocvisitor.h.

Referenced by HtmlDocVisitor(), and startLink().

◆ m_hide

◆ m_insidePre

bool HtmlDocVisitor::m_insidePre = false
private

Definition at line 149 of file htmldocvisitor.h.

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

◆ m_insideTitle

bool HtmlDocVisitor::m_insideTitle = false
private

Definition at line 151 of file htmldocvisitor.h.

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

◆ m_langExt

QCString HtmlDocVisitor::m_langExt
private

Definition at line 154 of file htmldocvisitor.h.

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

◆ m_t


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