diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-11-11 09:29:17 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-11-11 09:29:17 +0200 |
commit | 4ee4fc18b4067b90efa46ca9baba74f53b54d9ec (patch) | |
tree | cc68622c9b85992d99a8373ab55471ee821a4ebf /src/corelib/mimetypes/qmimeglobpattern_p.h | |
parent | ab28ff2207e8f33754c79793089dbf943d67736d (diff) | |
parent | ebb49c66aaf22ed55d62ff7bc3690fce00b7d8ba (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
Change-Id: I569a2246c9e8d70430e8c5405b9f3df2218078ee
Diffstat (limited to 'src/corelib/mimetypes/qmimeglobpattern_p.h')
-rw-r--r-- | src/corelib/mimetypes/qmimeglobpattern_p.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h index 49f145e8db..88d032c787 100644 --- a/src/corelib/mimetypes/qmimeglobpattern_p.h +++ b/src/corelib/mimetypes/qmimeglobpattern_p.h @@ -80,7 +80,10 @@ public: explicit QMimeGlobPattern(const QString &thePattern, const QString &theMimeType, unsigned theWeight = DefaultWeight, Qt::CaseSensitivity s = Qt::CaseInsensitive) : m_pattern(s == Qt::CaseInsensitive ? thePattern.toLower() : thePattern), - m_mimeType(theMimeType), m_weight(theWeight), m_caseSensitivity(s) + m_mimeType(theMimeType), + m_weight(theWeight), + m_caseSensitivity(s), + m_patternType(detectPatternType(m_pattern)) { } @@ -90,9 +93,10 @@ public: qSwap(m_mimeType, other.m_mimeType); qSwap(m_weight, other.m_weight); qSwap(m_caseSensitivity, other.m_caseSensitivity); + qSwap(m_patternType, other.m_patternType); } - bool matchFileName(const QString &filename) const; + bool matchFileName(const QString &inputFileName) const; inline const QString &pattern() const { return m_pattern; } inline unsigned weight() const { return m_weight; } @@ -100,10 +104,21 @@ public: inline bool isCaseSensitive() const { return m_caseSensitivity == Qt::CaseSensitive; } private: + enum PatternType { + SuffixPattern, + PrefixPattern, + LiteralPattern, + VdrPattern, // special handling for "[0-9][0-9][0-9].vdr" pattern + AnimPattern, // special handling for "*.anim[1-9j]" pattern + OtherPattern + }; + PatternType detectPatternType(const QString &pattern) const; + QString m_pattern; QString m_mimeType; int m_weight; Qt::CaseSensitivity m_caseSensitivity; + PatternType m_patternType; }; Q_DECLARE_SHARED(QMimeGlobPattern) |