byteme
C++ wrappers for buffered inputs
|
Serial byte-by-byte extraction from a Reader
source.
More...
#include <PerByte.hpp>
Public Member Functions | |
PerByteSerial (Pointer_ reader) | |
![]() | |
bool | advance () |
Type_ | get () const |
unsigned long long | position () const |
bool | valid () const |
std::pair< std::size_t, bool > | extract (std::size_t number, Type_ *output) |
std::size_t | advance_and_extract (std::size_t number, Type_ *output) |
Protected Member Functions | |
void | refill () |
![]() |
Additional Inherited Members | |
![]() | |
const Type_ * | ptr = nullptr |
std::size_t | available = 0 |
Serial byte-by-byte extraction from a Reader
source.
Type_ | Type of the output bytes, usually char for text or unsigned char for binary. |
Pointer_ | Pointer to a class that serves as a source of input bytes. The pointed-to class should satisfy the Reader interface; it may also be a concrete Reader subclass to enable devirtualization. Either a smart or raw pointer may be supplied depending on how the caller wants to manage the lifetime of the pointed-to object. |
This wraps a Reader
so that developers can avoid the boilerplate of managing blocks of bytes, when all they want is to iterate over the bytes of the input.
|
inline |
reader | Pointer to a source of input bytes. It is assumed that Reader::load() has not previously returned false . |
|
inlineprotectedvirtual |
Set ptr
and available
to refer to an array of new bytes from a Reader
. Implementations may assume that Reader::load()
has not previously returned false
.
Implements byteme::PerByteInterface< Type_ >.