dodo
0.0.1
A C++ library to create containerized Linux services
|
String based VirtualReadBuffer, conventient for testing purposes as parsers can be tested against strings instead of network sources. More...
#include <socketreadbuffer.hpp>
Public Member Functions | |
StringReadBuffer (const std::string &data) | |
Construct a FileReadBuffer. More... | |
virtual char | get () const |
Get the current char from VirtualReadBuffer. More... | |
virtual common::SystemError | next () |
Move to the next char from the VirtualReadBuffer. More... | |
![]() | |
size_t | getUnderflowCount () const |
Return the number of times underflow() was invoked. More... | |
Protected Member Functions | |
virtual common::SystemError | underflow () |
If the buffer_ underflows, the buffer_ must be reset refilledwith new data from the source. More... | |
Protected Attributes | |
std::string | data_ |
The string data backing the buffer. More... | |
size_t | idx_ |
The current index into the string buffer. More... | |
![]() | |
char * | buffer_ |
The buffer. More... | |
ssize_t | bufsize_ |
The size of buffer_. More... | |
size_t | underflows_ |
The number underflow() invocations. More... | |
String based VirtualReadBuffer, conventient for testing purposes as parsers can be tested against strings instead of network sources.
Definition at line 185 of file socketreadbuffer.hpp.
|
inlineexplicit |
Construct a FileReadBuffer.
data | The string data |
Definition at line 192 of file socketreadbuffer.hpp.
|
inlinevirtual |
Get the current char from VirtualReadBuffer.
Implements dodo::network::VirtualReadBuffer.
Definition at line 196 of file socketreadbuffer.hpp.
|
inlinevirtual |
Move to the next char from the VirtualReadBuffer.
Note that call will return a SystemError::ecEAGAIN if there is no more data (received within the prevailing timeout).
Implements dodo::network::VirtualReadBuffer.
Definition at line 198 of file socketreadbuffer.hpp.
References data_, dodo::common::SystemError::ecEAGAIN, dodo::common::SystemError::ecOK, and idx_.
|
inlineprotectedvirtual |
If the buffer_ underflows, the buffer_ must be reset refilledwith new data from the source.
Implements dodo::network::VirtualReadBuffer.
Definition at line 202 of file socketreadbuffer.hpp.
References dodo::common::SystemError::ecOK.
|
protected |
The string data backing the buffer.
Definition at line 202 of file socketreadbuffer.hpp.
Referenced by get(), next(), and StringReadBuffer().
|
protected |
The current index into the string buffer.
Definition at line 212 of file socketreadbuffer.hpp.
Referenced by get(), next(), and StringReadBuffer().