MythTV
master
mythtv
libs
libmythbase
http
mythmimetype.cpp
Go to the documentation of this file.
1
// MythTV
2
#include "
http/mythmimetype.h
"
3
4
MythMimeType::MythMimeType
(
const
QMimeType&
MimeType
)
5
: m_valid(
MimeType
.isValid()),
6
m_qtType(
true
),
7
m_mime(
MimeType
)
8
{
9
}
10
MythMimeType::MythMimeType
(QString
Name
, QString Suffix,
11
MimeMagic
Magic,
uint
Weight, QStringList Inherits)
12
: m_valid(!
Name
.isEmpty()),
13
m_name(std::move(
Name
)),
14
m_suffix(std::move(Suffix)),
15
m_magic(std::move(Magic)),
16
m_weight(Weight),
17
m_inherits(std::move(Inherits))
18
{
19
}
20
21
bool
MythMimeType::operator==
(
const
MythMimeType
& Other)
const
22
{
23
return
this->
m_name
== Other.
Name
();
24
}
25
26
bool
MythMimeType::IsValid
()
const
27
{
28
return
m_valid
;
29
}
30
31
QString
MythMimeType::Name
()
const
32
{
33
if
(!
m_alias
.isEmpty())
34
return
m_alias
;
35
if
(
m_qtType
)
36
return
m_mime
.name();
37
return
m_name
;
38
}
39
40
void
MythMimeType::SetAlias
(
const
QString &
Name
)
41
{
42
m_alias
=
Name
;
43
}
44
51
QString
MythMimeType::Suffix
()
const
52
{
53
if
(
m_qtType
)
54
return
m_mime
.preferredSuffix();
55
return
m_suffix
.mid(1);
56
}
57
58
QStringList
MythMimeType::Aliases
()
const
59
{
60
if
(
m_qtType
)
61
return
{
m_mime
.aliases() <<
m_mime
.name() };
62
return
{
m_name
};
63
}
64
69
bool
MythMimeType::Inherits
(
const
QString &
Name
)
const
70
{
71
if
(
m_qtType
)
72
return
m_mime
.inherits(
Name
);
73
return
m_inherits
.contains(
Name
);
74
}
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
mythmimetype.h
true
VERBOSE_PREAMBLE Most true
Definition:
verbosedefs.h:95
MythMimeType::m_alias
QString m_alias
Definition:
mythmimetype.h:39
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
MythMimeType::m_inherits
QStringList m_inherits
Definition:
mythmimetype.h:43
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::MythMimeType
MythMimeType()=default
MythMimeType::m_name
QString m_name
Definition:
mythmimetype.h:38
uint
unsigned int uint
Definition:
freesurround.h:24
Generated on Tue Jan 7 2025 03:18:24 for MythTV by
1.8.17