1 #ifndef TAG_PARSER_POSITIONINSET_H
2 #define TAG_PARSER_POSITIONINSET_H
6 #include <c++utilities/conversion/stringconversion.h>
7 #include <c++utilities/misc/traits.h>
23 constexpr
explicit PositionInSet(std::int32_t position = 0, std::int32_t total = 0);
24 template <
typename StringType = std::string,
25 CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_string>> * =
nullptr>
28 constexpr std::int32_t position()
const;
29 constexpr std::int32_t total()
const;
30 constexpr
bool isNull()
const;
33 template <
typename StringType = std::string,
34 CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_string>> * =
nullptr>
35 StringType toString()
const;
38 std::int32_t m_position;
48 template <
typename StringType, CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_
string>> *>
53 const auto separator = numericString.find(
'/');
54 if (separator == StringType::npos || separator == numericString.length() - 1) {
55 m_position = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString);
56 }
else if (separator == 0) {
57 m_total = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString.substr(1));
59 m_position = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString.substr(0, separator));
60 m_total = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString.substr(separator + 1));
70 : m_position(position)
96 return m_position == 0 && m_total == 0;
104 return m_position == other.m_position && m_total == other.m_total;
110 template <
typename StringType, CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_
string>> *>
113 std::basic_stringstream<typename StringType::value_type> ss;
118 ss <<
'/' << m_total;
The PositionInSet class describes the position of an element in a set which consists of a certain num...
constexpr bool operator==(const PositionInSet &other) const
Returns whether this instance equals other.
constexpr std::int32_t position() const
Returns the element position of the current instance.
constexpr std::int32_t total() const
Returns the total element count of the current instance.
constexpr PositionInSet(std::int32_t position=0, std::int32_t total=0)
Constructs a new Position in set of the specified element position and total element count.
StringType toString() const
Returns the string representation of the current PositionInSet.
constexpr bool isNull() const
Returns an indication whether both the element position and total element count is 0.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
constexpr bool operator==(std::uint8_t lhs, FlacMetaDataBlockType type)