summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes/qmimeglobpattern_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/mimetypes/qmimeglobpattern_p.h')
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern_p.h19
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)