blob: cb3ac8388df4c6cd83e2d9d80c03d61915ae8f5f (
plain)
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
|
/*
* Copyright (C) 2012-2021 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "pvr/channels/PVRChannelNumber.h"
#include "utils/ISerializable.h"
#include "utils/ISortable.h"
#include <memory>
#include <string>
namespace PVR
{
class CPVRChannel;
class CPVRChannelGroupMember : public ISerializable, public ISortable
{
friend class CPVRDatabase;
public:
CPVRChannelGroupMember() : m_bNeedsSave(false) {}
CPVRChannelGroupMember(const std::string& groupName,
int order,
const std::shared_ptr<CPVRChannel>& channel);
CPVRChannelGroupMember(int iGroupID,
const std::string& groupName,
const std::shared_ptr<CPVRChannel>& channel);
virtual ~CPVRChannelGroupMember() = default;
// ISerializable implementation
void Serialize(CVariant& value) const override;
// ISortable implementation
void ToSortable(SortItem& sortable, Field field) const override;
std::shared_ptr<CPVRChannel> Channel() const { return m_channel; }
void SetChannel(const std::shared_ptr<CPVRChannel>& channel);
int GroupID() const { return m_iGroupID; }
void SetGroupID(int iGroupID);
const std::string& Path() const { return m_path; }
void SetGroupName(const std::string& groupName);
const CPVRChannelNumber& ChannelNumber() const { return m_channelNumber; }
void SetChannelNumber(const CPVRChannelNumber& channelNumber);
const CPVRChannelNumber& ClientChannelNumber() const { return m_clientChannelNumber; }
void SetClientChannelNumber(const CPVRChannelNumber& clientChannelNumber);
int ClientPriority() const { return m_iClientPriority; }
void SetClientPriority(int iClientPriority);
int Order() const { return m_iOrder; }
void SetOrder(int iOrder);
bool NeedsSave() const { return m_bNeedsSave; }
void SetSaved() { m_bNeedsSave = false; }
int ClientID() const { return m_iClientID; }
int ChannelUID() const { return m_iChannelUID; }
int ChannelDatabaseID() const { return m_iChannelDatabaseID; }
bool IsRadio() const { return m_bIsRadio; }
/*!
* @brief Delete this group member from the database.
* @return True if it was deleted successfully, false otherwise.
*/
bool QueueDelete();
private:
int m_iGroupID = -1;
int m_iClientID = -1;
int m_iChannelUID = -1;
int m_iChannelDatabaseID = -1;
bool m_bIsRadio = false;
std::shared_ptr<CPVRChannel> m_channel;
std::string m_path;
CPVRChannelNumber m_channelNumber; // the channel number this channel has in the group
CPVRChannelNumber
m_clientChannelNumber; // the client channel number this channel has in the group
int m_iClientPriority = 0;
int m_iOrder = 0; // The value denoting the order of this member in the group
bool m_bNeedsSave = true;
};
} // namespace PVR
|