diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/Mime.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/Mime.h')
| -rw-r--r-- | xbmc/utils/Mime.h | 46 |
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 | |||
| 14 | class CURL; | ||
| 15 | |||
| 16 | class CFileItem; | ||
| 17 | |||
| 18 | class CMime | ||
| 19 | { | ||
| 20 | public: | ||
| 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 | |||
| 42 | private: | ||
| 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 | }; | ||
