| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KFILEMETADATA_TYPEINFO_H |
| 8 | #define KFILEMETADATA_TYPEINFO_H |
| 9 | |
| 10 | #include "types.h" |
| 11 | #include "kfilemetadata_export.h" |
| 12 | #include <QString> |
| 13 | #include <QVariant> |
| 14 | |
| 15 | namespace KFileMetaData { |
| 16 | |
| 17 | class TypeInfoPrivate; |
| 18 | /*! |
| 19 | * \class KFileMetaData::TypeInfo |
| 20 | * \inheaderfile KFileMetaData/TypeInfo |
| 21 | * \inmodule KFileMetaData |
| 22 | * |
| 23 | * \brief The TypeInfo class can be used to obtain a rough type |
| 24 | * classification for a file. |
| 25 | * |
| 26 | * It is somewhat related to the MIME "<type>/<subtype>" |
| 27 | * classification, but provides additional types, e.g. |
| 28 | * MIME does not provide a generic "Archive" type. |
| 29 | */ |
| 30 | class KFILEMETADATA_EXPORT TypeInfo |
| 31 | { |
| 32 | public: |
| 33 | /*! |
| 34 | * |
| 35 | */ |
| 36 | TypeInfo(); |
| 37 | |
| 38 | /*! |
| 39 | * |
| 40 | */ |
| 41 | TypeInfo(Type::Type type); |
| 42 | TypeInfo(const TypeInfo& ti); |
| 43 | ~TypeInfo(); |
| 44 | |
| 45 | TypeInfo& operator=(const TypeInfo& rhs); |
| 46 | |
| 47 | /*! |
| 48 | * \since 5.91 |
| 49 | */ |
| 50 | bool operator==(const TypeInfo& rhs) const; |
| 51 | |
| 52 | /*! |
| 53 | * The type identifier |
| 54 | */ |
| 55 | Type::Type type() const; |
| 56 | |
| 57 | /*! |
| 58 | * An internal unique name for the type |
| 59 | */ |
| 60 | QString name() const; |
| 61 | |
| 62 | /*! |
| 63 | * A user visible translated name for this type |
| 64 | */ |
| 65 | QString displayName() const; |
| 66 | |
| 67 | /*! |
| 68 | * Construct a TypeInfo from the internal type name. |
| 69 | * The internal type name is case insensitive |
| 70 | */ |
| 71 | static TypeInfo fromName(const QString& name); |
| 72 | |
| 73 | /*! |
| 74 | * Get all supported property names |
| 75 | */ |
| 76 | static QStringList allNames(); |
| 77 | |
| 78 | private: |
| 79 | const TypeInfoPrivate* d; |
| 80 | }; |
| 81 | |
| 82 | } // namespace |
| 83 | Q_DECLARE_METATYPE(KFileMetaData::TypeInfo) |
| 84 | |
| 85 | #endif // KFILEMETADATA_TYPEINFO_H |
| 86 | |