-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgroup__cpp__kodi__addon__addonbase.html
464 lines (445 loc) · 31.1 KB
/
group__cpp__kodi__addon__addonbase.html
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Kodi Development: class CAddonBase</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="kodi-dev.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Kodi Development
 <span id="projectnumber">20.0</span>
</div>
<div id="projectbrief">for Binary and Script based Add-Ons</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__cpp__kodi__addon__addonbase.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#groups">Modules</a> </div>
<div class="headertitle">
<div class="title">class CAddonBase<div class="ingroups"><a class="el" href="group__cpp.html">C++</a> » <a class="el" href="group__cpp__kodi__addon.html">Interface - kodi::addon</a></div></div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p><b>Add-on main instance class</b><br />
This is the addon main class, similar to an <b><code>int main()</code></b> in executable and carries out initial work and later management of it. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Modules</h2></td></tr>
<tr class="memitem:group__cpp__kodi__addon__addonbase___defs"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__cpp__kodi__addon__addonbase___defs.html">Definitions, structures and enumerators</a></td></tr>
<tr class="memdesc:group__cpp__kodi__addon__addonbase___defs"><td class="mdescLeft"> </td><td class="mdescRight"><b>General definition values</b> <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="gac0e0188d41e22618ecef6bd69ece39cb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac0e0188d41e22618ecef6bd69ece39cb">◆ </a></span>CAddonBase()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classkodi_1_1addon_1_1_c_addon_base.html">CAddonBase</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Addon base class constructor. </p>
</div>
</div>
<a id="gabd0cd0f2367440fcc93266949ffd9da5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabd0cd0f2367440fcc93266949ffd9da5">◆ </a></span>~CAddonBase()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual ~<a class="el" href="classkodi_1_1addon_1_1_c_addon_base.html">CAddonBase</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">default</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
</div>
</div>
<a id="gabf149cc30b4d67b82e939b64ab923d89"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabf149cc30b4d67b82e939b64ab923d89">◆ </a></span>Create()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a> Create </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Main addon creation function. </p>
<p>With this function addon can carry out necessary work which is required at later points or start necessary processes.</p>
<p>This function is optional and necessary work can also be carried out using <a class="el" href="group__cpp__kodi__addon__addonbase.html#ga74ea538a2191541a57115fa89790358c">CreateInstance</a> (if it concerns any instance types).</p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502a6925909b93ca05098ca5272f16e091c0">ADDON_STATUS_OK</a> if correct, for possible errors see <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>Terminating the add-on must be carried out using the class destructor given by child. </dd></dl>
</div>
</div>
<a id="ga1729a597265408b52198edba006e00fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1729a597265408b52198edba006e00fd">◆ </a></span>SetSetting()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a> SetSetting </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>settingName</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classkodi_1_1_c_setting_value.html">kodi::CSettingValue</a> & </td>
<td class="paramname"><em>settingValue</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>To inform addon about changed settings values. </p>
<p>This becomes called for every entry defined inside his settings.xml and as <b>last</b> call the one where last in xml (to identify end of calls).</p>
<hr />
<p><b>The following table contains values that can be set with <a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html">class CSettingValue</a> :</b> </p><table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Get call </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><b>Settings value as string</b> </td><td class="markdownTableBodyNone"><code>std::string</code> </td><td class="markdownTableBodyNone"><a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga764f99b38cb3cd18ab87c5261321e063">GetString</a> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><b>Settings value as integer</b> </td><td class="markdownTableBodyNone"><code>int</code> </td><td class="markdownTableBodyNone"><a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga3f9636de28d683833247125cd9427046">GetInt</a> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><b>Settings value as unsigned integer</b> </td><td class="markdownTableBodyNone"><code>unsigned int</code> </td><td class="markdownTableBodyNone"><a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga3aa86241f9d3a2905616b393a858b354">GetUInt</a> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><b>Settings value as boolean</b> </td><td class="markdownTableBodyNone"><code>bool</code> </td><td class="markdownTableBodyNone"><a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga41c297793cf20f9c7812dc56a68f7ce4">GetBoolean</a> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><b>Settings value as floating point</b> </td><td class="markdownTableBodyNone"><code>float</code> </td><td class="markdownTableBodyNone"><a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#gaa61c6d39394461db44dfd5d01df49a73">GetFloat</a> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><b>Settings value as enum</b> </td><td class="markdownTableBodyNone"><code>enum</code> </td><td class="markdownTableBodyNone"><a class="el" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#gadd5b4ff49052225ffea10c04c870b5b9">GetEnum</a> </td></tr>
</table>
<hr />
<p><b>Here is a code example how this is used:</b></p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <kodi/AddonBase.h></span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">enum</span> myEnumValue</div>
<div class="line">{</div>
<div class="line"> valueA,</div>
<div class="line"> valueB,</div>
<div class="line"> valueC</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line">std::string m_myStringValue;</div>
<div class="line"><span class="keywordtype">int</span> m_myIntegerValue;</div>
<div class="line"><span class="keywordtype">bool</span> m_myBooleanValue;</div>
<div class="line"><span class="keywordtype">float</span> m_myFloatingPointValue;</div>
<div class="line">myEnumValue m_myEnumValue;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a> CMyAddon::SetSetting(<span class="keyword">const</span> std::string& settingName, <span class="keyword">const</span> <a class="code" href="classkodi_1_1_c_setting_value.html">kodi::CSettingValue</a>& settingValue)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordflow">if</span> (settingName == <span class="stringliteral">"my_string_value"</span>)</div>
<div class="line"> m_myStringValue = settingValue.<a class="code" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga764f99b38cb3cd18ab87c5261321e063">GetString</a>();</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (settingName == <span class="stringliteral">"my_integer_value"</span>)</div>
<div class="line"> m_myIntegerValue = settingValue.<a class="code" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga3f9636de28d683833247125cd9427046">GetInt</a>();</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (settingName == <span class="stringliteral">"my_boolean_value"</span>)</div>
<div class="line"> m_myBooleanValue = settingValue.<a class="code" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga41c297793cf20f9c7812dc56a68f7ce4">GetBoolean</a>();</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (settingName == <span class="stringliteral">"my_float_value"</span>)</div>
<div class="line"> m_myFloatingPointValue = settingValue.<a class="code" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#gaa61c6d39394461db44dfd5d01df49a73">GetFloat</a>();</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (settingName == <span class="stringliteral">"my_enum_value"</span>)</div>
<div class="line"> m_myEnumValue = settingValue.<a class="code" href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#gadd5b4ff49052225ffea10c04c870b5b9">GetEnum</a><myEnumValue>();</div>
<div class="line">}</div>
<div class="ttc" id="aclasskodi_1_1_c_setting_value_html"><div class="ttname"><a href="classkodi_1_1_c_setting_value.html">kodi::CSettingValue</a></div><div class="ttdef"><b>Definition:</b> AddonBase.h:119</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s_html_ga335347495ed00620451a69cfe3494502"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a></div><div class="ttdeci">ADDON_STATUS</div><div class="ttdef"><b>Definition:</b> addon_base.h:128</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___c_setting_value_html_ga3f9636de28d683833247125cd9427046"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga3f9636de28d683833247125cd9427046">kodi::CSettingValue::GetInt</a></div><div class="ttdeci">int GetInt() const</div><div class="ttdoc">To get settings value as integer.</div><div class="ttdef"><b>Definition:</b> AddonBase.h:145</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___c_setting_value_html_ga41c297793cf20f9c7812dc56a68f7ce4"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga41c297793cf20f9c7812dc56a68f7ce4">kodi::CSettingValue::GetBoolean</a></div><div class="ttdeci">bool GetBoolean() const</div><div class="ttdoc">To get settings value as boolean.</div><div class="ttdef"><b>Definition:</b> AddonBase.h:151</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___c_setting_value_html_ga764f99b38cb3cd18ab87c5261321e063"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#ga764f99b38cb3cd18ab87c5261321e063">kodi::CSettingValue::GetString</a></div><div class="ttdeci">std::string GetString() const</div><div class="ttdoc">To get settings value as string.</div><div class="ttdef"><b>Definition:</b> AddonBase.h:142</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___c_setting_value_html_gaa61c6d39394461db44dfd5d01df49a73"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#gaa61c6d39394461db44dfd5d01df49a73">kodi::CSettingValue::GetFloat</a></div><div class="ttdeci">float GetFloat() const</div><div class="ttdoc">To get settings value as floating point.</div><div class="ttdef"><b>Definition:</b> AddonBase.h:154</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___c_setting_value_html_gadd5b4ff49052225ffea10c04c870b5b9"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___c_setting_value.html#gadd5b4ff49052225ffea10c04c870b5b9">kodi::CSettingValue::GetEnum</a></div><div class="ttdeci">enumType GetEnum() const</div><div class="ttdoc">To get settings value as enum.</div><div class="ttdef"><b>Definition:</b> AddonBase.h:159</div></div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>The asked type should match the type used on settings.xml. </dd></dl>
</div>
</div>
<a id="ga74ea538a2191541a57115fa89790358c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga74ea538a2191541a57115fa89790358c">◆ </a></span>CreateInstance()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a> CreateInstance </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>instanceType</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>instanceID</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">KODI_HANDLE </td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>version</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">KODI_HANDLE & </td>
<td class="paramname"><em>addonInstance</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Instance created. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instanceType</td><td>The requested type of required instance, see <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e.html#gada0b4c3c9f9c168e5e1c27145ec72357">ADDON_TYPE</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">instanceID</td><td>An individual identification key string given by Kodi. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance handler used by Kodi must be passed to the classes created here. See in the example. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">version</td><td>The from Kodi used version of instance. This can be used to allow compatibility to older versions of them. Further is this given to the parent instance that it can handle differences. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">addonInstance</td><td>The pointer to instance class created in addon. Needed to be able to identify them on calls. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502a6925909b93ca05098ca5272f16e091c0">ADDON_STATUS_OK</a> if correct, for possible errors see <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#ga335347495ed00620451a69cfe3494502">ADDON_STATUS</a></dd></dl>
<hr />
<p><b>Here is a code example how this is used:</b></p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <kodi/AddonBase.h></span></div>
<div class="line"> </div>
<div class="line">...</div>
<div class="line"> </div>
<div class="line"><span class="comment">// If you use only one instance in your add-on, can be instanceType and</span></div>
<div class="line"><span class="comment">// instanceID ignored</span></div>
<div class="line">ADDON_STATUS CMyAddon::CreateInstance(<span class="keywordtype">int</span> instanceType,</div>
<div class="line"> <span class="keyword">const</span> std::string& instanceID,</div>
<div class="line"> KODI_HANDLE instance,</div>
<div class="line"> <span class="keyword">const</span> std::string& version,</div>
<div class="line"> KODI_HANDLE& addonInstance)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordflow">if</span> (instanceType == <a class="code" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e.html#ggada0b4c3c9f9c168e5e1c27145ec72357a84fe3fcf6a482a0188eeea3e3b31f499">ADDON_INSTANCE_SCREENSAVER</a>)</div>
<div class="line"> {</div>
<div class="line"> <a class="code" href="group__cpp__kodi.html#gaaa1f205f9375cd086229a1455ede11cc">kodi::Log</a>(<a class="code" href="group__cpp__kodi___defs___addon_log.html#gga913895aaf2ef685961947f8d6b93e038a63f8ea3699765964c764b141bf41e9cc">ADDON_LOG_INFO</a>, <span class="stringliteral">"Creating my Screensaver"</span>);</div>
<div class="line"> addonInstance = <span class="keyword">new</span> CMyScreensaver(instance);</div>
<div class="line"> <span class="keywordflow">return</span> <a class="code" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502a6925909b93ca05098ca5272f16e091c0">ADDON_STATUS_OK</a>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (instanceType == <a class="code" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e.html#ggada0b4c3c9f9c168e5e1c27145ec72357a83120cb2f02fe5a4759f5bf0209bdfb5">ADDON_INSTANCE_VISUALIZATION</a>)</div>
<div class="line"> {</div>
<div class="line"> <a class="code" href="group__cpp__kodi.html#gaaa1f205f9375cd086229a1455ede11cc">kodi::Log</a>(<a class="code" href="group__cpp__kodi___defs___addon_log.html#gga913895aaf2ef685961947f8d6b93e038a63f8ea3699765964c764b141bf41e9cc">ADDON_LOG_INFO</a>, <span class="stringliteral">"Creating my Visualization"</span>);</div>
<div class="line"> addonInstance = <span class="keyword">new</span> CMyVisualization(instance);</div>
<div class="line"> <span class="keywordflow">return</span> <a class="code" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502a6925909b93ca05098ca5272f16e091c0">ADDON_STATUS_OK</a>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (...)</div>
<div class="line"> {</div>
<div class="line"> ...</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">return</span> <a class="code" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502ac0720dbdce3dcb194f12a0eceb59a501">ADDON_STATUS_UNKNOWN</a>;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">...</div>
<div class="ttc" id="agroup__cpp__kodi___defs___addon_log_html_gga913895aaf2ef685961947f8d6b93e038a63f8ea3699765964c764b141bf41e9cc"><div class="ttname"><a href="group__cpp__kodi___defs___addon_log.html#gga913895aaf2ef685961947f8d6b93e038a63f8ea3699765964c764b141bf41e9cc">ADDON_LOG_INFO</a></div><div class="ttdeci">@ ADDON_LOG_INFO</div><div class="ttdoc">1 : To include information messages in the log file.</div><div class="ttdef"><b>Definition:</b> addon_base.h:177</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s_html_gga335347495ed00620451a69cfe3494502a6925909b93ca05098ca5272f16e091c0"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502a6925909b93ca05098ca5272f16e091c0">ADDON_STATUS_OK</a></div><div class="ttdeci">@ ADDON_STATUS_OK</div><div class="ttdoc">For everything OK and no error.</div><div class="ttdef"><b>Definition:</b> addon_base.h:130</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s_html_gga335347495ed00620451a69cfe3494502ac0720dbdce3dcb194f12a0eceb59a501"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___s_t_a_t_u_s.html#gga335347495ed00620451a69cfe3494502ac0720dbdce3dcb194f12a0eceb59a501">ADDON_STATUS_UNKNOWN</a></div><div class="ttdeci">@ ADDON_STATUS_UNKNOWN</div><div class="ttdoc">Unknown and incomprehensible error.</div><div class="ttdef"><b>Definition:</b> addon_base.h:142</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e_html_ggada0b4c3c9f9c168e5e1c27145ec72357a83120cb2f02fe5a4759f5bf0209bdfb5"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e.html#ggada0b4c3c9f9c168e5e1c27145ec72357a83120cb2f02fe5a4759f5bf0209bdfb5">ADDON_INSTANCE_VISUALIZATION</a></div><div class="ttdeci">@ ADDON_INSTANCE_VISUALIZATION</div><div class="ttdoc">Music visualization instance, see kodi::addon::CInstanceVisualization.</div><div class="ttdef"><b>Definition:</b> versions.h:238</div></div>
<div class="ttc" id="agroup__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e_html_ggada0b4c3c9f9c168e5e1c27145ec72357a84fe3fcf6a482a0188eeea3e3b31f499"><div class="ttname"><a href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e.html#ggada0b4c3c9f9c168e5e1c27145ec72357a84fe3fcf6a482a0188eeea3e3b31f499">ADDON_INSTANCE_SCREENSAVER</a></div><div class="ttdeci">@ ADDON_INSTANCE_SCREENSAVER</div><div class="ttdoc">PVR client instance, see kodi::addon::CInstanceScreensaver.</div><div class="ttdef"><b>Definition:</b> versions.h:235</div></div>
<div class="ttc" id="agroup__cpp__kodi_html_gaaa1f205f9375cd086229a1455ede11cc"><div class="ttname"><a href="group__cpp__kodi.html#gaaa1f205f9375cd086229a1455ede11cc">kodi::Log</a></div><div class="ttdeci">void ATTRIBUTE_HIDDEN Log(const AddonLog loglevel, const char *format,...)</div><div class="ttdoc">Add a message to Kodi's log.</div><div class="ttdef"><b>Definition:</b> AddonBase.h:749</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="gaf503045d18aaaef1e68796c8d14fff0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf503045d18aaaef1e68796c8d14fff0a">◆ </a></span>DestroyInstance()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void DestroyInstance </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>instanceType</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>instanceID</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">KODI_HANDLE </td>
<td class="paramname"><em>addonInstance</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Instance destroy. </p>
<p>This function is optional and intended to notify addon that the instance is terminating.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instanceType</td><td>The requested type of required instance, see <a class="el" href="group__cpp__kodi__addon__addonbase___defs___a_d_d_o_n___t_y_p_e.html#gada0b4c3c9f9c168e5e1c27145ec72357">ADDON_TYPE</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">instanceID</td><td>An individual identification key string given by Kodi. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">addonInstance</td><td>The pointer to instance class created in addon.</td></tr>
</table>
</dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>This call is only used to inform that the associated instance is terminated. The deletion is carried out in the background. </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>