KDECore
kmimeglobsfileparser.cpp
Go to the documentation of this file.
36 const QStringList globFiles = KGlobal::dirs()->findAllResources("xdgdata-mime", QString::fromLatin1("globs"));
47KMimeGlobsFileParser::AllGlobs KMimeGlobsFileParser::parseGlobFiles(const QStringList& globFiles, QStringList& parsedFiles)
52 // At each level, we must be able to override (not just add to) the information that we read at higher levels
57 QString fileNamev2 = fileName + QLatin1Char('2'); // NOTE: this relies on u-m-d always generating the old globs file
76 // If we're not going to get the "cs" flag because smi is too old, then we need to emulate it for *.C at least.
77 const bool caseSensitiveHackNeeded = (KMimeType::sharedMimeInfoVersion() <= KDE_MAKE_VERSION(0, 60, 0));
123 if (caseSensitiveHackNeeded && (pattern == QLatin1String("*.C") || pattern == QLatin1String("*.c") || pattern == QLatin1String("core")))
136 // kDebug() << "Adding pattern" << pattern << "to mimetype" << mimeTypeName << "from globs file, with weight" << weight;
138 // kDebug() << " Adding pattern" << pattern << "to mimetype" << mimeTypeName << "from globs file, with weight" << weight << "flags" << flags;
167 //kDebug() << "pattern" << pattern << "glob.weight=" << glob.weight << "isFast=" << isFastPattern(pattern) << glob.flags;
169 // Store each patterns into either m_fastPatternDict (*.txt, *.html etc. with default weight 50)
173 if (glob.weight == 50 && isFastPattern(pattern) && ((glob.flags & KMimeTypeRepository::CaseSensitive) == 0)) {
Result of the globs parsing, as data structures ready for efficient mimetype matching.
Definition: kmimeglobsfileparser_p.h:86
PatternsMap patternsMap() const
Definition: kmimeglobsfileparser.cpp:193
GlobList m_highWeightGlobs
Definition: kmimeglobsfileparser_p.h:93
QHash< QString, QStringList > m_fastPatterns
Definition: kmimeglobsfileparser_p.h:92
void removeMime(const QString &mime)
Definition: kmimeglobsfileparser.cpp:216
GlobList m_lowWeightGlobs
Definition: kmimeglobsfileparser_p.h:94
void addGlob(const Glob &glob)
Definition: kmimeglobsfileparser.cpp:158
bool hasPattern(const QString &mime, const QString &pattern) const
Definition: kmimeglobsfileparser_p.h:57
static AllGlobs parseGlobFiles(const QStringList &globFiles, QStringList &parsedFiles)
Definition: kmimeglobsfileparser.cpp:47
static bool parseGlobFile(QIODevice *file, Format format, AllGlobs &globs)
Definition: kmimeglobsfileparser.cpp:71
KMimeGlobsFileParser()
Definition: kmimeglobsfileparser.cpp:30
static int sharedMimeInfoVersion()
Returns the version of the installed update-mime-database program (from freedesktop....
Definition: kmimetype.cpp:738
QStringList findAllResources(const char *type, const QString &filter=QString(), SearchOptions options=NoSearchOptions) const
Tries to find all resources with the specified type.
Definition: kstandarddirs.cpp:900
static bool isFastPattern(const QString &pattern)
Definition: kmimeglobsfileparser.cpp:147
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.