1 /*
2  *  Copyright (C) 2005-2018 Team Kodi
3  *  This file is part of Kodi - https://kodi.tv
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "../../AddonBase.h"
12 #include "../../c-api/addon-instance/pvr.h"
13 
14 //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
15 // "C++" Definitions group 5 - PVR recordings
16 #ifdef __cplusplus
17 
18 namespace kodi
19 {
20 namespace addon
21 {
22 
23 //==============================================================================
24 /// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording class PVRRecording
25 /// @ingroup cpp_kodi_addon_pvr_Defs_Recording
26 /// @brief **Data structure with available recordings data**\n
27 /// With this, recordings related data are transferred between addon and Kodi
28 /// and can also be used by the addon itself.
29 ///
30 /// The related values here are automatically initiated to defaults and need
31 /// only be set if supported and used.
32 ///
33 /// ----------------------------------------------------------------------------
34 ///
35 /// @copydetails cpp_kodi_addon_pvr_Defs_Recording_PVRRecording_Help
36 ///
37 ///@{
38 class PVRRecording : public CStructHdl<PVRRecording, PVR_RECORDING>
39 {
40   friend class CInstancePVRClient;
41 
42 public:
43   /*! \cond PRIVATE */
PVRRecording()44   PVRRecording()
45   {
46     m_cStructure->iSeriesNumber = PVR_RECORDING_INVALID_SERIES_EPISODE;
47     m_cStructure->iEpisodeNumber = PVR_RECORDING_INVALID_SERIES_EPISODE;
48     m_cStructure->recordingTime = 0;
49     m_cStructure->iDuration = PVR_RECORDING_VALUE_NOT_AVAILABLE;
50     m_cStructure->iPriority = PVR_RECORDING_VALUE_NOT_AVAILABLE;
51     m_cStructure->iLifetime = PVR_RECORDING_VALUE_NOT_AVAILABLE;
52     m_cStructure->iGenreType = PVR_RECORDING_VALUE_NOT_AVAILABLE;
53     m_cStructure->iGenreSubType = PVR_RECORDING_VALUE_NOT_AVAILABLE;
54     m_cStructure->iPlayCount = PVR_RECORDING_VALUE_NOT_AVAILABLE;
55     m_cStructure->iLastPlayedPosition = PVR_RECORDING_VALUE_NOT_AVAILABLE;
56     m_cStructure->bIsDeleted = false;
57     m_cStructure->iEpgEventId = 0;
58     m_cStructure->iChannelUid = PVR_RECORDING_VALUE_NOT_AVAILABLE;
59     m_cStructure->channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
60     m_cStructure->iFlags = 0;
61     m_cStructure->sizeInBytes = PVR_RECORDING_VALUE_NOT_AVAILABLE;
62   }
PVRRecording(const PVRRecording & recording)63   PVRRecording(const PVRRecording& recording) : CStructHdl(recording) {}
64   /*! \endcond */
65 
66   /// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording_Help Value Help
67   /// @ingroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
68   ///
69   /// <b>The following table contains values that can be set with @ref cpp_kodi_addon_pvr_Defs_Recording_PVRRecording :</b>
70   /// | Name | Type | Set call | Get call | Usage
71   /// |------|------|----------|----------|-----------
72   /// | **Recording id** | `std::string` | @ref PVRRecording::SetRecordingId "SetRecordingId" | @ref PVRRecording::GetRecordingId "GetRecordingId" | *required to set*
73   /// | **Title** | `std::string` | @ref PVRRecording::SetTitle "SetTitle" | @ref PVRRecording::GetTitle "GetTitle" | *required to set*
74   /// | **Episode name** | `std::string` | @ref PVRRecording::SetEpisodeName "SetEpisodeName" | @ref PVRRecording::GetEpisodeName "GetEpisodeName" | *optional*
75   /// | **Series number** | `int` | @ref PVRRecording::SetSeriesNumber "SetSeriesNumber" | @ref PVRRecording::GetSeriesNumber "GetSeriesNumber" | *optional*
76   /// | **Episode number** | `int` | @ref PVRRecording::SetEpisodeNumber "SetEpisodeNumber" | @ref PVRRecording::GetEpisodeNumber "GetEpisodeNumber" | *optional*
77   /// | **Year** | `int` | @ref PVRRecording::SetYear "SetYear" | @ref PVRRecording::GetYear "GetYear" | *optional*
78   /// | **Directory** | `std::string` | @ref PVRRecording::SetDirectory "SetDirectory" | @ref PVRRecording::GetDirectory "GetDirectory" | *optional*
79   /// | **Plot outline** | `std::string` | @ref PVRRecording::SetPlotOutline "SetPlotOutline" | @ref PVRRecording::GetPlotOutline "GetPlotOutline" | *optional*
80   /// | **Plot** | `std::string` | @ref PVRRecording::SetPlot "SetPlot" | @ref PVRRecording::GetPlot "GetPlot" | *optional*
81   /// | **Genre description** | `std::string` | @ref PVRRecording::SetGenreDescription "SetGenreDescription" | @ref PVRRecording::GetGenreDescription "GetGenreDescription" | *optional*
82   /// | **Channel name** | `std::string` | @ref PVRRecording::SetChannelName "SetChannelName" | @ref PVRRecording::GetChannelName "GetChannelName" | *optional*
83   /// | **Icon path** | `std::string` | @ref PVRRecording::SetIconPath "SetIconPath" | @ref PVRRecording::GetIconPath "GetIconPath" | *optional*
84   /// | **Thumbnail path** | `std::string` | @ref PVRRecording::SetThumbnailPath "SetThumbnailPath" | @ref PVRRecording::GetThumbnailPath "GetThumbnailPath" | *optional*
85   /// | **Fanart path** | `std::string` | @ref PVRRecording::SetFanartPath "SetFanartPath" | @ref PVRRecording::GetFanartPath "GetFanartPath" | *optional*
86   /// | **Recording time** | `time_t` | @ref PVRRecording::SetRecordingTime "SetRecordingTime" | @ref PVRRecording::GetRecordingTime "GetRecordingTime" | *optional*
87   /// | **Duration** | `int` | @ref PVRRecording::SetDuration "SetDuration" | @ref PVRRecording::GetDuration "GetDuration" | *optional*
88   /// | **Priority** | `int` | @ref PVRRecording::SetPriority "SetPriority" | @ref PVRRecording::GetPriority "GetPriority" | *optional*
89   /// | **Lifetime** | `int` | @ref PVRRecording::SetLifetime "SetLifetime" | @ref PVRRecording::GetLifetime "GetLifetime" | *optional*
90   /// | **Genre type** | `int` | @ref PVRRecording::SetGenreType "SetGenreType" | @ref PVRRecording::GetGenreType "GetGenreType" | *optional*
91   /// | **Genre sub type** | `int` | @ref PVRRecording::SetGenreSubType "SetGenreSubType" | @ref PVRRecording::GetGenreSubType "GetGenreSubType" | *optional*
92   /// | **Play count** | `int` | @ref PVRRecording::SetPlayCount "SetPlayCount" | @ref PVRRecording::GetPlayCount "GetPlayCount" | *optional*
93   /// | **Last played position** | `int` | @ref PVRRecording::SetLastPlayedPosition "SetLastPlayedPosition" | @ref PVRRecording::GetLastPlayedPosition "GetLastPlayedPosition" | *optional*
94   /// | **Is deleted** | `bool` | @ref PVRRecording::SetIsDeleted "SetIsDeleted" | @ref PVRRecording::GetIsDeleted "GetIsDeleted" | *optional*
95   /// | **EPG event id** | `unsigned int` | @ref PVRRecording::SetEPGEventId "SetEPGEventId" | @ref PVRRecording::GetEPGEventId "GetEPGEventId" | *optional*
96   /// | **Channel unique id** | `int` | @ref PVRRecording::SetChannelUid "SetChannelUid" | @ref PVRRecording::GetChannelUid "GetChannelUid" | *optional*
97   /// | **Channel type** | @ref PVR_RECORDING_CHANNEL_TYPE | @ref PVRRecording::SetChannelType "SetChannelType" | @ref PVRRecording::GetChannelType "GetChannelType" | *optional*
98   /// | **First aired** | `std::string` | @ref PVRRecording::SetFirstAired "SetFirstAired" | @ref PVRRecording::GetFirstAired "GetFirstAired" | *optional*
99   /// | **Flags** | `std::string` | @ref PVRRecording::SetFlags "SetFlags" | @ref PVRRecording::GetFlags "GetFlags" | *optional*
100   /// | **Size in bytes** | `std::string` | @ref PVRRecording::SetSizeInBytes "SetSizeInBytes" | @ref PVRRecording::GetSizeInBytes "GetSizeInBytes" | *optional*
101 
102   /// @addtogroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
103   ///@{
104 
105   /// @brief **required**\n
106   /// Unique identifier of the recording on the client.
SetRecordingId(const std::string & recordingId)107   void SetRecordingId(const std::string& recordingId)
108   {
109     strncpy(m_cStructure->strRecordingId, recordingId.c_str(),
110             sizeof(m_cStructure->strRecordingId) - 1);
111   }
112 
113   /// @brief To get with @ref SetRecordingId changed values.
GetRecordingId()114   std::string GetRecordingId() const { return m_cStructure->strRecordingId; }
115 
116   /// @brief **required**\n
117   /// The title of this recording.
SetTitle(const std::string & title)118   void SetTitle(const std::string& title)
119   {
120     strncpy(m_cStructure->strTitle, title.c_str(), sizeof(m_cStructure->strTitle) - 1);
121   }
122 
123   /// @brief To get with @ref SetTitle changed values.
GetTitle()124   std::string GetTitle() const { return m_cStructure->strTitle; }
125 
126   /// @brief **optional**\n
127   /// Episode name (also known as subtitle).
SetEpisodeName(const std::string & episodeName)128   void SetEpisodeName(const std::string& episodeName)
129   {
130     strncpy(m_cStructure->strEpisodeName, episodeName.c_str(),
131             sizeof(m_cStructure->strEpisodeName) - 1);
132   }
133 
134   /// @brief To get with @ref SetEpisodeName changed values.
GetEpisodeName()135   std::string GetEpisodeName() const { return m_cStructure->strEpisodeName; }
136 
137   /// @brief **optional**\n
138   /// Series number (usually called season).
139   ///
140   /// Set to "0" for specials/pilot. For 'invalid' see @ref SetEpisodeNumber or set to -1.
SetSeriesNumber(int seriesNumber)141   void SetSeriesNumber(int seriesNumber) { m_cStructure->iSeriesNumber = seriesNumber; }
142 
143   /// @brief To get with @ref SetSeriesNumber changed values.
GetSeriesNumber()144   int GetSeriesNumber() const { return m_cStructure->iSeriesNumber; }
145 
146   /// @brief **optional**\n
147   /// Eepisode number within the "iSeriesNumber" season.
148   ///
149   /// For 'invalid' set to -1 or seriesNumber=episodeNumber=0 to show both are invalid.
SetEpisodeNumber(int episodeNumber)150   void SetEpisodeNumber(int episodeNumber) { m_cStructure->iEpisodeNumber = episodeNumber; }
151 
152   /// @brief To get with @ref SetEpisodeNumber changed values.
GetEpisodeNumber()153   int GetEpisodeNumber() const { return m_cStructure->iEpisodeNumber; }
154 
155   /// @brief **optional**\n
156   /// Year of first release (use to identify a specific movie re-make) / first
157   /// airing for TV shows.
158   ///
159   /// Set to '0' for invalid.
SetYear(int year)160   void SetYear(int year) { m_cStructure->iYear = year; }
161 
162   /// @brief To get with @ref SetYear changed values.
GetYear()163   int GetYear() const { return m_cStructure->iYear; }
164 
165   /// @brief **optional**\n
166   ///
167   /// Directory of this recording on the client.
SetDirectory(const std::string & directory)168   void SetDirectory(const std::string& directory)
169   {
170     strncpy(m_cStructure->strDirectory, directory.c_str(), sizeof(m_cStructure->strDirectory) - 1);
171   }
172 
173   /// @brief To get with @ref SetDirectory changed values.
GetDirectory()174   std::string GetDirectory() const { return m_cStructure->strDirectory; }
175 
176   /// @brief **optional**\n
177   /// Plot outline name.
SetPlotOutline(const std::string & plotOutline)178   void SetPlotOutline(const std::string& plotOutline)
179   {
180     strncpy(m_cStructure->strPlotOutline, plotOutline.c_str(),
181             sizeof(m_cStructure->strPlotOutline) - 1);
182   }
183 
184   /// @brief To get with @ref SetPlotOutline changed values.
GetPlotOutline()185   std::string GetPlotOutline() const { return m_cStructure->strPlotOutline; }
186 
187   /// @brief **optional**\n
188   /// Plot name.
SetPlot(const std::string & plot)189   void SetPlot(const std::string& plot)
190   {
191     strncpy(m_cStructure->strPlot, plot.c_str(), sizeof(m_cStructure->strPlot) - 1);
192   }
193 
194   /// @brief To get with @ref SetPlot changed values.
GetPlot()195   std::string GetPlot() const { return m_cStructure->strPlot; }
196 
197   /// @brief **optional**\n
198   /// Channel name.
SetChannelName(const std::string & channelName)199   void SetChannelName(const std::string& channelName)
200   {
201     strncpy(m_cStructure->strChannelName, channelName.c_str(),
202             sizeof(m_cStructure->strChannelName) - 1);
203   }
204 
205   /// @brief To get with @ref SetChannelName changed values.
GetChannelName()206   std::string GetChannelName() const { return m_cStructure->strChannelName; }
207 
208   /// @brief **optional**\n
209   /// Channel logo (icon) path.
SetIconPath(const std::string & iconPath)210   void SetIconPath(const std::string& iconPath)
211   {
212     strncpy(m_cStructure->strIconPath, iconPath.c_str(), sizeof(m_cStructure->strIconPath) - 1);
213   }
214 
215   /// @brief To get with @ref SetIconPath changed values.
GetIconPath()216   std::string GetIconPath() const { return m_cStructure->strIconPath; }
217 
218   /// @brief **optional**\n
219   /// Thumbnail path.
SetThumbnailPath(const std::string & thumbnailPath)220   void SetThumbnailPath(const std::string& thumbnailPath)
221   {
222     strncpy(m_cStructure->strThumbnailPath, thumbnailPath.c_str(),
223             sizeof(m_cStructure->strThumbnailPath) - 1);
224   }
225 
226   /// @brief To get with @ref SetThumbnailPath changed values.
GetThumbnailPath()227   std::string GetThumbnailPath() const { return m_cStructure->strThumbnailPath; }
228 
229   /// @brief **optional**\n
230   /// Fanart path.
SetFanartPath(const std::string & fanartPath)231   void SetFanartPath(const std::string& fanartPath)
232   {
233     strncpy(m_cStructure->strFanartPath, fanartPath.c_str(),
234             sizeof(m_cStructure->strFanartPath) - 1);
235   }
236 
237   /// @brief To get with @ref SetFanartPath changed values.
GetFanartPath()238   std::string GetFanartPath() const { return m_cStructure->strFanartPath; }
239 
240   /// @brief **optional**\n
241   /// Start time of the recording.
SetRecordingTime(time_t recordingTime)242   void SetRecordingTime(time_t recordingTime) { m_cStructure->recordingTime = recordingTime; }
243 
244   /// @brief To get with @ref SetRecordingTime changed values.
GetRecordingTime()245   time_t GetRecordingTime() const { return m_cStructure->recordingTime; }
246 
247   /// @brief **optional**\n
248   /// Duration of the recording in seconds.
SetDuration(int duration)249   void SetDuration(int duration) { m_cStructure->iDuration = duration; }
250 
251   /// @brief To get with @ref SetDuration changed values.
GetDuration()252   int GetDuration() const { return m_cStructure->iDuration; }
253 
254   /// @brief **optional**\n
255   /// Priority of this recording (from 0 - 100).
SetPriority(int priority)256   void SetPriority(int priority) { m_cStructure->iPriority = priority; }
257 
258   /// @brief To get with @ref SetPriority changed values.
GetPriority()259   int GetPriority() const { return m_cStructure->iPriority; }
260 
261   /// @brief **optional**\n
262   /// Life time in days of this recording.
SetLifetime(int lifetime)263   void SetLifetime(int lifetime) { m_cStructure->iLifetime = lifetime; }
264 
265   /// @brief To get with @ref SetLifetime changed values.
GetLifetime()266   int GetLifetime() const { return m_cStructure->iLifetime; }
267 
268   /// @brief **optional**\n
269   /// Genre type.
270   ///
271   /// Use @ref EPG_GENRE_USE_STRING if type becomes given by @ref SetGenreDescription.
272   ///
273   /// @note If confirmed that backend brings the types in [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf)
274   /// conform values, can be @ref EPG_EVENT_CONTENTMASK ignored and to set here
275   /// with backend value.
276   ///
277   ///
278   /// --------------------------------------------------------------------------
279   ///
280   /// **Example 1:**
281   /// ~~~~~~~~~~~~~{.cpp}
282   /// kodi::addon::PVRRecording tag;
283   /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MOVIEDRAMA);
284   /// ~~~~~~~~~~~~~
285   ///
286   /// --------------------------------------------------------------------------
287   ///
288   /// **Example 2** (in case of other, not ETSI EN 300 468 conform genre types):
289   /// ~~~~~~~~~~~~~{.cpp}
290   /// kodi::addon::PVRRecording tag;
291   /// tag.SetGenreType(EPG_GENRE_USE_STRING);
292   /// tag.SetGenreDescription("My special genre name"); // Should use (if possible) kodi::GetLocalizedString(...) to have match user language.
293   /// ~~~~~~~~~~~~~
294   ///
SetGenreType(int genreType)295   void SetGenreType(int genreType) { m_cStructure->iGenreType = genreType; }
296 
297   /// @brief To get with @ref SetGenreType changed values.
GetGenreType()298   int GetGenreType() const { return m_cStructure->iGenreType; }
299 
300   /// @brief **optional**\n
301   /// Genre sub type.
302   ///
303   /// Subtypes groups related to set by @ref SetGenreType:
304   /// | Main genre type | List with available sub genre types
305   /// |-----------------|-----------------------------------------
306   /// | @ref EPG_EVENT_CONTENTMASK_UNDEFINED | Nothing, should be 0
307   /// | @ref EPG_EVENT_CONTENTMASK_MOVIEDRAMA | @ref EPG_EVENT_CONTENTSUBMASK_MOVIEDRAMA
308   /// | @ref EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS | @ref EPG_EVENT_CONTENTSUBMASK_NEWSCURRENTAFFAIRS
309   /// | @ref EPG_EVENT_CONTENTMASK_SHOW | @ref EPG_EVENT_CONTENTSUBMASK_SHOW
310   /// | @ref EPG_EVENT_CONTENTMASK_SPORTS | @ref EPG_EVENT_CONTENTSUBMASK_SPORTS
311   /// | @ref EPG_EVENT_CONTENTMASK_CHILDRENYOUTH | @ref EPG_EVENT_CONTENTSUBMASK_CHILDRENYOUTH
312   /// | @ref EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE | @ref EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE
313   /// | @ref EPG_EVENT_CONTENTMASK_ARTSCULTURE | @ref EPG_EVENT_CONTENTSUBMASK_ARTSCULTURE
314   /// | @ref EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS | @ref EPG_EVENT_CONTENTSUBMASK_SOCIALPOLITICALECONOMICS
315   /// | @ref EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE | @ref EPG_EVENT_CONTENTSUBMASK_EDUCATIONALSCIENCE
316   /// | @ref EPG_EVENT_CONTENTMASK_LEISUREHOBBIES | @ref EPG_EVENT_CONTENTSUBMASK_LEISUREHOBBIES
317   /// | @ref EPG_EVENT_CONTENTMASK_SPECIAL | @ref EPG_EVENT_CONTENTSUBMASK_SPECIAL
318   /// | @ref EPG_EVENT_CONTENTMASK_USERDEFINED | Can be defined by you
319   /// | @ref EPG_GENRE_USE_STRING | **Kodi's own value**, which declares that the type with @ref SetGenreDescription is given.
320   ///
321   /// --------------------------------------------------------------------------
322   ///
323   /// **Example:**
324   /// ~~~~~~~~~~~~~{.cpp}
325   /// kodi::addon::PVRRecording tag;
326   /// tag.SetGenreType(EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE);
327   /// tag.SetGenreSubType(EPG_EVENT_CONTENTSUBMASK_MUSICBALLETDANCE_JAZZ);
328   /// ~~~~~~~~~~~~~
329   ///
SetGenreSubType(int genreSubType)330   void SetGenreSubType(int genreSubType) { m_cStructure->iGenreSubType = genreSubType; }
331 
332   /// @brief To get with @ref SetGenreSubType changed values.
GetGenreSubType()333   int GetGenreSubType() const { return m_cStructure->iGenreSubType; }
334 
335   /// @brief **optional**\n
336   /// To set own genre description name.
337   ///
338   /// Will be used only when genreType == @ref EPG_GENRE_USE_STRING or
339   /// genreSubType == @ref EPG_GENRE_USE_STRING.
340   ///
341   /// Use @ref EPG_STRING_TOKEN_SEPARATOR to separate different genres.
342   ///
343   /// In case of other, not [ETSI EN 300 468](https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.14.01_60/en_300468v011401p.pdf)
344   /// conform genre types or something special.
345   ///
346   /// --------------------------------------------------------------------------
347   ///
348   /// **Example:**
349   /// ~~~~~~~~~~~~~{.cpp}
350   /// kodi::addon::PVRRecording tag;
351   /// tag.SetGenreType(EPG_GENRE_USE_STRING);
352   /// tag.SetGenreDescription("Action" + EPG_STRING_TOKEN_SEPARATOR + "Thriller");
353   /// ~~~~~~~~~~~~~
354   ///
SetGenreDescription(const std::string & genreDescription)355   void SetGenreDescription(const std::string& genreDescription)
356   {
357     strncpy(m_cStructure->strGenreDescription, genreDescription.c_str(),
358             sizeof(m_cStructure->strGenreDescription) - 1);
359   }
360 
361   /// @brief To get with @ref SetGenreDescription changed values.
GetGenreDescription()362   std::string GetGenreDescription() const { return m_cStructure->strGenreDescription; }
363 
364   /// @brief **optional**\n
365   /// Play count of this recording on the client.
SetPlayCount(int playCount)366   void SetPlayCount(int playCount) { m_cStructure->iPlayCount = playCount; }
367 
368   /// @brief To get with @ref SetPlayCount changed values.
GetPlayCount()369   int GetPlayCount() const { return m_cStructure->iPlayCount; }
370 
371   /// @brief **optional**\n
372   /// Last played position of this recording on the client.
SetLastPlayedPosition(int lastPlayedPosition)373   void SetLastPlayedPosition(int lastPlayedPosition)
374   {
375     m_cStructure->iLastPlayedPosition = lastPlayedPosition;
376   }
377 
378   /// @brief To get with @ref SetLastPlayedPosition changed values.
GetLastPlayedPosition()379   int GetLastPlayedPosition() const { return m_cStructure->iLastPlayedPosition; }
380 
381   /// @brief **optional**\n
382   /// Shows this recording is deleted and can be undelete.
SetIsDeleted(int isDeleted)383   void SetIsDeleted(int isDeleted) { m_cStructure->bIsDeleted = isDeleted; }
384 
385   /// @brief To get with @ref SetIsDeleted changed values.
GetIsDeleted()386   int GetIsDeleted() const { return m_cStructure->bIsDeleted; }
387 
388   /// @brief **optional**\n
389   /// EPG event id associated with this recording. Valid ids must be greater than @ref EPG_TAG_INVALID_UID.
SetEPGEventId(unsigned int epgEventId)390   void SetEPGEventId(unsigned int epgEventId) { m_cStructure->iEpgEventId = epgEventId; }
391 
392   /// @brief To get with @ref SetEPGEventId changed values.
GetEPGEventId()393   unsigned int GetEPGEventId() const { return m_cStructure->iEpgEventId; }
394 
395   /// @brief **optional**\n
396   /// Unique identifier of the channel for this recording. @ref PVR_CHANNEL_INVALID_UID
397   /// denotes that channel uid is not available.
SetChannelUid(int channelUid)398   void SetChannelUid(int channelUid) { m_cStructure->iChannelUid = channelUid; }
399 
400   /// @brief To get with @ref SetChannelUid changed values
GetChannelUid()401   int GetChannelUid() const { return m_cStructure->iChannelUid; }
402 
403   /// @brief **optional**\n
404   /// Channel type.
405   ///
406   /// Set to @ref PVR_RECORDING_CHANNEL_TYPE_UNKNOWN if the type cannot be
407   /// determined.
408   ///
409   /// --------------------------------------------------------------------------
410   ///
411   /// Example:
412   /// ~~~~~~~~~~~~~{.cpp}
413   /// kodi::addon::PVRRecording tag;
414   /// tag.SetChannelType(PVR_RECORDING_CHANNEL_TYPE_TV);
415   /// ~~~~~~~~~~~~~
416   ///
SetChannelType(PVR_RECORDING_CHANNEL_TYPE channelType)417   void SetChannelType(PVR_RECORDING_CHANNEL_TYPE channelType)
418   {
419     m_cStructure->channelType = channelType;
420   }
421 
422   /// @brief To get with @ref SetChannelType changed values
GetChannelType()423   PVR_RECORDING_CHANNEL_TYPE GetChannelType() const { return m_cStructure->channelType; }
424 
425   /// @brief **optional**\n
426   /// First aired date of this recording.
427   ///
428   /// Used only for display purposes. Specify in W3C date format "YYYY-MM-DD".
429   ///
430   /// --------------------------------------------------------------------------
431   ///
432   /// Example:
433   /// ~~~~~~~~~~~~~{.cpp}
434   /// kodi::addon::PVRRecording tag;
435   /// tag.SetFirstAired(1982-10-22);
436   /// ~~~~~~~~~~~~~
437   ///
SetFirstAired(const std::string & firstAired)438   void SetFirstAired(const std::string& firstAired)
439   {
440     strncpy(m_cStructure->strFirstAired, firstAired.c_str(),
441             sizeof(m_cStructure->strFirstAired) - 1);
442   }
443 
444   /// @brief To get with @ref SetFirstAired changed values
GetFirstAired()445   std::string GetFirstAired() const { return m_cStructure->strFirstAired; }
446 
447   /// @brief **optional**\n
448   /// Bit field of independent flags associated with the recording.
449   ///
450   /// See @ref cpp_kodi_addon_pvr_Defs_Recording_PVR_RECORDING_FLAG for
451   /// available bit flags.
452   ///
453   /// --------------------------------------------------------------------------
454   ///
455   /// @copydetails cpp_kodi_addon_pvr_Defs_Recording_PVR_RECORDING_FLAG
456   ///
SetFlags(unsigned int flags)457   void SetFlags(unsigned int flags) { m_cStructure->iFlags = flags; }
458 
459   /// @brief To get with @ref SetFlags changed values.
GetFlags()460   unsigned int GetFlags() const { return m_cStructure->iFlags; }
461 
462   /// @brief **optional**\n
463   /// Size of the recording in bytes.
SetSizeInBytes(int64_t sizeInBytes)464   void SetSizeInBytes(int64_t sizeInBytes) { m_cStructure->sizeInBytes = sizeInBytes; }
465 
466   /// @brief To get with @ref SetSizeInBytes changed values.
GetSizeInBytes()467   int64_t GetSizeInBytes() const { return m_cStructure->sizeInBytes; }
468   ///@}
469 
470 private:
PVRRecording(const PVR_RECORDING * recording)471   PVRRecording(const PVR_RECORDING* recording) : CStructHdl(recording) {}
PVRRecording(PVR_RECORDING * recording)472   PVRRecording(PVR_RECORDING* recording) : CStructHdl(recording) {}
473 };
474 ///@}
475 //------------------------------------------------------------------------------
476 
477 //==============================================================================
478 /// @defgroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecordingsResultSet class PVRRecordingsResultSet
479 /// @ingroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording
480 /// @brief **PVR add-on recording transfer class**\n
481 /// To transfer the content of @ref kodi::addon::CInstancePVRClient::GetRecordings().
482 ///
483 /// @note This becomes only be used on addon call above, not usable outside on
484 /// addon itself.
485 ///@{
486 class PVRRecordingsResultSet
487 {
488 public:
489   /*! \cond PRIVATE */
490   PVRRecordingsResultSet() = delete;
PVRRecordingsResultSet(const AddonInstance_PVR * instance,ADDON_HANDLE handle)491   PVRRecordingsResultSet(const AddonInstance_PVR* instance, ADDON_HANDLE handle)
492     : m_instance(instance), m_handle(handle)
493   {
494   }
495   /*! \endcond */
496 
497   /// @addtogroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecordingsResultSet
498   ///@{
499 
500   /// @brief To add and give content from addon to Kodi on related call.
501   ///
502   /// @param[in] tag The to transferred data.
Add(const kodi::addon::PVRRecording & tag)503   void Add(const kodi::addon::PVRRecording& tag)
504   {
505     m_instance->toKodi->TransferRecordingEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
506   }
507 
508   ///@}
509 
510 private:
511   const AddonInstance_PVR* m_instance = nullptr;
512   const ADDON_HANDLE m_handle;
513 };
514 ///@}
515 //------------------------------------------------------------------------------
516 
517 } /* namespace addon */
518 } /* namespace kodi */
519 
520 #endif /* __cplusplus */
521