Mimetypes v3: Fix build with Qt 5

Change-Id: I871952c5c4ed97d04bd7acdb9f4af225f1550b69
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Eike Ziller
2022-02-23 11:27:20 +01:00
parent d8be61343a
commit 8e0bc89e64
3 changed files with 9 additions and 4 deletions

View File

@@ -185,9 +185,10 @@ bool MimeGlobPattern::matchFileName(const QString &inputFileName) const
return lastCharOK && QStringView{fileName}.mid(fileNameLength - 6, 5) == QLatin1String(".anim");
}
case OtherPattern:
// Other fallback patterns: slow but correct method
#if QT_CONFIG(regularexpression)
auto rx = QRegularExpression::fromWildcard(m_pattern);
// Other fallback patterns: slow but correct method
const QRegularExpression rx(QRegularExpression::anchoredPattern(
QRegularExpression::wildcardToRegularExpression(m_pattern)));
return rx.match(fileName).hasMatch();
#else
return false;

View File

@@ -137,7 +137,7 @@ public:
auto isMimeTypeEqual = [&mimeType](const MimeGlobPattern &pattern) {
return pattern.mimeType() == mimeType;
};
removeIf(isMimeTypeEqual);
erase(std::remove_if(begin(), end(), isMimeTypeEqual), end());
}
void match(MimeGlobMatchResult &result, const QString &fileName) const;

View File

@@ -75,7 +75,11 @@ public:
MimeType();
MimeType(const MimeType &other);
MimeType &operator=(const MimeType &other);
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(MimeType)
MimeType &operator=(MimeType &&other) noexcept
{
swap(other);
return *this;
}
void swap(MimeType &other) noexcept
{
d.swap(other.d);