| 1 |
/* |
| 2 |
* Copyright (C) 2017-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 |
#include "PVRChannelNumber.h" |
| 10 |
|
| 11 |
#include "utils/StringUtils.h" |
| 12 |
|
| 13 |
using namespace PVR; |
| 14 |
|
| 15 |
const char CPVRChannelNumber::SEPARATOR = '.'; |
| 16 |
|
| 17 |
std::string CPVRChannelNumber::FormattedChannelNumber() const |
| 18 |
{ |
| 19 |
return ToString(SEPARATOR); |
| 20 |
} |
| 21 |
|
| 22 |
std::string CPVRChannelNumber::SortableChannelNumber() const |
| 23 |
{ |
| 24 |
// Note: The subchannel separator is a character that does not work for a |
| 25 |
// SortItem (at least not on all platforms). See SortUtils::Sort for |
| 26 |
// details. Only numbers, letters and the blank are safe to use. |
| 27 |
return ToString(' '); |
| 28 |
} |
| 29 |
|
| 30 |
std::string CPVRChannelNumber::ToString(char separator) const |
| 31 |
{ |
| 32 |
if (m_iSubChannelNumber == 0) |
| 33 |
return std::to_string(m_iChannelNumber); |
| 34 |
else |
| 35 |
return StringUtils::Format("{}{}{}", m_iChannelNumber, separator, m_iSubChannelNumber); |
| 36 |
} |