1 | /* |
2 | This file is part of KFileMetaData |
3 | SPDX-FileCopyrightText: 2019 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.1-or-later |
6 | */ |
7 | |
8 | #ifndef KFILEMETADATA_MIMEUTILS |
9 | #define KFILEMETADATA_MIMEUTILS |
10 | |
11 | #include <QMimeDatabase> |
12 | #include "kfilemetadata_export.h" |
13 | |
14 | namespace KFileMetaData |
15 | { |
16 | |
17 | /*! |
18 | * \namespace KFileMetaData::MimeUtils |
19 | * \inmodule KFileMetaData |
20 | * |
21 | * \brief The MimeUtils namespace. |
22 | */ |
23 | namespace MimeUtils |
24 | { |
25 | |
26 | /*! |
27 | * Returns the MIME type for a file |
28 | * |
29 | * The function uses both content and filename to determine the |
30 | * QMimeType. In case the extension MIME type is more specific |
31 | * than the content MIME type, and the first inherits the latter, |
32 | * the extension MIME type is preferred. |
33 | * If the extension does not match the content, the content has |
34 | * higher priority. |
35 | * The file must exist and be readable. |
36 | * |
37 | * \since 5.57 |
38 | * |
39 | * \sa QMimeDatabase::mimeTypesForFileName |
40 | * \sa QMimeType::inherits |
41 | */ |
42 | KFILEMETADATA_EXPORT |
43 | QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db); |
44 | |
45 | |
46 | } // namespace MimeUtils |
47 | } // namespace KFileMetaData |
48 | |
49 | #endif // KFILEMETADATA_MIMEUTILS |
50 | |