Buffer that can be read and not written. More...
#include <StormByte/buffer/generic.hxx>


Public Member Functions | |
Lifecycle | |
| ReadOnly () noexcept | |
| Default constructor. | |
| ReadOnly (const ReadOnly &other) noexcept=default | |
| Copy constructor. | |
| ReadOnly (ReadOnly &&other) noexcept=default | |
| Move constructor. | |
| virtual | ~ReadOnly () noexcept |
| Destructor. | |
| ReadOnly & | operator= (const ReadOnly &other)=default |
| Copy assignment. | |
| ReadOnly & | operator= (ReadOnly &&other) noexcept=default |
| Move assignment. | |
Queries | |
| virtual StormByte::ByteSize | Available () const noexcept=0 |
| Bytes available from the current read position. | |
| virtual const BinaryData & | Data () const noexcept=0 |
| View of internal storage. | |
| virtual bool | Empty () const noexcept=0 |
| Whether the store holds no bytes. | |
| virtual bool | EoF () const noexcept=0 |
| End of stream. | |
| virtual bool | IsReadable () const noexcept=0 |
| Whether the buffer can still be read. | |
Maintenance | |
| virtual void | Clean () noexcept=0 |
| Drop bytes from the start up to the current read position. | |
| virtual void | Clear () noexcept=0 |
| Clear stored bytes and reset logical positions. | |
| virtual bool | Drop (const StormByte::ByteSize &count) noexcept=0 |
Discard count unread bytes. | |
| virtual void | Seek (const std::ptrdiff_t &offset, const Position &mode) const noexcept=0 |
| Move the logical read position. | |
Extract | |
| virtual bool | Extract (const StormByte::ByteSize &count, StormByte::BinaryData &outBuffer) noexcept=0 |
| Extract bytes into a StormByte::BinaryData. | |
| bool | Extract (StormByte::BinaryData &outBuffer) noexcept |
| Extract all available bytes into a StormByte::BinaryData. | |
| virtual bool | Extract (const StormByte::ByteSize &count, WriteOnly &outBuffer) noexcept=0 |
| Extract bytes into a WriteOnly. | |
| bool | Extract (WriteOnly &outBuffer) noexcept |
| Extract all available bytes into a WriteOnly. | |
| virtual void | ExtractUntilEoF (StormByte::BinaryData &outBuffer) noexcept=0 |
| Extract until EoF into a StormByte::BinaryData. | |
| virtual void | ExtractUntilEoF (WriteOnly &outBuffer) noexcept=0 |
| Extract until EoF into a WriteOnly. | |
Peek | |
| virtual bool | Peek (const StormByte::ByteSize &count, StormByte::BinaryData &outBuffer) const noexcept=0 |
| Peek into a StormByte::BinaryData. | |
| virtual bool | Peek (const StormByte::ByteSize &count, WriteOnly &outBuffer) const noexcept=0 |
| Peek into a WriteOnly. | |
Read | |
| virtual bool | Read (const StormByte::ByteSize &count, StormByte::BinaryData &outBuffer) const noexcept=0 |
| Read into a StormByte::BinaryData. | |
| bool | Read (StormByte::BinaryData &outBuffer) const noexcept |
| Read all available bytes into a StormByte::BinaryData. | |
| virtual bool | Read (const StormByte::ByteSize &count, WriteOnly &outBuffer) const noexcept=0 |
| Read into a WriteOnly. | |
| bool | Read (WriteOnly &outBuffer) const noexcept |
| Read all available bytes into a WriteOnly. | |
| virtual void | ReadUntilEoF (StormByte::BinaryData &outBuffer) const noexcept=0 |
| Read until EoF into a StormByte::BinaryData. | |
| virtual void | ReadUntilEoF (WriteOnly &outBuffer) const noexcept=0 |
| Read until EoF into a WriteOnly. | |
Public Member Functions inherited from StormByte::Buffer::Generic | |
| Generic () noexcept=default | |
| Default constructor. | |
| Generic (const Generic &other) noexcept=default | |
| Copy constructor. | |
| Generic (Generic &&other) noexcept=default | |
| Move constructor. | |
| virtual | ~Generic () noexcept=0 |
| Pure virtual destructor. | |
| Generic & | operator= (const Generic &other)=default |
| Copy assignment. | |
| Generic & | operator= (Generic &&other) noexcept=default |
| Move assignment. | |
| virtual StormByte::ByteSize | Size () const noexcept=0 |
| Total number of bytes stored. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from StormByte::Buffer::Generic | |
| template<Type::ByteInputRange Src> | |
| static BinaryData | DataConvert (const Src &src) noexcept |
| Convert an lvalue input range to StormByte::BinaryData. | |
| template<Type::ByteInputRange Src> | |
| static BinaryData | DataConvert (Src &&src) noexcept |
| Convert an rvalue input range to StormByte::BinaryData. | |
| static BinaryData | DataConvert (std::string_view sv) noexcept |
| Convert a string view to StormByte::BinaryData. | |
| static BinaryData | DataConvert (const char *s) noexcept |
| Convert a C string to StormByte::BinaryData. | |
Buffer that can be read and not written.
Read, extract, peek and seek. Occupancy is Generic::Size.
|
inlinenoexcept |
Default constructor.
|
defaultnoexcept |
Copy constructor.
| other | Instance to copy. |
|
defaultnoexcept |
Move constructor.
| other | Instance to take from. |
|
virtualnoexcept |
Destructor.
|
pure virtualnoexcept |
Bytes available from the current read position.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Drop bytes from the start up to the current read position.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Clear stored bytes and reset logical positions.
Closed and error flags are implementation-defined.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
View of internal storage.
Implementation-defined.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Discard count unread bytes.
| count | Bytes to drop. |
false if fewer bytes were available. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Whether the store holds no bytes.
true if empty. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
End of stream.
true when closed or failed and nothing remains to read. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
inlinepure virtualnoexcept |
Extract bytes into a StormByte::BinaryData.
| count | Bytes to extract. 0 = all available. |
| outBuffer | Destination. |
false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
inlinepure virtualnoexcept |
Extract bytes into a WriteOnly.
| count | Bytes to extract. 0 = all available. |
| outBuffer | Destination writer. |
false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
inlinenoexcept |
Extract all available bytes into a StormByte::BinaryData.
| outBuffer | Destination. |
false on failure.
|
inlinenoexcept |
Extract all available bytes into a WriteOnly.
| outBuffer | Destination writer. |
false on failure.
|
pure virtualnoexcept |
Extract until EoF into a StormByte::BinaryData.
| outBuffer | Destination. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Extract until EoF into a WriteOnly.
| outBuffer | Destination writer. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Whether the buffer can still be read.
false in a permanent error state. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
Copy assignment.
| other | Instance to copy. |
Move assignment.
| other | Instance to take from. |
|
pure virtualnoexcept |
Peek into a StormByte::BinaryData.
Does not advance the cursor.
| count | Bytes to peek. 0 = all available (fails if none). Greater than 0: exactly that many bytes, or fail. |
| outBuffer | Destination. |
false if insufficient data or error. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Peek into a WriteOnly.
Does not advance the cursor.
| count | Same semantics as the StormByte::BinaryData overload. |
| outBuffer | Destination writer. |
false if insufficient data or error. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Read into a StormByte::BinaryData.
Advances the cursor.
| count | Bytes to read. 0 = all available. |
| outBuffer | Destination. |
false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
pure virtualnoexcept |
Read into a WriteOnly.
Advances the cursor.
| count | Bytes to read. 0 = all available. |
| outBuffer | Destination writer. |
false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
inlinenoexcept |
Read all available bytes into a StormByte::BinaryData.
| outBuffer | Destination. |
false on failure.
|
inlinenoexcept |
Read all available bytes into a WriteOnly.
| outBuffer | Destination writer. |
false on failure.
|
pure virtualnoexcept |
Read until EoF into a StormByte::BinaryData.
| outBuffer | Destination. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Read until EoF into a WriteOnly.
| outBuffer | Destination writer. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Move the logical read position.
| offset | Offset. |
| mode | Position::Absolute or Position::Relative. |
Clamped to [0, Size()]. Absolute + negative offset is a no-op.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.