Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
ChannelGroups.h
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 3 - PVR channel group
16#ifdef __cplusplus
17
18namespace kodi
19{
20namespace addon
21{
22
23//==============================================================================
37class PVRChannelGroup : public DynamicCStructHdl<PVRChannelGroup, PVR_CHANNEL_GROUP>
38{
39 friend class CInstancePVRClient;
40
41public:
43 PVRChannelGroup() = default;
44 PVRChannelGroup(const PVRChannelGroup& group) : DynamicCStructHdl(group) {}
57
60
63 void SetGroupName(const std::string& groupName)
64 {
65 ReallocAndCopyString(&m_cStructure->strGroupName, groupName.c_str());
66 }
67
69 std::string GetGroupName() const
70 {
71 return m_cStructure->strGroupName ? m_cStructure->strGroupName : "";
72 }
73
76 void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; }
77
79 bool GetIsRadio() const { return m_cStructure->bIsRadio; }
80
84 void SetPosition(unsigned int position) { m_cStructure->iPosition = position; }
85
87 unsigned int GetPosition() const { return m_cStructure->iPosition; }
88
90
91 static void AllocResources(const PVR_CHANNEL_GROUP* source, PVR_CHANNEL_GROUP* target)
92 {
93 target->strGroupName = AllocAndCopyString(source->strGroupName);
94 }
95
96 static void FreeResources(PVR_CHANNEL_GROUP* target) { FreeString(target->strGroupName); }
97
98private:
99 PVRChannelGroup(const PVR_CHANNEL_GROUP* group) : DynamicCStructHdl(group) {}
100 PVRChannelGroup(PVR_CHANNEL_GROUP* group) : DynamicCStructHdl(group) {}
101};
103//------------------------------------------------------------------------------
104
105//==============================================================================
113{
114public:
116 PVRChannelGroupsResultSet() = delete;
117 PVRChannelGroupsResultSet(const AddonInstance_PVR* instance, PVR_HANDLE handle)
118 : m_instance(instance), m_handle(handle)
119 {
120 }
125
130 {
131 m_instance->toKodi->TransferChannelGroup(m_instance->toKodi->kodiInstance, m_handle, tag);
132 }
133
135
136private:
137 const AddonInstance_PVR* m_instance = nullptr;
138 const PVR_HANDLE m_handle;
139};
141//------------------------------------------------------------------------------
142
143//==============================================================================
158 : public DynamicCStructHdl<PVRChannelGroupMember, PVR_CHANNEL_GROUP_MEMBER>
159{
160 friend class CInstancePVRClient;
161
162public:
164 PVRChannelGroupMember() = default;
180
183
186 void SetGroupName(const std::string& groupName)
187 {
188 ReallocAndCopyString(&m_cStructure->strGroupName, groupName.c_str());
189 }
190
192 std::string GetGroupName() const
193 {
194 return m_cStructure->strGroupName ? m_cStructure->strGroupName : "";
195 }
196
199 void SetChannelUniqueId(unsigned int channelUniqueId)
200 {
201 m_cStructure->iChannelUniqueId = channelUniqueId;
202 }
203
205 unsigned int GetChannelUniqueId() const { return m_cStructure->iChannelUniqueId; }
206
209 void SetChannelNumber(unsigned int channelNumber)
210 {
211 m_cStructure->iChannelNumber = channelNumber;
212 }
213
215 unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; }
216
219 void SetSubChannelNumber(unsigned int subChannelNumber)
220 {
221 m_cStructure->iSubChannelNumber = subChannelNumber;
222 }
223
225 unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; }
226
229 void SetOrder(bool order) { m_cStructure->iOrder = order; }
230
232 bool GetOrder() const { return m_cStructure->iOrder; }
233
235
236 static void AllocResources(const PVR_CHANNEL_GROUP_MEMBER* source,
238 {
239 target->strGroupName = AllocAndCopyString(source->strGroupName);
240 }
241
242 static void FreeResources(PVR_CHANNEL_GROUP_MEMBER* target) { FreeString(target->strGroupName); }
243
244private:
245 PVRChannelGroupMember(const PVR_CHANNEL_GROUP_MEMBER* member) : DynamicCStructHdl(member) {}
246 PVRChannelGroupMember(PVR_CHANNEL_GROUP_MEMBER* member) : DynamicCStructHdl(member) {}
247};
249//------------------------------------------------------------------------------
250
251//==============================================================================
259{
260public:
263 PVRChannelGroupMembersResultSet(const AddonInstance_PVR* instance, PVR_HANDLE handle)
264 : m_instance(instance), m_handle(handle)
265 {
266 }
271
276 {
277 m_instance->toKodi->TransferChannelGroupMember(m_instance->toKodi->kodiInstance, m_handle, tag);
278 }
279
281
282private:
283 const AddonInstance_PVR* m_instance = nullptr;
284 const PVR_HANDLE m_handle;
285};
287//------------------------------------------------------------------------------
288
289} /* namespace addon */
290} /* namespace kodi */
291
292#endif /* __cplusplus */
Definition AddonBase.h:288
Definition ChannelGroups.h:38
Definition ChannelGroups.h:159
Definition ChannelGroups.h:259
Definition ChannelGroups.h:113
void SetPosition(unsigned int position)
optional Sort position of the group (0 indicates that the backend doesn't support sorting of groups).
Definition ChannelGroups.h:84
void SetIsRadio(bool isRadio)
required true If this is a radio channel group, false otherwise.
Definition ChannelGroups.h:76
unsigned int GetPosition() const
To get with SetPosition changed values.
Definition ChannelGroups.h:87
bool GetIsRadio() const
To get with SetIsRadio changed values.
Definition ChannelGroups.h:79
std::string GetGroupName() const
To get with SetGroupName changed values.
Definition ChannelGroups.h:69
void SetGroupName(const std::string &groupName)
required Name of this channel group.
Definition ChannelGroups.h:63
void SetOrder(bool order)
optional The value denoting the order of this channel in the 'All channels' group.
Definition ChannelGroups.h:229
unsigned int GetSubChannelNumber() const
To get with SetSubChannelNumber changed values.
Definition ChannelGroups.h:225
void SetChannelNumber(unsigned int channelNumber)
optional Channel number within the group.
Definition ChannelGroups.h:209
void SetSubChannelNumber(unsigned int subChannelNumber)
optional Sub channel number within the group (ATSC).
Definition ChannelGroups.h:219
void SetChannelUniqueId(unsigned int channelUniqueId)
required Unique id of the member.
Definition ChannelGroups.h:199
unsigned int GetChannelUniqueId() const
To get with SetChannelUniqueId changed values.
Definition ChannelGroups.h:205
void SetGroupName(const std::string &groupName)
required Name of the channel group to add the channel to.
Definition ChannelGroups.h:186
std::string GetGroupName() const
To get with SetGroupName changed values.
Definition ChannelGroups.h:192
unsigned int GetChannelNumber() const
To get with SetChannelNumber changed values.
Definition ChannelGroups.h:215
bool GetOrder() const
To get with SetOrder changed values.
Definition ChannelGroups.h:232
void Add(const kodi::addon::PVRChannelGroupMember &tag)
To add and give content from addon to Kodi on related call.
Definition ChannelGroups.h:275
void Add(const kodi::addon::PVRChannelGroup &tag)
To add and give content from addon to Kodi on related call.
Definition ChannelGroups.h:129
Definition pvr.h:362
"C" PVR add-on channel group member.
Definition pvr_channel_groups.h:45
"C" PVR add-on channel group.
Definition pvr_channel_groups.h:31