MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / escapeHtml

Function escapeHtml

app/src/Sessions/HtmlReport.cpp:53–79  ·  view source on GitHub ↗

* @brief Escapes user-supplied text for safe placement in HTML body content. */

Source from the content-addressed store, hash-verified

51 * @brief Escapes user-supplied text for safe placement in HTML body content.
52 */
53static QString escapeHtml(const QString& in)
54{
55 QString out;
56 out.reserve(in.size());
57 for (const QChar& c : in) {
58 switch (c.unicode()) {
59 case '&':
60 out += QStringLiteral("&");
61 break;
62 case '<':
63 out += QStringLiteral("&lt;");
64 break;
65 case '>':
66 out += QStringLiteral("&gt;");
67 break;
68 case '"':
69 out += QStringLiteral("&quot;");
70 break;
71 case '\'':
72 out += QStringLiteral("&#39;");
73 break;
74 default:
75 out += c;
76 }
77 }
78 return out;
79}
80
81/**
82 * @brief Formats a double for tabular display (used in the cell text + the

Callers 5

buildHtmlMethod · 0.85
buildCoverSectionMethod · 0.85
buildMetadataSectionMethod · 0.85
buildSummarySectionMethod · 0.85
buildChartsSectionMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected