1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QMIMETYPE_P_H
5#define QMIMETYPE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19#include "qmimetype.h"
20
21QT_REQUIRE_CONFIG(mimetype);
22
23#include <QtCore/qhash.h>
24#include <QtCore/qstringlist.h>
25
26QT_BEGIN_NAMESPACE
27
28class Q_AUTOTEST_EXPORT QMimeTypePrivate : public QSharedData
29{
30public:
31 typedef QHash<QString, QString> LocaleHash;
32
33 QMimeTypePrivate();
34 explicit QMimeTypePrivate(const QMimeType &other);
35
36 void clear();
37
38 void addGlobPattern(const QString &pattern);
39
40 bool loaded; // QSharedData leaves a 4 byte gap, so don't put 8 byte members first
41 bool fromCache; // true if this comes from the binary provider
42 bool hasGlobDeleteAll = false; // true if the mimetype has a glob-deleteall tag
43 QString name;
44 LocaleHash localeComments;
45 QString genericIconName;
46 QString iconName;
47 QStringList globPatterns;
48};
49
50QT_END_NAMESPACE
51
52#define QMIMETYPE_BUILDER_FROM_RVALUE_REFS \
53 QT_BEGIN_NAMESPACE \
54 static QMimeType buildQMimeType ( \
55 QString &&name, \
56 QString &&genericIconName, \
57 QString &&iconName, \
58 QStringList &&globPatterns \
59 ) \
60 { \
61 QMimeTypePrivate qMimeTypeData; \
62 qMimeTypeData.loaded = true; \
63 qMimeTypeData.name = std::move(name); \
64 qMimeTypeData.genericIconName = std::move(genericIconName); \
65 qMimeTypeData.iconName = std::move(iconName); \
66 qMimeTypeData.globPatterns = std::move(globPatterns); \
67 return QMimeType(qMimeTypeData); \
68 } \
69 QT_END_NAMESPACE
70
71#endif // QMIMETYPE_P_H
72

source code of qtbase/src/corelib/mimetypes/qmimetype_p.h