diff options
Diffstat (limited to 'xbmc/addons/IAddon.h')
| -rw-r--r-- | xbmc/addons/IAddon.h | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/xbmc/addons/IAddon.h b/xbmc/addons/IAddon.h new file mode 100644 index 0000000..76f22fa --- /dev/null +++ b/xbmc/addons/IAddon.h | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2013 Team XBMC | ||
| 4 | * http://xbmc.org | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with XBMC; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | #include <memory> | ||
| 22 | |||
| 23 | #include <map> | ||
| 24 | #include <set> | ||
| 25 | #include <string> | ||
| 26 | #include <stdint.h> | ||
| 27 | |||
| 28 | class TiXmlElement; | ||
| 29 | |||
| 30 | namespace ADDON | ||
| 31 | { | ||
| 32 | typedef enum | ||
| 33 | { | ||
| 34 | ADDON_UNKNOWN, | ||
| 35 | ADDON_VIZ, | ||
| 36 | ADDON_SKIN, | ||
| 37 | ADDON_PVRDLL, | ||
| 38 | ADDON_SCRIPT, | ||
| 39 | ADDON_SCRIPT_WEATHER, | ||
| 40 | ADDON_SUBTITLE_MODULE, | ||
| 41 | ADDON_SCRIPT_LYRICS, | ||
| 42 | ADDON_SCRAPER_ALBUMS, | ||
| 43 | ADDON_SCRAPER_ARTISTS, | ||
| 44 | ADDON_SCRAPER_MOVIES, | ||
| 45 | ADDON_SCRAPER_MUSICVIDEOS, | ||
| 46 | ADDON_SCRAPER_TVSHOWS, | ||
| 47 | ADDON_SCREENSAVER, | ||
| 48 | ADDON_PLUGIN, | ||
| 49 | ADDON_REPOSITORY, | ||
| 50 | ADDON_WEB_INTERFACE, | ||
| 51 | ADDON_SERVICE, | ||
| 52 | ADDON_AUDIOENCODER, | ||
| 53 | ADDON_CONTEXT_ITEM, | ||
| 54 | ADDON_VIDEO, // virtual addon types | ||
| 55 | ADDON_AUDIO, | ||
| 56 | ADDON_IMAGE, | ||
| 57 | ADDON_EXECUTABLE, | ||
| 58 | ADDON_VIZ_LIBRARY, | ||
| 59 | ADDON_SCRAPER_LIBRARY, | ||
| 60 | ADDON_SCRIPT_LIBRARY, | ||
| 61 | ADDON_SCRIPT_MODULE, | ||
| 62 | ADDON_MAX | ||
| 63 | } TYPE; | ||
| 64 | |||
| 65 | class IAddon; | ||
| 66 | typedef std::shared_ptr<IAddon> AddonPtr; | ||
| 67 | class CVisualisation; | ||
| 68 | typedef std::shared_ptr<CVisualisation> VizPtr; | ||
| 69 | class CSkinInfo; | ||
| 70 | typedef std::shared_ptr<CSkinInfo> SkinPtr; | ||
| 71 | class CPluginSource; | ||
| 72 | typedef std::shared_ptr<CPluginSource> PluginPtr; | ||
| 73 | |||
| 74 | class CAddonMgr; | ||
| 75 | class AddonVersion; | ||
| 76 | typedef std::map<std::string, std::pair<const AddonVersion, bool> > ADDONDEPS; | ||
| 77 | typedef std::map<std::string, std::string> InfoMap; | ||
| 78 | class AddonProps; | ||
| 79 | |||
| 80 | class IAddon : public std::enable_shared_from_this<IAddon> | ||
| 81 | { | ||
| 82 | public: | ||
| 83 | virtual ~IAddon() {}; | ||
| 84 | virtual AddonPtr Clone() const =0; | ||
| 85 | virtual TYPE Type() const =0; | ||
| 86 | virtual bool IsType(TYPE type) const =0; | ||
| 87 | virtual AddonProps Props() const =0; | ||
| 88 | virtual AddonProps& Props() =0; | ||
| 89 | virtual const std::string ID() const =0; | ||
| 90 | virtual const std::string Name() const =0; | ||
| 91 | virtual bool Enabled() const =0; | ||
| 92 | virtual bool IsInUse() const =0; | ||
| 93 | virtual const AddonVersion Version() const =0; | ||
| 94 | virtual const AddonVersion MinVersion() const =0; | ||
| 95 | virtual const std::string Summary() const =0; | ||
| 96 | virtual const std::string Description() const =0; | ||
| 97 | virtual const std::string Path() const =0; | ||
| 98 | virtual const std::string Profile() const =0; | ||
| 99 | virtual const std::string LibPath() const =0; | ||
| 100 | virtual const std::string ChangeLog() const =0; | ||
| 101 | virtual const std::string FanArt() const =0; | ||
| 102 | virtual const std::string Author() const =0; | ||
| 103 | virtual const std::string Icon() const =0; | ||
| 104 | virtual int Stars() const =0; | ||
| 105 | virtual const std::string Disclaimer() const =0; | ||
| 106 | virtual const InfoMap &ExtraInfo() const =0; | ||
| 107 | virtual bool HasSettings() =0; | ||
| 108 | virtual void SaveSettings() =0; | ||
| 109 | virtual void UpdateSetting(const std::string& key, const std::string& value) =0; | ||
| 110 | virtual std::string GetSetting(const std::string& key) =0; | ||
| 111 | virtual TiXmlElement* GetSettingsXML() =0; | ||
| 112 | virtual std::string GetString(uint32_t id) =0; | ||
| 113 | virtual const ADDONDEPS &GetDeps() const =0; | ||
| 114 | virtual AddonVersion GetDependencyVersion(const std::string &dependencyID) const =0; | ||
| 115 | virtual bool MeetsVersion(const AddonVersion &version) const =0; | ||
| 116 | virtual bool ReloadSettings() =0; | ||
| 117 | virtual void OnDisabled() =0; | ||
| 118 | virtual void OnEnabled() =0; | ||
| 119 | virtual AddonPtr GetRunningInstance() const=0; | ||
| 120 | virtual bool OnPreInstall() =0; | ||
| 121 | virtual void OnPostInstall(bool restart, bool update, bool modal) =0; | ||
| 122 | virtual void OnPreUnInstall() =0; | ||
| 123 | virtual void OnPostUnInstall() =0; | ||
| 124 | virtual bool CanInstall(const std::string& referer) =0; | ||
| 125 | |||
| 126 | protected: | ||
| 127 | virtual bool LoadSettings(bool bForce = false) =0; | ||
| 128 | |||
| 129 | private: | ||
| 130 | friend class CAddonMgr; | ||
| 131 | virtual bool IsAddonLibrary() =0; | ||
| 132 | virtual void Enable() =0; | ||
| 133 | virtual void Disable() =0; | ||
| 134 | virtual bool LoadStrings() =0; | ||
| 135 | virtual void ClearStrings() =0; | ||
| 136 | }; | ||
| 137 | }; | ||
| 138 | |||
