kodi
PVRChannelsPath.h
1 /*
2  * Copyright (C) 2012-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 "addons/IAddon.h"
12 
13 class CDateTime;
14 
15 namespace PVR
16 {
18  {
19  public:
20  static const std::string PATH_TV_CHANNELS;
21  static const std::string PATH_RADIO_CHANNELS;
22 
23  explicit CPVRChannelsPath(const std::string& strPath);
24  CPVRChannelsPath(bool bRadio, const std::string& strGroupName, int iGroupClientID);
25  CPVRChannelsPath(bool bRadio,
26  bool bHidden,
27  const std::string& strGroupName,
28  int iGroupClientID);
29  CPVRChannelsPath(bool bRadio,
30  const std::string& strGroupName,
31  int iGroupClientID,
32  const std::string& strAddonID,
33  ADDON::AddonInstanceId instanceID,
34  int iChannelUID);
35 
36  operator std::string() const { return m_path; }
37  bool operator ==(const CPVRChannelsPath& right) const { return m_path == right.m_path; }
38  bool operator !=(const CPVRChannelsPath& right) const { return !(*this == right); }
39 
40  bool IsValid() const { return m_kind > Kind::PROTO; }
41 
42  bool IsEmpty() const { return m_kind == Kind::EMPTY; }
43  bool IsChannelsRoot() const { return m_kind == Kind::ROOT; }
44  bool IsChannelGroup() const { return m_kind == Kind::GROUP; }
45  bool IsChannel() const { return m_kind == Kind::CHANNEL; }
46 
47  bool IsHiddenChannelGroup() const;
48 
49  bool IsRadio() const { return m_bRadio; }
50 
51  const std::string& GetGroupName() const { return m_groupName; }
52  int GetGroupClientID() const { return m_groupClientID; }
53  const std::string& GetAddonID() const { return m_addonID; }
54  ADDON::AddonInstanceId GetInstanceID() const { return m_instanceID; }
55  int GetChannelUID() const { return m_iChannelUID; }
56 
57  private:
58  static std::string TrimSlashes(const std::string& strString);
59 
60  enum class Kind
61  {
62  INVALID,
63  PROTO,
64  EMPTY,
65  ROOT,
66  GROUP,
67  CHANNEL,
68  };
69 
70  Kind m_kind = Kind::INVALID;
71  bool m_bRadio = false;;
72  std::string m_path;
73  std::string m_groupName;
74  int m_groupClientID{-1};
75  std::string m_addonID;
76  ADDON::AddonInstanceId m_instanceID{ADDON::ADDON_SINGLETON_INSTANCE_ID};
77  int m_iChannelUID = -1;
78  };
79 }
Definition: ContextMenuManager.h:24
Definition: PVRChannelsPath.h:17
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63