MythTV  master
mythmimetype.h
Go to the documentation of this file.
1 #ifndef MYTHMIMETYPE_H
2 #define MYTHMIMETYPE_H
3 
4 // Qt
5 #include <QMimeType>
6 #include <QStringList>
7 
8 // Std
9 #include <variant>
10 #include <vector>
11 
12 class MythMimeType;
13 using MythMimeTypes = std::vector<MythMimeType>;
14 using MimeMagic = std::variant<std::monostate,QByteArray,QString>;
15 
17 {
18  friend class MythMimeDatabase;
19  friend class MythMimeDatabasePriv;
20 
21  public:
22  MythMimeType() = default;
23  bool operator==(const MythMimeType& Other) const;
24 
25  bool IsValid() const;
26  QString Name() const;
27  QString Suffix() const;
28  QStringList Aliases() const;
29  bool Inherits(const QString& Name) const;
30  void SetAlias(const QString& Name);
31 
32  protected:
33  MythMimeType(const QMimeType& MimeType);
34  MythMimeType(QString Name, QString Suffix,
35  MimeMagic Magic, uint Weight, QStringList Inherits);
36 
37  bool m_valid { false };
38  QString m_name;
39  QString m_alias;
40  QString m_suffix;
41  MimeMagic m_magic { std::monostate() };
42  uint m_weight { 0 };
43  QStringList m_inherits;
44  bool m_qtType { false };
45  QMimeType m_mime;
46 };
47 
48 #endif
MimeType
Definition: mythuiwebbrowser.cpp:44
MythMimeType::m_qtType
bool m_qtType
Definition: mythmimetype.h:44
MythMimeType::Aliases
QStringList Aliases() const
Definition: mythmimetype.cpp:58
MimeMagic
std::variant< std::monostate, QByteArray, QString > MimeMagic
Definition: mythmimetype.h:14
MythMimeDatabase
A wrapper around QMimeDatabase that supports additional mime types.
Definition: mythmimedatabase.h:10
MythMimeType::m_alias
QString m_alias
Definition: mythmimetype.h:39
MythMimeDatabasePriv
A private, internal class that holds custom mime types.
Definition: mythmimedatabase.cpp:20
MythMimeType::Suffix
QString Suffix() const
Return the preferred filename suffix used by this type.
Definition: mythmimetype.cpp:51
MythMimeType::operator==
bool operator==(const MythMimeType &Other) const
Definition: mythmimetype.cpp:21
MythMimeType::m_valid
bool m_valid
Definition: mythmimetype.h:37
MythMimeTypes
std::vector< MythMimeType > MythMimeTypes
Definition: mythmimetype.h:13
MythMimeType::m_inherits
QStringList m_inherits
Definition: mythmimetype.h:43
uint
unsigned int uint
Definition: compat.h:81
MythMimeType::m_mime
QMimeType m_mime
Definition: mythmimetype.h:45
MythMimeType::Inherits
bool Inherits(const QString &Name) const
Does this type inherit from the given type.
Definition: mythmimetype.cpp:69
MythMimeType::SetAlias
void SetAlias(const QString &Name)
Definition: mythmimetype.cpp:40
MythMimeType::m_suffix
QString m_suffix
Definition: mythmimetype.h:40
Name
Definition: channelsettings.cpp:71
MythMimeType::IsValid
bool IsValid() const
Definition: mythmimetype.cpp:26
MythMimeType
Definition: mythmimetype.h:16
MythMimeType::Name
QString Name() const
Definition: mythmimetype.cpp:31
MythMimeType::m_magic
MimeMagic m_magic
Definition: mythmimetype.h:41
MythMimeType::MythMimeType
MythMimeType()=default
MythMimeType::m_name
QString m_name
Definition: mythmimetype.h:38
MythMimeType::m_weight
uint m_weight
Definition: mythmimetype.h:42