Merge pull request #26220 from 78andyp/blurayfixes
[xbmc.git] / xbmc / utils / FileExtensionProvider.h
blob586f155d3c9dfd9c9ee539a8238bf6488ad42bdd
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <map>
12 #include <memory>
13 #include <string>
14 #include <vector>
16 namespace ADDON
18 enum class AddonType;
19 class CAddonMgr;
20 struct AddonEvent;
23 class CAdvancedSettings;
25 class CFileExtensionProvider
27 public:
28 CFileExtensionProvider(ADDON::CAddonMgr& addonManager);
29 ~CFileExtensionProvider();
31 /*!
32 * @brief Returns a list of picture extensions
34 std::string GetPictureExtensions() const;
36 /*!
37 * @brief Returns a list of music extensions
39 std::string GetMusicExtensions() const;
41 /*!
42 * @brief Returns a list of video extensions
44 std::string GetVideoExtensions() const;
46 /*!
47 * @brief Returns a list of subtitle extensions
49 std::string GetSubtitleExtensions() const;
51 /*!
52 * @brief Returns a list of disc stub extensions
54 std::string GetDiscStubExtensions() const;
56 /*!
57 * @brief Returns a file folder extensions
59 std::string GetFileFolderExtensions() const;
61 /*!
62 * @brief Returns whether a url protocol from add-ons use encoded hostnames
64 bool EncodedHostName(const std::string& protocol) const;
66 /*!
67 * @brief Returns true if related provider can operate related file
69 * @note Thought for cases e.g. by ISO, where can be a video or also a SACD.
71 bool CanOperateExtension(const std::string& path) const;
73 private:
74 std::string GetAddonExtensions(ADDON::AddonType type) const;
75 std::string GetAddonFileFolderExtensions(ADDON::AddonType type) const;
76 void SetAddonExtensions();
77 void SetAddonExtensions(ADDON::AddonType type);
79 void OnAddonEvent(const ADDON::AddonEvent& event);
81 // Construction properties
82 std::shared_ptr<CAdvancedSettings> m_advancedSettings;
83 ADDON::CAddonMgr &m_addonManager;
85 // File extension properties
86 std::map<ADDON::AddonType, std::string> m_addonExtensions;
87 std::map<ADDON::AddonType, std::string> m_addonFileFolderExtensions;
89 // Protocols from add-ons with encoded host names
90 std::vector<std::string> m_encoded;