* @brief Escapes user-supplied text for safe placement in HTML body content. */
| 51 | * @brief Escapes user-supplied text for safe placement in HTML body content. |
| 52 | */ |
| 53 | static 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("<"); |
| 64 | break; |
| 65 | case '>': |
| 66 | out += QStringLiteral(">"); |
| 67 | break; |
| 68 | case '"': |
| 69 | out += QStringLiteral("""); |
| 70 | break; |
| 71 | case '\'': |
| 72 | out += QStringLiteral("'"); |
| 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 |
no test coverage detected