byteme
C++ wrappers for buffered inputs
|
Read bytes from a std::istream
.
More...
#include <IstreamReader.hpp>
Public Member Functions | |
IstreamReader (Pointer_ input, const IstreamReaderOptions &options) | |
bool | load () |
const unsigned char * | buffer () const |
std::size_t | available () const |
![]() |
Read bytes from a std::istream
.
Pointer_ | Pointer to a class providing an input stream of bytes, satisfying the std::istream interface. This is most typically a std::unique_ptr<std::istream> > but a concrete subclass may also be used to encourage compiler devirtualization. Either a raw or smart pointer may be used depending on how the lifetime of the pointed-to object is managed. |
This is just a wrapper around std::istream::read
, mostly to avoid having to remember the correct way to check for end of file.
|
inline |
input | Pointer to an input stream. |
options | Further options. |
|
inlinevirtual |
This method should only be called after load()
has been called and returns true
. The return value is generally expected to be positive; however, it is possible to return a zero. Note that zero values should not be interpreted as the end of the source, which is strictly only defined by load()
returning false
.
buffer()
. Implements byteme::Reader.
|
inlinevirtual |
This method should only be called after load()
has been called and returns true
.
available()
. Implements byteme::Reader.
|
inlinevirtual |
Read the next chunk of bytes from the input source. To read the entire source, this function should be called repeatedly until false
is returned. After returning false
once, the behavior of subsequent calls is undefined.
false
, it can be assumed that the end of the source was reached. Implements byteme::Reader.