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 void setPosition(std::int32_t position);
30 constexpr std::int32_t total()
const;
31 void setTotal(std::int32_t total);
32 constexpr bool isNull()
const;
33 constexpr bool operator==(
const PositionInSet &other)
const;
35 template <
typename StringType = std::string,
36 CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_string>> * =
nullptr>
37 StringType toString()
const;
40 std::int32_t m_position;
50template <
typename StringType, CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_
string>> *>
55 const auto separator = numericString.find(
'/');
56 if (separator == StringType::npos || separator == numericString.length() - 1) {
57 m_position = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString);
58 }
else if (separator == 0) {
59 m_total = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString.substr(1));
61 m_position = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString.substr(0, separator));
62 m_total = CppUtilities::stringToNumber<std::int32_t, StringType>(numericString.substr(separator + 1));
72 : m_position(position)
114 return m_position == 0 && m_total == 0;
122 return m_position == other.m_position && m_total == other.m_total;
128template <
typename StringType, CppUtilities::Traits::EnableIfAny<CppUtilities::Traits::IsSpecializationOf<StringType, std::basic_
string>> *>
131 std::basic_stringstream<typename StringType::value_type> ss;
136 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.
void setTotal(std::int32_t total)
Sets the total element count of the current instance.
constexpr std::int32_t position() const
Returns the element position of the current instance.
void setPosition(std::int32_t position)
Sets 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)