summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/Mime.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/utils/Mime.h')
-rw-r--r--xbmc/utils/Mime.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/xbmc/utils/Mime.h b/xbmc/utils/Mime.h
new file mode 100644
index 0000000..d3554b9
--- /dev/null
+++ b/xbmc/utils/Mime.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include <map>
12#include <string>
13
14class CURL;
15
16class CFileItem;
17
18class CMime
19{
20public:
21 static std::string GetMimeType(const std::string &extension);
22 static std::string GetMimeType(const CFileItem &item);
23 static std::string GetMimeType(const CURL &url, bool lookup = true);
24
25 enum EFileType
26 {
27 FileTypeUnknown = 0,
28 FileTypeHtml,
29 FileTypeXml,
30 FileTypePlainText,
31 FileTypeZip,
32 FileTypeGZip,
33 FileTypeRar,
34 FileTypeBmp,
35 FileTypeGif,
36 FileTypePng,
37 FileTypeJpeg,
38 };
39 static EFileType GetFileTypeFromMime(const std::string& mimeType);
40 static EFileType GetFileTypeFromContent(const std::string& fileContent);
41
42private:
43 static bool parseMimeType(const std::string& mimeType, std::string& type, std::string& subtype);
44
45 static const std::map<std::string, std::string> m_mimetypes;
46};