1#ifndef QX_STRINGTRAVERSER_H
2#define QX_STRINGTRAVERSER_H
14 requires traverseable<T>
19 typename T::const_iterator mIterator;
20 typename T::const_iterator mStart;
21 typename T::const_iterator mEnd;
31 mIndex(mIterator == mEnd ? -1 : 0),
40 if(mIndex + count > mLastIndex)
52 if(mIndex - count < 0)
61 bool atEnd()
const {
return mIterator == mEnd; }
63 std::iter_value_t<typename T::const_iterator>
currentValue()
const {
return *mIterator; }
66 std::iter_value_t<typename T::const_iterator>
lookAhead(quint32 count = 1)
const
69 return (mIndex + count > mLastIndex) ? std::iter_value_t<T>() : *(mIterator + count);
72 std::iter_value_t<typename T::const_iterator>
lookBehind(quint32 count = 1)
const
75 return (mIndex - count < mLastIndex) ? std::iter_value_t<T>() : *(mIterator - count);
The Traverser template class provides a const_iterator wrapper for an alternate approach to iterating...
Definition qx-traverser.h:16
std::iter_value_t< typename T::const_iterator > lookBehind(quint32 count=1) const
Definition qx-traverser.h:72
void advance(quint32 count=1)
Definition qx-traverser.h:37
bool atEnd() const
Definition qx-traverser.h:61
quint32 currentIndex() const
Definition qx-traverser.h:64
void retreat(quint32 count=1)
Definition qx-traverser.h:49
Traverser(const T &traverseable)
Definition qx-traverser.h:27
std::iter_value_t< typename T::const_iterator > currentValue() const
Definition qx-traverser.h:63
std::iter_value_t< typename T::const_iterator > lookAhead(quint32 count=1) const
Definition qx-traverser.h:66
Specifies that a type is a valid type for Qx::Traverser.
Definition qx-concepts.h:503
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5
Traverser< QString > StringTraverser
Definition qx-traverser.h:79
The qx-concepts header file provides a library of general purpose concepts as an extension of the sta...