qb
2.0.0.0
C++17 Actor Framework
|
Input stream template class. More...
#include <stream.h>
Public Types | |
using | transport_io_type = _IO_ |
Type of the underlying transport IO. | |
using | input_buffer_type = qb::allocator::pipe<char> |
Type of the input buffer. |
Public Member Functions | |
~istream () noexcept | |
Destructor. | |
_IO_ & | transport () noexcept |
Get the underlying transport object. | |
const _IO_ & | transport () const noexcept |
Get the underlying transport object (const version) | |
input_buffer_type & | in () noexcept |
Get the input buffer. | |
std::size_t | pendingRead () const noexcept |
Get the number of bytes available for reading. | |
template<typename Available = void> | |
int | read (std::enable_if_t< has_method_read< _IO_, int, char *, std::size_t >::value, Available > *=nullptr) noexcept |
Read data from the transport into the input buffer. | |
void | flush (std::size_t size) noexcept |
Remove data from the front of the input buffer. | |
void | eof () noexcept |
Handle end-of-file condition. | |
void | close () noexcept |
Close the stream. |
Protected Attributes | |
_IO_ | _in |
The underlying IO object. | |
input_buffer_type | _in_buffer |
Buffer for incoming data. |
Input stream template class.
This template class provides input stream functionality for various transport implementations. It manages an input buffer and provides methods for reading data from the underlying IO object into the buffer.
_IO_ | The IO type that implements the actual transport operations |
|
inlinenoexcept |
Destructor.
Ensures that the stream is closed properly when destroyed.
|
inlinenodiscardnoexcept |
Get the underlying transport object.
|
inlinenodiscardnoexcept |
Get the underlying transport object (const version)
|
inlinenodiscardnoexcept |
Get the input buffer.
|
inlinenodiscardnoexcept |
Get the number of bytes available for reading.
|
inlinenodiscardnoexcept |
Read data from the transport into the input buffer.
This method is enabled only if the IO type has a compatible read method. It reads data in fixed-size chunks and adjusts the buffer size based on the actual number of bytes read.
|
inlinenoexcept |
Remove data from the front of the input buffer.
size | Number of bytes to remove |
This method is typically called after processing data from the input buffer to free up space.
|
inlinenoexcept |
Handle end-of-file condition.
Resets or reorders the input buffer based on whether it contains data.
|
inlinenoexcept |
Close the stream.
Resets the input buffer and closes or disconnects the underlying transport, depending on the available methods.