MCPcopy Create free account
hub / github.com/KDE/kdevelop / processLine

Method processLine

plugins/clazy/utils.cpp:144–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142 }
143
144 void processLine(QString& line)
145 {
146 static const QRegularExpression ttRE(QStringLiteral("`([^`]+)`"));
147 static const QRegularExpression bdRE(QStringLiteral("\\*\\*([^\\*]+)\\*\\*"));
148 static const QRegularExpression itRE(QStringLiteral("[^\\*]\\*([^\\*]+)\\*[^\\*]"));
149
150 static auto applyRE = [](const QRegularExpression& re, QString& line, const QString& tag) {
151 auto i = re.globalMatch(line);
152 while (i.hasNext()) {
153 auto match = i.next();
154 line.replace(match.captured(0), QStringLiteral("<%1>%2</%1>").arg(tag, match.captured(1)));
155 }
156 };
157
158 if (state != PREFORMATTED) {
159 line.replace(QLatin1Char('&'), QLatin1String("&amp;"));
160 line.replace(QLatin1Char('<'), QLatin1String("&lt;"));
161 line.replace(QLatin1Char('>'), QLatin1String("&gt;"));
162
163 line.replace(QLatin1Char('\"'), QLatin1String("&quot;"));
164 line.replace(QLatin1Char('\''), QLatin1String("&#39;"));
165
166 applyRE(ttRE, line, QStringLiteral("tt"));
167 applyRE(bdRE, line, QStringLiteral("b"));
168 applyRE(itRE, line, QStringLiteral("i"));
169 }
170
171 html += line;
172 }
173
174private:
175 int state;

Callers

nothing calls this directly

Calls 3

hasNextMethod · 0.45
nextMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected