13 template<
class char_t>
22 template<
class char_t>
25 return string_view_iterator(value_type(
nullptr, 0), QX_TEXT(
'\0'), delimiter_inclusion_flags::none);
28 template<
class char_t>
34 template<
class char_t>
35 constexpr string_view_iterator<char_t>& string_view_iterator<char_t>::operator++() noexcept
41 template<
class char_t>
42 constexpr string_view_iterator<char_t> string_view_iterator<char_t>::operator++(
int)
const noexcept
44 string_view_iterator itResult(*
this);
49 template<
class char_t>
50 constexpr string_view_iterator<char_t>::string_view_iterator(
53 flags<delimiter_inclusion_flags> eDelimiterInclusionFlags) noexcept
55 , m_svCurrent(value_type(m_svFull.data(), 0))
56 , m_chDelimiter(chDelimiter)
57 , m_eDelimiterInclusionFlags(eDelimiterInclusionFlags)
61 template<
class char_t>
62 constexpr
void string_view_iterator<char_t>::next() noexcept
64 size_type nStart = m_svCurrent.data() - m_svFull.data() + m_svCurrent.size();
65 size_type nEnd = nStart;
67 auto set_start = [
this](size_type nStart)
69 m_svCurrent = value_type(
71 + (m_eDelimiterInclusionFlags.contains(delimiter_inclusion_flags::begin) && nStart != 0 ? nStart - 1
76 auto set_end = [
this](size_type nEnd)
78 m_svCurrent = value_type(
80 (m_eDelimiterInclusionFlags.contains(delimiter_inclusion_flags::end) ? nEnd + 1 : nEnd)
81 - (m_svCurrent.data() - m_svFull.data()));
84 while ((nEnd = m_svFull.find(m_chDelimiter, nStart)) != value_type::npos)
94 while (nStart < m_svFull.size() && m_svFull[nStart] == m_chDelimiter)
98 if (nStart != m_svFull.size())
101 m_svCurrent = value_type(m_svCurrent.data(), m_svFull.size() - (m_svCurrent.data() - m_svFull.data()));
Iterator class that allows to iterate over a string view using a delimiter character.
static constexpr string_view_iterator begin(value_type svFull, char_t chDelimiter, flags< delimiter_inclusion_flags > eDelimiterInclusionFlags=delimiter_inclusion_flags::none)
Return iterator to beginning.
static constexpr string_view_iterator end()
Return iterator to end.