blob: 586f155d3c9dfd9c9ee539a8238bf6488ad42bdd (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* Copyright (C) 2012-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
namespace ADDON
{
enum class AddonType;
class CAddonMgr;
struct AddonEvent;
}
class CAdvancedSettings;
class CFileExtensionProvider
{
public:
CFileExtensionProvider(ADDON::CAddonMgr& addonManager);
~CFileExtensionProvider();
/*!
* @brief Returns a list of picture extensions
*/
std::string GetPictureExtensions() const;
/*!
* @brief Returns a list of music extensions
*/
std::string GetMusicExtensions() const;
/*!
* @brief Returns a list of video extensions
*/
std::string GetVideoExtensions() const;
/*!
* @brief Returns a list of subtitle extensions
*/
std::string GetSubtitleExtensions() const;
/*!
* @brief Returns a list of disc stub extensions
*/
std::string GetDiscStubExtensions() const;
/*!
* @brief Returns a file folder extensions
*/
std::string GetFileFolderExtensions() const;
/*!
* @brief Returns whether a url protocol from add-ons use encoded hostnames
*/
bool EncodedHostName(const std::string& protocol) const;
/*!
* @brief Returns true if related provider can operate related file
*
* @note Thought for cases e.g. by ISO, where can be a video or also a SACD.
*/
bool CanOperateExtension(const std::string& path) const;
private:
std::string GetAddonExtensions(ADDON::AddonType type) const;
std::string GetAddonFileFolderExtensions(ADDON::AddonType type) const;
void SetAddonExtensions();
void SetAddonExtensions(ADDON::AddonType type);
void OnAddonEvent(const ADDON::AddonEvent& event);
// Construction properties
std::shared_ptr<CAdvancedSettings> m_advancedSettings;
ADDON::CAddonMgr &m_addonManager;
// File extension properties
std::map<ADDON::AddonType, std::string> m_addonExtensions;
std::map<ADDON::AddonType, std::string> m_addonFileFolderExtensions;
// Protocols from add-ons with encoded host names
std::vector<std::string> m_encoded;
};
|