9#include <QtCore/qglobal.h>
13#include <QtCore/qobjectdefs.h>
14#include <QtCore/qshareddata.h>
15#include <QtCore/qstring.h>
16#include <QtCore/qstringlist.h>
20class QMimeTypePrivate;
23Q_CORE_EXPORT size_t qHash(
const QMimeType &key, size_t seed = 0)
noexcept;
28 Q_PROPERTY(
bool valid READ isValid CONSTANT)
29 Q_PROPERTY(
bool isDefault READ isDefault CONSTANT)
30 Q_PROPERTY(QString name READ name CONSTANT)
31 Q_PROPERTY(QString comment READ comment CONSTANT)
32 Q_PROPERTY(QString genericIconName READ genericIconName CONSTANT)
33 Q_PROPERTY(QString iconName READ iconName CONSTANT)
34 Q_PROPERTY(QStringList globPatterns READ globPatterns CONSTANT)
35 Q_PROPERTY(QStringList parentMimeTypes READ parentMimeTypes CONSTANT)
36 Q_PROPERTY(QStringList allAncestors READ allAncestors CONSTANT)
37 Q_PROPERTY(QStringList aliases READ aliases CONSTANT)
38 Q_PROPERTY(QStringList suffixes READ suffixes CONSTANT)
39 Q_PROPERTY(QString preferredSuffix READ preferredSuffix CONSTANT)
40 Q_PROPERTY(QString filterString READ filterString CONSTANT)
44 QMimeType(
const QMimeType &other);
45 QMimeType &operator=(
const QMimeType &other);
46 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMimeType)
47 void swap(QMimeType &other)
noexcept
51 explicit QMimeType(
const QMimeTypePrivate &dd);
53#if QT_CORE_REMOVED_SINCE(6
, 8
)
54 bool operator==(
const QMimeType &other)
const;
56 inline bool operator!=(
const QMimeType &other)
const
58 return !operator==(other);
63 bool isDefault()
const;
66 QString comment()
const;
67 QString genericIconName()
const;
68 QString iconName()
const;
69 QStringList globPatterns()
const;
70 QStringList parentMimeTypes()
const;
71 QStringList allAncestors()
const;
72 QStringList aliases()
const;
73 QStringList suffixes()
const;
74 QString preferredSuffix()
const;
76 Q_INVOKABLE
bool inherits(
const QString &mimeTypeName)
const;
78 QString filterString()
const;
81 friend class QMimeTypeParserBase;
82 friend class MimeTypeMapEntry;
83 friend class QMimeDatabasePrivate;
84 friend class QMimeXMLProvider;
85 friend class QMimeBinaryProvider;
86 friend class QMimeTypePrivate;
87 friend Q_CORE_EXPORT size_t qHash(
const QMimeType &key, size_t seed)
noexcept;
89 QExplicitlySharedDataPointer<QMimeTypePrivate> d;
92 friend Q_CORE_EXPORT
bool comparesEqual(
const QMimeType &lhs,
const QMimeType &rhs)
noexcept;
93 Q_DECLARE_EQUALITY_COMPARABLE(QMimeType)
98#ifndef QT_NO_DEBUG_STREAM
100Q_CORE_EXPORT
QDebug operator<<(QDebug debug,
const QMimeType &mime);
QString resolveAlias(const QString &nameOrAlias)
QStringList listAliases(const QString &mimeName)
QList< QMimeType > allMimeTypes()
QString genericIcon(const QString &name)
QMimeTypePrivate::LocaleHash localeComments(const QString &name)
bool mimeInherits(const QString &mime, const QString &parent)
QMimeType mimeTypeForFileExtension(const QString &fileName)
QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device)
QMimeType mimeTypeForData(QIODevice *device)
QStringList mimeTypeForFileName(const QString &fileName)
bool inherits(const QString &mime, const QString &parent)
QMimeType mimeTypeForName(const QString &nameOrAlias)
QStringList mimeParents(const QString &mimeName)
QStringList globPatterns(const QString &name)
const QString & defaultMimeType() const
QString icon(const QString &name)
static QMimeDatabasePrivate * instance()
QMimeType mimeTypeForFile(const QString &fileName, const QFileInfo &fileInfo, QMimeDatabase::MatchMode mode)
QStringList parents(const QString &mimeName)
QMimeGlobMatchResult findByFileName(const QString &fileName)
QMimeType findByData(const QByteArray &data, int *priorityPtr)
QMimeType mimeTypeForName(const QString &nameOrAlias) const
Returns a MIME type for nameOrAlias or an invalid one if none found.
QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const
Returns a MIME type for the given fileName and device data.
QMimeType mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode=MatchDefault) const
Returns a MIME type for fileInfo.
QList< QMimeType > mimeTypesForFileName(const QString &fileName) const
Returns the MIME types for the file name fileName.
QMimeType mimeTypeForUrl(const QUrl &url) const
Returns a MIME type for url.
QMimeType mimeTypeForData(const QByteArray &data) const
Returns a MIME type for data.
QString suffixForFileName(const QString &fileName) const
Returns the suffix for the file fileName, as known by the MIME database.
MatchMode
This enum specifies how matching a file to a MIME type is performed.
QList< QMimeType > allMimeTypes() const
Returns the list of all available MIME types.
QMimeType mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const
Returns a MIME type for the given fileName and device data.
QMimeType mimeTypeForData(QIODevice *device) const
Returns a MIME type for the data in device.
QMimeType mimeTypeForFile(const QString &fileName, MatchMode mode=MatchDefault) const
Returns a MIME type for the file named fileName using mode.
@ InternalDatabaseAvailable
QT_REQUIRE_CONFIG(animation)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
static bool isTextFile(const QByteArray &data)
static Q_CONSTINIT const int qmime_secondsBetweenChecks
static QStringList locateMimeDirectories()
static QString directoryMimeType()
static QString plainTextMimeType()
QT_REQUIRE_CONFIG(mimetype)