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 order,
32  const std::shared_ptr<CPVRChannel>& channel);
33 
34  CPVRChannelGroupMember(int iGroupID,
35  const std::string& groupName,
36  const std::shared_ptr<CPVRChannel>& channel);
37 
38  virtual ~CPVRChannelGroupMember() = default;
39 
40  // ISerializable implementation
41  void Serialize(CVariant& value) const override;
42 
43  // ISortable implementation
44  void ToSortable(SortItem& sortable, Field field) const override;
45 
46  std::shared_ptr<CPVRChannel> Channel() const { return m_channel; }
47  void SetChannel(const std::shared_ptr<CPVRChannel>& channel);
48 
49  int GroupID() const { return m_iGroupID; }
50  void SetGroupID(int iGroupID);
51 
52  const std::string& Path() const { return m_path; }
53  void SetGroupName(const std::string& groupName);
54 
55  const CPVRChannelNumber& ChannelNumber() const { return m_channelNumber; }
56  void SetChannelNumber(const CPVRChannelNumber& channelNumber);
57 
58  const CPVRChannelNumber& ClientChannelNumber() const { return m_clientChannelNumber; }
59  void SetClientChannelNumber(const CPVRChannelNumber& clientChannelNumber);
60 
61  int ClientPriority() const { return m_iClientPriority; }
62  void SetClientPriority(int iClientPriority);
63 
64  int Order() const { return m_iOrder; }
65  void SetOrder(int iOrder);
66 
67  bool NeedsSave() const { return m_bNeedsSave; }
68  void SetSaved() { m_bNeedsSave = false; }
69 
70  int ClientID() const { return m_iClientID; }
71 
72  int ChannelUID() const { return m_iChannelUID; }
73 
74  int ChannelDatabaseID() const { return m_iChannelDatabaseID; }
75 
76  bool IsRadio() const { return m_bIsRadio; }
77 
82  bool QueueDelete();
83 
84 private:
85  int m_iGroupID = -1;
86  int m_iClientID = -1;
87  int m_iChannelUID = -1;
88  int m_iChannelDatabaseID = -1;
89  bool m_bIsRadio = false;
90  std::shared_ptr<CPVRChannel> m_channel;
91  std::string m_path;
92  CPVRChannelNumber m_channelNumber; // the channel number this channel has in the group
94  m_clientChannelNumber; // the client channel number this channel has in the group
95  int m_iClientPriority = 0;
96  int m_iOrder = 0; // The value denoting the order of this member in the group
97 
98  bool m_bNeedsSave = true;
99 };
100 
101 } // namespace PVR
Definition: ContextMenuManager.h:24
Definition: Variant.h:29
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:130