xbmc
PVRChannelGroupMember.h
1 /*
2  * Copyright (C) 2012-2021 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 "pvr/channels/PVRChannelNumber.h"
12 #include "utils/ISerializable.h"
13 #include "utils/ISortable.h"
14 
15 #include <memory>
16 #include <string>
17 
18 namespace PVR
19 {
20 
21 class CPVRChannel;
22 
24 {
25  friend class CPVRDatabase;
26 
27 public:
28  CPVRChannelGroupMember() : m_bNeedsSave(false) {}
29 
30  CPVRChannelGroupMember(const std::string& groupName,
31  int groupClientID,
32  int order,
33  const std::shared_ptr<CPVRChannel>& channel);
34 
35  CPVRChannelGroupMember(int iGroupID,
36  const std::string& groupName,
37  int groupClientID,
38  const std::shared_ptr<CPVRChannel>& channel);
39 
40  virtual ~CPVRChannelGroupMember() = default;
41 
42  // ISerializable implementation
43  void Serialize(CVariant& value) const override;
44 
45  // ISortable implementation
46  void ToSortable(SortItem& sortable, Field field) const override;
47 
48  std::shared_ptr<CPVRChannel> Channel() const { return m_channel; }
49  void SetChannel(const std::shared_ptr<CPVRChannel>& channel);
50 
51  int GroupID() const { return m_iGroupID; }
52  void SetGroupID(int iGroupID);
53 
54  const std::string& Path() const { return m_path; }
55  void SetGroupName(const std::string& groupName);
56 
57  const CPVRChannelNumber& ChannelNumber() const { return m_channelNumber; }
58  void SetChannelNumber(const CPVRChannelNumber& channelNumber);
59 
60  const CPVRChannelNumber& ClientChannelNumber() const { return m_clientChannelNumber; }
61  void SetClientChannelNumber(const CPVRChannelNumber& clientChannelNumber);
62 
63  int ClientPriority() const { return m_iClientPriority; }
64  void SetClientPriority(int iClientPriority);
65 
66  int Order() const { return m_iOrder; }
67  void SetOrder(int iOrder);
68 
69  bool NeedsSave() const { return m_bNeedsSave; }
70  void SetSaved() { m_bNeedsSave = false; }
71 
72  int ChannelClientID() const { return m_iChannelClientID; }
73 
74  int ChannelUID() const { return m_iChannelUID; }
75 
76  int ChannelDatabaseID() const { return m_iChannelDatabaseID; }
77 
78  bool IsRadio() const { return m_bIsRadio; }
79 
84  bool QueueDelete();
85 
86 private:
87  int m_iGroupID = -1;
88  int m_iGroupClientID = -1;
89  int m_iChannelClientID = -1;
90  int m_iChannelUID = -1;
91  int m_iChannelDatabaseID = -1;
92  bool m_bIsRadio = false;
93  std::shared_ptr<CPVRChannel> m_channel;
94  std::string m_path;
95  CPVRChannelNumber m_channelNumber; // the channel number this channel has in the group
97  m_clientChannelNumber; // the client channel number this channel has in the group
98  int m_iClientPriority = 0;
99  int m_iOrder = 0; // The value denoting the order of this member in the group
100 
101  bool m_bNeedsSave = true;
102 };
103 
104 } // namespace PVR
Definition: ContextMenuManager.h:24
Definition: Variant.h:31
Definition: PVRChannelGroupMember.h:23
Definition: ISerializable.h:13
Definition: ISortable.h:15
Definition: PVRDatabase.h:33
Definition: PVRChannelNumber.h:15
bool QueueDelete()
Delete this group member from the database.
Definition: PVRChannelGroupMember.cpp:136