[pydocs] addon id is optional for the Addon() class as it's retrieved automaticly...
[vuplus_xbmc] / xbmc / interfaces / legacy / Addon.h
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #pragma once
22
23 #include "swighelper.h"
24 #include "addons/IAddon.h"
25
26 #include "AddonString.h"
27 #include "AddonClass.h"
28 #include "Exception.h"
29
30 namespace XBMCAddon
31 {
32   namespace xbmcaddon
33   {
34     XBMCCOMMONS_STANDARD_EXCEPTION(AddonException);
35
36     /**
37      * Addon class.
38      * 
39      * Addon([id]) -- Creates a new Addon class.
40      * 
41      * id          : [opt] string - id of the addon as specified in addon.xml
42      * 
43      * *Note, specifying the addon id is not needed.\n
44      *  Important however is that the addon folder has the same name as the addon id provided in addon.xml.\n
45      *  You can optionally specify the addon id from another installed addon to retrieve settings from it.
46      * 
47      * example:
48      *  - self.Addon = xbmcaddon.Addon()
49      *  - self.Addon = xbmcaddon.Addon('script.foo.bar')
50      */
51     class Addon : public AddonClass
52     {
53       ADDON::AddonPtr pAddon;
54
55       String getDefaultId();
56
57       String getAddonVersion();
58
59     public:
60       /**
61        * Addon class.
62        * 
63        * Addon([id]) -- Creates a new Addon class.
64        * 
65        * id          : [opt] string - id of the addon as specified in addon.xml\n
66        * 
67        * *Note, specifying the addon id is not needed.\n
68        *  Important however is that the addon folder has the same name as the addon id provided in addon.xml.\n
69        *  You can optionally specify the addon id from another installed addon to retrieve settings from it.
70        * 
71        * example:
72        *  - self.Addon = xbmcaddon.Addon()
73        *  - self.Addon = xbmcaddon.Addon('script.foo.bar')
74        */
75       Addon(const char* id = NULL) throw (AddonException);
76
77       virtual ~Addon();
78
79       /**
80        * getLocalizedString(id) -- Returns an addon's localized 'unicode string'.
81        * 
82        * id        : integer - id# for string you want to localize.
83        * 
84        * example:
85        *   - locstr = self.Addon.getLocalizedString(32000)
86        */
87       String getLocalizedString(int id);
88
89       /**
90        * getSetting(id) -- Returns the value of a setting as a unicode string.
91        * 
92        * id        : string - id of the setting that the module needs to access.
93        * 
94        * example:
95        *   - apikey = self.Addon.getSetting('apikey')
96        */
97       String getSetting(const char* id);
98
99       /**
100        * setSetting(id, value) -- Sets a script setting.
101        * 
102        * id        : string - id of the setting that the module needs to access.
103        * value     : string or unicode - value of the setting.
104        * 
105        * *Note, You can use the above as keywords for arguments.
106        * 
107        * example:
108        *   - self.Settings.setSetting(id='username', value='teamxbmc')\n
109        */
110       void setSetting(const char* id, const String& value);
111
112       /**
113        * openSettings() -- Opens this scripts settings dialog.
114        * 
115        * example:
116        *   - self.Settings.openSettings()
117        */
118       void openSettings();
119
120       /**
121        * getAddonInfo(id) -- Returns the value of an addon property as a string.
122        * 
123        * id        : string - id of the property that the module needs to access.
124        * 
125        * *Note, choices are (author, changelog, description, disclaimer, fanart. icon, id, name, path
126        *                     profile, stars, summary, type, version)
127        * 
128        * example:
129        *   - version = self.Addon.getAddonInfo('version')
130        */
131       String getAddonInfo(const char* id) throw (AddonException);
132
133     };
134   }
135 }