StormByte-Buffer 4.0.0
C++26 buffer module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Buffer::PipeInput Class Referencefinal

Synchronous, non-owning stage input borrow. More...

#include <StormByte/buffer/pipe.hxx>

Public Member Functions

 PipeInput (ReadOnly &input) noexcept
 Borrow a live stream input.
bool Read (const StormByte::ByteSize &count, StormByte::Safe::Binary &data) const noexcept
 Read bytes and advance the borrowed cursor.
bool EoF () const noexcept
 Query the end of the borrowed stream.
StormByte::ByteSize Available () const noexcept
 Query readable bytes.
bool IsReadable () const noexcept
 Query the borrowed stream error state.

Detailed Description

Synchronous, non-owning stage input borrow.

Warning
Neither this facade nor its copies may outlive the callback. The underlying buffer and its provider must remain alive throughout it.

Constructor & Destructor Documentation

◆ PipeInput()

StormByte::Buffer::PipeInput::PipeInput ( ReadOnly & input)
explicitnoexcept

Borrow a live stream input.

Parameters
inputBuffer kept alive by the caller for the whole invocation.

Member Function Documentation

◆ Available()

StormByte::ByteSize StormByte::Buffer::PipeInput::Available ( ) const
noexcept

Query readable bytes.

Returns
Available byte count.

◆ EoF()

bool StormByte::Buffer::PipeInput::EoF ( ) const
noexcept

Query the end of the borrowed stream.

Returns
Whether no more bytes can be read.

◆ IsReadable()

bool StormByte::Buffer::PipeInput::IsReadable ( ) const
noexcept

Query the borrowed stream error state.

Returns
Whether the stream can still be read.

◆ Read()

bool StormByte::Buffer::PipeInput::Read ( const StormByte::ByteSize & count,
StormByte::Safe::Binary & data ) const
noexcept

Read bytes and advance the borrowed cursor.

Parameters
countBytes to read. Zero reads all available bytes.
dataDestination bytes.
Returns
Whether the read succeeded.

The documentation for this class was generated from the following file: