4#ifndef QMIMEGLOBPATTERN_P_H
5#define QMIMEGLOBPATTERN_P_H
18#include <QtCore/private/qglobal_p.h>
22#include <QtCore/qstringlist.h>
23#include <QtCore/qhash.h>
49 m_pattern(
s ==
Qt::CaseInsensitive ? thePattern.toLower() : thePattern),
50 m_mimeType(theMimeType),
53 m_patternType(detectPatternType(m_pattern))
62 qSwap(m_caseSensitivity,
other.m_caseSensitivity);
69 inline unsigned weight()
const {
return m_weight; }
88 PatternType m_patternType;
102 return std::any_of(
begin(),
end(), matchesMimeAndPattern);
113 removeIf(isMimeTypeEqual);
Result of the globs parsing, as data structures ready for efficient MIME type matching.
void addGlob(const QMimeGlobPattern &glob)
void matchingGlobs(const QString &fileName, QMimeGlobMatchResult &result, const AddMatchFilterFunc &filterFunc) const
PatternsMap m_fastPatterns
void removeMimeType(const QString &mimeType)
QHash< QString, QStringList > PatternsMap
QMimeGlobPatternList m_highWeightGlobs
QMimeGlobPatternList m_lowWeightGlobs
bool hasPattern(QStringView mimeType, QStringView pattern) const
void removeMimeType(QStringView mimeType)
"noglobs" is very rare occurrence, so it's ok if it's slow
The QMimeGlobPattern class contains the glob pattern for file names for MIME type matching.
static const unsigned MinWeight
QMimeGlobPattern(const QString &thePattern, const QString &theMimeType, unsigned theWeight=DefaultWeight, Qt::CaseSensitivity s=Qt::CaseInsensitive)
static const unsigned DefaultWeight
void swap(QMimeGlobPattern &other) noexcept
const QString & mimeType() const
static const unsigned MaxWeight
const QString & pattern() const
bool matchFileName(const QString &inputFileName) const
bool isCaseSensitive() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
std::function< bool(const QString &)> AddMatchFilterFunc
GLuint GLuint GLfloat weight
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
#define QT_REQUIRE_CONFIG(feature)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
The QMimeGlobMatchResult class accumulates results from glob matching.
void addMatch(const QString &mimeType, int weight, const QString &pattern, qsizetype knownSuffixLength=0)
qsizetype m_matchingPatternLength
QStringList m_allMatchingMimeTypes
qsizetype m_knownSuffixLength
QStringList m_matchingMimeTypes