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> 24 template <
typename StringType = std::
string, Traits::EnableIfAny<Traits::IsSpecializationOf<StringType, std::basic_
string>>...>
27 constexpr int32 position()
const;
28 constexpr int32 total()
const;
29 constexpr
bool isNull()
const;
32 template <
typename StringType = std::
string, Traits::EnableIfAny<Traits::IsSpecializationOf<StringType, std::basic_
string>>...>
33 StringType toString()
const;
46 template <
typename StringType, Traits::EnableIfAny<Traits::IsSpecializationOf<StringType, std::basic_
string>>...>
51 const auto separator = numericString.find(
'/');
52 if (separator == StringType::npos || separator == numericString.length() - 1) {
53 m_position = ConversionUtilities::stringToNumber<int32, StringType>(numericString);
54 }
else if (separator == 0) {
55 m_total = ConversionUtilities::stringToNumber<int32, StringType>(numericString.substr(1));
57 m_position = ConversionUtilities::stringToNumber<int32, StringType>(numericString.substr(0, separator));
58 m_total = ConversionUtilities::stringToNumber<int32, StringType>(numericString.substr(separator + 1));
68 : m_position(position)
94 return m_position == 0 && m_total == 0;
102 return m_position == other.m_position && m_total == other.m_total;
108 template <
typename StringType, Traits::EnableIfAny<Traits::IsSpecializationOf<StringType, std::basic_
string>>...>
111 std::basic_stringstream<typename StringType::value_type> ss;
116 ss <<
'/' << m_total;
123 #endif // TAG_PARSER_POSITIONINSET_H StringType toString() const
Returns the string representation of the current PositionInSet.
constexpr int32 position() const
Returns the element position of the current instance.
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
constexpr int32 total() const
Returns the total element count of the current instance.
constexpr PositionInSet(int32 position=0, int32 total=0)
Constructs a new Position in set of the specified element position and total element count...
constexpr bool isNull() const
Returns an indication whether both the element position and total element count is 0...
constexpr bool operator==(const PositionInSet &other) const
Returns whether this instance equals other.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.