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
|
/*
* Copyright (C) 2012-2018 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 "addons/IAddon.h"
class CDateTime;
namespace PVR
{
class CPVRChannelsPath
{
public:
static const std::string PATH_TV_CHANNELS;
static const std::string PATH_RADIO_CHANNELS;
explicit CPVRChannelsPath(const std::string& strPath);
CPVRChannelsPath(bool bRadio, const std::string& strGroupName);
CPVRChannelsPath(bool bRadio, bool bHidden, const std::string& strGroupName);
CPVRChannelsPath(bool bRadio,
const std::string& strGroupName,
const std::string& strAddonID,
ADDON::AddonInstanceId instanceID,
int iChannelUID);
operator std::string() const { return m_path; }
bool operator ==(const CPVRChannelsPath& right) const { return m_path == right.m_path; }
bool operator !=(const CPVRChannelsPath& right) const { return !(*this == right); }
bool IsValid() const { return m_kind > Kind::PROTO; }
bool IsEmpty() const { return m_kind == Kind::EMPTY; }
bool IsChannelsRoot() const { return m_kind == Kind::ROOT; }
bool IsChannelGroup() const { return m_kind == Kind::GROUP; }
bool IsChannel() const { return m_kind == Kind::CHANNEL; }
bool IsHiddenChannelGroup() const;
bool IsRadio() const { return m_bRadio; }
const std::string& GetGroupName() const { return m_group; }
const std::string& GetAddonID() const { return m_addonID; }
ADDON::AddonInstanceId GetInstanceID() const { return m_instanceID; }
int GetChannelUID() const { return m_iChannelUID; }
private:
static std::string TrimSlashes(const std::string& strString);
enum class Kind
{
INVALID,
PROTO,
EMPTY,
ROOT,
GROUP,
CHANNEL,
};
Kind m_kind = Kind::INVALID;
bool m_bRadio = false;;
std::string m_path;
std::string m_group;
std::string m_addonID;
ADDON::AddonInstanceId m_instanceID{ADDON::ADDON_SINGLETON_INSTANCE_ID};
int m_iChannelUID = -1;
};
}
|