Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:21:37

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
0003 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0004 // Qt-Security score:significant reason:default
0005 
0006 #ifndef QMIMETYPE_H
0007 #define QMIMETYPE_H
0008 
0009 #include <QtCore/qglobal.h>
0010 
0011 QT_REQUIRE_CONFIG(mimetype);
0012 
0013 #include <QtCore/qobjectdefs.h>
0014 #include <QtCore/qshareddata.h>
0015 #include <QtCore/qstring.h>
0016 #include <QtCore/qstringlist.h>
0017 
0018 QT_BEGIN_NAMESPACE
0019 
0020 class QMimeTypePrivate;
0021 class QMimeType;
0022 
0023 Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed = 0) noexcept;
0024 
0025 class Q_CORE_EXPORT QMimeType
0026 {
0027     Q_GADGET
0028     Q_PROPERTY(bool valid READ isValid CONSTANT)
0029     Q_PROPERTY(bool isDefault READ isDefault CONSTANT)
0030     Q_PROPERTY(QString name READ name CONSTANT)
0031     Q_PROPERTY(QString comment READ comment CONSTANT)
0032     Q_PROPERTY(QString genericIconName READ genericIconName CONSTANT)
0033     Q_PROPERTY(QString iconName READ iconName CONSTANT)
0034     Q_PROPERTY(QStringList globPatterns READ globPatterns CONSTANT)
0035     Q_PROPERTY(QStringList parentMimeTypes READ parentMimeTypes CONSTANT)
0036     Q_PROPERTY(QStringList allAncestors READ allAncestors CONSTANT)
0037     Q_PROPERTY(QStringList aliases READ aliases CONSTANT)
0038     Q_PROPERTY(QStringList suffixes READ suffixes CONSTANT)
0039     Q_PROPERTY(QString preferredSuffix READ preferredSuffix CONSTANT)
0040     Q_PROPERTY(QString filterString READ filterString CONSTANT)
0041 
0042 public:
0043     QMimeType();
0044     QMimeType(const QMimeType &other);
0045     QMimeType &operator=(const QMimeType &other);
0046     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMimeType)
0047     void swap(QMimeType &other) noexcept
0048     {
0049         d.swap(other.d);
0050     }
0051     explicit QMimeType(const QMimeTypePrivate &dd);
0052     ~QMimeType();
0053 #if QT_CORE_REMOVED_SINCE(6, 8)
0054     bool operator==(const QMimeType &other) const;
0055 
0056     inline bool operator!=(const QMimeType &other) const
0057     {
0058         return !operator==(other);
0059     }
0060 #endif
0061     bool isValid() const;
0062 
0063     bool isDefault() const;
0064 
0065     QString name() const;
0066     QString comment() const;
0067     QString genericIconName() const;
0068     QString iconName() const;
0069     QStringList globPatterns() const;
0070     QStringList parentMimeTypes() const;
0071     QStringList allAncestors() const;
0072     QStringList aliases() const;
0073     QStringList suffixes() const;
0074     QString preferredSuffix() const;
0075 
0076     Q_INVOKABLE bool inherits(const QString &mimeTypeName) const;
0077 
0078     QString filterString() const;
0079 
0080 protected:
0081     friend class QMimeTypeParserBase;
0082     friend class MimeTypeMapEntry;
0083     friend class QMimeDatabasePrivate;
0084     friend class QMimeXMLProvider;
0085     friend class QMimeBinaryProvider;
0086     friend class QMimeTypePrivate;
0087     friend Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed) noexcept;
0088 
0089     QExplicitlySharedDataPointer<QMimeTypePrivate> d;
0090 
0091 private:
0092     friend Q_CORE_EXPORT bool comparesEqual(const QMimeType &lhs, const QMimeType &rhs) noexcept;
0093     Q_DECLARE_EQUALITY_COMPARABLE(QMimeType)
0094 };
0095 
0096 Q_DECLARE_SHARED(QMimeType)
0097 
0098 #ifndef QT_NO_DEBUG_STREAM
0099 class QDebug;
0100 Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMimeType &mime);
0101 #endif
0102 
0103 QT_END_NAMESPACE
0104 
0105 #endif // QMIMETYPE_H