![]() |
Spicy
|
#include <stream.h>
Public Types | |
using | Byte = stream::Byte |
using | Chain = stream::detail::Chain |
using | ConstChainPtr = stream::detail::ConstChainPtr |
using | Chunk = stream::detail::Chunk |
using | Offset = stream::Offset |
using | Size = stream::Size |
using | UnsafeConstIterator = stream::detail::UnsafeConstIterator |
Public Member Functions | |
SafeConstIterator ()=default | |
SafeConstIterator (const UnsafeConstIterator &i) | |
Offset | offset () const |
bool | isFrozen () const |
auto & | operator++ () |
auto | operator++ (int) |
auto & | operator+= (const integer::safe< uint64_t > &i) |
auto & | operator-- () |
auto | operator-- (int) |
auto & | operator-= (const integer::safe< uint64_t > &i) |
auto | operator* () const |
auto | operator+ (const integer::safe< uint64_t > &i) const |
auto | operator- (const integer::safe< uint64_t > &i) const |
integer::safe< int64_t > | operator- (const SafeConstIterator &other) const |
bool | operator== (const SafeConstIterator &other) const |
bool | operator!= (const SafeConstIterator &other) const |
bool | operator< (const SafeConstIterator &other) const |
bool | operator<= (const SafeConstIterator &other) const |
bool | operator> (const SafeConstIterator &other) const |
bool | operator>= (const SafeConstIterator &other) const |
operator bool () const | |
std::ostream & | operator<< (std::ostream &out) const |
bool | isUnset () const |
bool | isExpired () const |
bool | isValid () const |
bool | isEnd () const |
void | debugPrint (std::ostream &out) const |
Protected Member Functions | |
const Chunk * | chunk () const |
const Chain * | chain () const |
Friends | |
class | hilti::rt::stream::View |
class | hilti::rt::stream::detail::Chain |
class | hilti::rt::stream::detail::UnsafeConstIterator |
SafeConstIterator for traversing the content of a stream instance.
Unlike the STL-style iterators, this iterator protects against the stream instance being no longer available by throwing an InvalidIterator
exception if it's still accessed. It will also catch attempts to dereference iterators that remain outside of the current valid range of the underlying stream. However, operations that only query/manipulate offsets will succeed even for out-of-range positions. That includes advancing an iterator beyond the end of a stream, which is well-defined: if the stream gets expanded later, the iterator will refer to any data ending up at the iterator's position now.
|
default |
Constructor.
|
inlineexplicit |
Constructor.
void SafeConstIterator::debugPrint | ( | std::ostream & | out | ) | const |
Prints out a debug rendering to the iterator's internal representation.
|
inline |
Returns true if the iterator is at or beyond the current end of the underlying stream instance. Also generally returns true for an unbound iterator.
|
inline |
Returns true if the iterator was once valid but the underlying bytes instance has by now expired.
|
inline |
Returns true if the stream instance that the iterator is bound to has been frozen.
|
inline |
Returns true if the iterator remains unbound.
|
inline |
Returns true if the iterator is bound to a stream object and that's not expired yet.
|
inline |
Returns the offset inside the stream that the iterator represents.
|
inlineexplicit |
Returns true if the iterator is bound to a stream instance, even if expired.
|
inline |
Returns true if another iterator bound to the same stream instance does not refer to the same location. The result is undefined if the iterators aren't referring to the same stream instance.
|
inline |
Returns the character at the iterator's position.
|
inline |
Return a new iterator advanced by a given number of bytes.
|
inline |
Advances the iterator by one byte.
|
inline |
Advances the iterator by one byte.
|
inline |
Advances the iterator by a given number of stream.
|
inline |
Returns a new iterator moved back by a given number of bytes.
|
inline |
Return the size of the range defined by the two iterators. The result will be negative if the instance's location comes before the argument's location.
|
inline |
Moves back the iterator by one byte.
|
inline |
Moves back the iterator by one byte.
|
inline |
Moves back the iterator by a given number of stream.
|
inline |
Compares the offset of two iterators referring to the same stream instance.
|
inline |
Compares the offset of two iterators referring to the same stream instance.
|
inline |
Returns true if another iterator bound to the same stream instance refers to the same location. The result is undefined if the iterators aren't referring to the same stream instance.
|
inline |
Compares the offset of two iterators referring to the same stream instance.
|
inline |
Compares the offset of two iterators referring to the same stream instance.