#include <serialise.hh>
Public Member Functions | |
FramedSource (Source &from) | |
size_t | read (char *data, size_t len) override |
![]() | |
void | operator() (char *data, size_t len) |
void | operator() (std::string_view data) |
virtual bool | good () |
void | drainInto (Sink &sink) |
std::string | drain () |
Public Attributes | |
Source & | from |
bool | eof = false |
std::vector< char > | pending |
size_t | pos = 0 |
A source that reads a distinct format of concatenated chunks back into its logical form, in order to guarantee a known state to the original stream, even in the event of errors.
Use with FramedSink, which also allows the logical stream to be terminated in the event of an exception.
Store up to ‘len’ in the buffer pointed to by ‘data’, and return the number of bytes stored. It blocks until at least one byte is available.
Implements nix::Source.