Fix keymap.
[vuplus_xbmc] / xbmc / addons / IAddon.h
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 "boost/shared_ptr.hpp"
22 #include "utils/StdString.h"
23
24 #include <boost/enable_shared_from_this.hpp>
25
26 #include <set>
27 #include <map>
28
29 class TiXmlElement;
30
31 namespace ADDON
32 {
33   typedef enum
34   {
35     ADDON_UNKNOWN,
36     ADDON_VIZ,
37     ADDON_SKIN,
38     ADDON_PVRDLL,
39     ADDON_SCRIPT,
40     ADDON_SCRIPT_WEATHER,
41     ADDON_SUBTITLE_MODULE,
42     ADDON_SCRIPT_LYRICS,
43     ADDON_SCRAPER_ALBUMS,
44     ADDON_SCRAPER_ARTISTS,
45     ADDON_SCRAPER_MOVIES,
46     ADDON_SCRAPER_MUSICVIDEOS,
47     ADDON_SCRAPER_TVSHOWS,
48     ADDON_SCREENSAVER,
49     ADDON_PLUGIN,
50     ADDON_REPOSITORY,
51     ADDON_WEB_INTERFACE,
52     ADDON_SERVICE,
53     ADDON_VIDEO, // virtual addon types
54     ADDON_AUDIO,
55     ADDON_IMAGE,
56     ADDON_EXECUTABLE,
57     ADDON_VIZ_LIBRARY, // add noninstallable after this and installable before
58     ADDON_SCRAPER_LIBRARY,
59     ADDON_SCRIPT_LIBRARY,
60     ADDON_SCRIPT_MODULE
61   } TYPE;
62
63   class IAddon;
64   typedef boost::shared_ptr<IAddon> AddonPtr;
65   class CVisualisation;
66   typedef boost::shared_ptr<CVisualisation> VizPtr;
67   class CSkinInfo;
68   typedef boost::shared_ptr<CSkinInfo> SkinPtr;
69   class CPluginSource;
70   typedef boost::shared_ptr<CPluginSource> PluginPtr;
71
72   class CAddonMgr;
73   class AddonVersion;
74   typedef std::map<CStdString, std::pair<const AddonVersion, bool> > ADDONDEPS;
75   typedef std::map<CStdString, CStdString> InfoMap;
76   class AddonProps;
77
78   class IAddon : public boost::enable_shared_from_this<IAddon>
79   {
80   public:
81     virtual ~IAddon() {};
82     virtual AddonPtr Clone() const =0;
83     virtual TYPE Type() const =0;
84     virtual bool IsType(TYPE type) const =0;
85     virtual AddonProps Props() const =0;
86     virtual AddonProps& Props() =0;
87     virtual const CStdString ID() const =0;
88     virtual const CStdString Name() const =0;
89     virtual bool Enabled() const =0;
90     virtual bool IsInUse() const =0;
91     virtual const AddonVersion Version() const =0;
92     virtual const AddonVersion MinVersion() const =0;
93     virtual const CStdString Summary() const =0;
94     virtual const CStdString Description() const =0;
95     virtual const CStdString Path() const =0;
96     virtual const CStdString Profile() const =0;
97     virtual const CStdString LibPath() const =0;
98     virtual const CStdString ChangeLog() const =0;
99     virtual const CStdString FanArt() const =0;
100     virtual const CStdString Author() const =0;
101     virtual const CStdString Icon() const =0;
102     virtual int  Stars() const =0;
103     virtual const CStdString Disclaimer() const =0;
104     virtual const InfoMap &ExtraInfo() const =0;
105     virtual bool HasSettings() =0;
106     virtual void SaveSettings() =0;
107     virtual void UpdateSetting(const CStdString& key, const CStdString& value) =0;
108     virtual CStdString GetSetting(const CStdString& key) =0;
109     virtual TiXmlElement* GetSettingsXML() =0;
110     virtual CStdString GetString(uint32_t id) =0;
111     virtual const ADDONDEPS &GetDeps() const =0;
112     virtual bool MeetsVersion(const AddonVersion &version) const =0;
113     virtual bool ReloadSettings() =0;
114
115   protected:
116     virtual bool LoadSettings(bool bForce = false) =0;
117
118   private:
119     friend class CAddonMgr;
120     virtual bool IsAddonLibrary() =0;
121     virtual void Enable() =0;
122     virtual void Disable() =0;
123     virtual bool LoadStrings() =0;
124     virtual void ClearStrings() =0;
125   };
126
127   // some utilitiy methods
128
129   /**
130    * This function will extract the Addon's currently assigned xbmc.python
131    * API version. If addon is NULL, or there is no xbmc.python dependency defined,
132    * then the version is assumed to be "1.0"
133    */
134   CStdString GetXbmcApiVersionDependency(ADDON::AddonPtr addon);
135
136 };
137