forked from qt-creator/qt-creator
Mimetypes v3: Fix build with Qt 5
Change-Id: I871952c5c4ed97d04bd7acdb9f4af225f1550b69 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -185,9 +185,10 @@ bool MimeGlobPattern::matchFileName(const QString &inputFileName) const
|
|||||||
return lastCharOK && QStringView{fileName}.mid(fileNameLength - 6, 5) == QLatin1String(".anim");
|
return lastCharOK && QStringView{fileName}.mid(fileNameLength - 6, 5) == QLatin1String(".anim");
|
||||||
}
|
}
|
||||||
case OtherPattern:
|
case OtherPattern:
|
||||||
// Other fallback patterns: slow but correct method
|
|
||||||
#if QT_CONFIG(regularexpression)
|
#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();
|
return rx.match(fileName).hasMatch();
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@@ -137,7 +137,7 @@ public:
|
|||||||
auto isMimeTypeEqual = [&mimeType](const MimeGlobPattern &pattern) {
|
auto isMimeTypeEqual = [&mimeType](const MimeGlobPattern &pattern) {
|
||||||
return pattern.mimeType() == mimeType;
|
return pattern.mimeType() == mimeType;
|
||||||
};
|
};
|
||||||
removeIf(isMimeTypeEqual);
|
erase(std::remove_if(begin(), end(), isMimeTypeEqual), end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void match(MimeGlobMatchResult &result, const QString &fileName) const;
|
void match(MimeGlobMatchResult &result, const QString &fileName) const;
|
||||||
|
@@ -75,7 +75,11 @@ public:
|
|||||||
MimeType();
|
MimeType();
|
||||||
MimeType(const MimeType &other);
|
MimeType(const MimeType &other);
|
||||||
MimeType &operator=(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
|
void swap(MimeType &other) noexcept
|
||||||
{
|
{
|
||||||
d.swap(other.d);
|
d.swap(other.d);
|
||||||
|
Reference in New Issue
Block a user