aboutsummaryrefslogtreecommitdiff
path: root/src/mimeparser.hpp
blob: d76594b285284e784de253eb4e249a688bcf365c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef MIMEPARSER_HPP
#define MIMEPARSER_HPP

#include <QMap>
#include <QString>

struct MimeType
{
    QString type;
    QString subtype;
    QMap<QString, QString> parameters;

    bool is(QString const & type, QString const & sub_type) const;

    QString parameter(QString const & param_name, QString const & default_value = QString { }) const;

    bool isValid() const {
        return not type.isEmpty();
    }
};

struct MimeParser
{
    MimeParser() = delete;



    static MimeType parse(QString const & mime_text);
};

#endif // MIMEPARSER_HPP