|
output_buffer_type & | out () noexcept |
| Get the output buffer.
|
std::size_t | pendingWrite () const noexcept |
| Get the number of bytes pending for writing.
|
template<typename Available = void> |
int | write (std::enable_if_t< has_method_write< _IO_, int, const char *, std::size_t >::value, Available > *=nullptr) noexcept |
| Write data from the output buffer to the transport.
|
char * | publish (char const *data, std::size_t size) noexcept |
| Add data to the output buffer for later writing.
|
void | close () noexcept |
| Close the stream.
|
| ~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.
|
template<typename _IO_>
class qb::io::stream< _IO_ >
Combined input/output stream template class.
This template class provides both input and output stream functionality for various transport implementations. It inherits from istream for input operations and adds output buffer management and writing methods.
This is the primary base class for most transport implementations in the library.
- Template Parameters
-
_IO_ | The IO type that implements the actual transport operations |
template<typename _IO_>
template<typename Available = void>
int qb::io::stream< _IO_ >::write |
( |
std::enable_if_t< has_method_write< _IO_, int, const char *, std::size_t >::value, Available > * | = nullptr | ) |
|
|
inlinenodiscardnoexcept |
Write data from the output buffer to the transport.
- Returns
- Number of bytes written on success, error code on failure
This method is enabled only if the IO type has a compatible write method. It writes the entire buffer content and adjusts or resets the buffer based on the actual number of bytes written.
Note that this implementation uses the input IO object (_in) for writing, which is suitable for bidirectional transports like sockets.