Commit 3c49248a authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Use ternary to return a multiple choice

parent 609b09e8
...@@ -397,14 +397,9 @@ UrlFilter::HotSpot::HotSpot(int startLine, int startColumn, int endLine, int end ...@@ -397,14 +397,9 @@ UrlFilter::HotSpot::HotSpot(int startLine, int startColumn, int endLine, int end
UrlFilter::HotSpot::UrlType UrlFilter::HotSpot::urlType() const UrlFilter::HotSpot::UrlType UrlFilter::HotSpot::urlType() const
{ {
const QString url = capturedTexts().at(0); const QString url = capturedTexts().at(0);
return FullUrlRegExp.match(url).hasMatch() ? StandardUrl
if (FullUrlRegExp.match(url).hasMatch()) { : EmailAddressRegExp.match(url).hasMatch() ? Email
return StandardUrl; : Unknown;
} else if (EmailAddressRegExp.match(url).hasMatch()) {
return Email;
} else {
return Unknown;
}
} }
void UrlFilter::HotSpot::activate(QObject *object) void UrlFilter::HotSpot::activate(QObject *object)
...@@ -562,6 +557,7 @@ QString createFileRegex(const QStringList &patterns, const QString &filePattern, ...@@ -562,6 +557,7 @@ QString createFileRegex(const QStringList &patterns, const QString &filePattern,
QStringList prefixes = patterns.filter(QRegularExpression(QStringLiteral("^") + filePattern + QStringLiteral("+\\*$"))); QStringList prefixes = patterns.filter(QRegularExpression(QStringLiteral("^") + filePattern + QStringLiteral("+\\*$")));
const QStringList fullNames = patterns.filter(QRegularExpression(QStringLiteral("^") + filePattern + QStringLiteral("$"))); const QStringList fullNames = patterns.filter(QRegularExpression(QStringLiteral("^") + filePattern + QStringLiteral("$")));
suffixes.replaceInStrings(QStringLiteral("*"), QString()); suffixes.replaceInStrings(QStringLiteral("*"), QString());
suffixes.replaceInStrings(QStringLiteral("."), QStringLiteral("\\.")); suffixes.replaceInStrings(QStringLiteral("."), QStringLiteral("\\."));
prefixes.replaceInStrings(QStringLiteral("*"), QString()); prefixes.replaceInStrings(QStringLiteral("*"), QString());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment