xbmc
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);
25  CPVRChannelsPath(bool bRadio, bool bHidden, const std::string& strGroupName);
26  CPVRChannelsPath(bool bRadio,
27  const std::string& strGroupName,
28  const std::string& strAddonID,
29  ADDON::AddonInstanceId instanceID,
30  int iChannelUID);
31 
32  operator std::string() const { return m_path; }
33  bool operator ==(const CPVRChannelsPath& right) const { return m_path == right.m_path; }
34  bool operator !=(const CPVRChannelsPath& right) const { return !(*this == right); }
35 
36  bool IsValid() const { return m_kind > Kind::PROTO; }
37 
38  bool IsEmpty() const { return m_kind == Kind::EMPTY; }
39  bool IsChannelsRoot() const { return m_kind == Kind::ROOT; }
40  bool IsChannelGroup() const { return m_kind == Kind::GROUP; }
41  bool IsChannel() const { return m_kind == Kind::CHANNEL; }
42 
43  bool IsHiddenChannelGroup() const;
44 
45  bool IsRadio() const { return m_bRadio; }
46 
47  const std::string& GetGroupName() const { return m_group; }
48  const std::string& GetAddonID() const { return m_addonID; }
49  ADDON::AddonInstanceId GetInstanceID() const { return m_instanceID; }
50  int GetChannelUID() const { return m_iChannelUID; }
51 
52  private:
53  static std::string TrimSlashes(const std::string& strString);
54 
55  enum class Kind
56  {
57  INVALID,
58  PROTO,
59  EMPTY,
60  ROOT,
61  GROUP,
62  CHANNEL,
63  };
64 
65  Kind m_kind = Kind::INVALID;
66  bool m_bRadio = false;;
67  std::string m_path;
68  std::string m_group;
69  std::string m_addonID;
70  ADDON::AddonInstanceId m_instanceID{ADDON::ADDON_SINGLETON_INSTANCE_ID};
71  int m_iChannelUID = -1;
72  };
73 }
Definition: ContextMenuManager.h:24
Definition: PVRChannelsPath.h:17
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63