95 : m_buffer(data), m_position_offset(0) {}
102 : m_buffer(std::move(data)), m_position_offset(0) {}
110 template<Type::ByteInputRange R>
112 inline FIFO(
const R& r) noexcept
113 : m_buffer(DataConvert(r)), m_position_offset(0) {}
120 template<Type::ByteInputRange Rr>
122 : m_buffer(DataConvert(std::forward<Rr>(r))), m_position_offset(0) {}
128 inline FIFO(std::string_view sv) noexcept
129 : m_buffer(DataConvert(sv)), m_position_offset(0) {}
135 inline FIFO(
const char* s) noexcept
136 :
FIFO(s ? std::string_view(s) :
std::string_view()) {}
181 inline
bool operator==(const
FIFO& other) const noexcept {
182 return m_buffer == other.
m_buffer &&
183 m_position_offset == other.m_position_offset &&
184 m_closed == other.m_closed &&
185 m_error == other.m_error;
194 return !(*
this == other);
224 virtual
bool Empty() const noexcept override;
230 virtual
bool EoF() const noexcept override;
236 virtual
bool IsReadable() const noexcept override;
242 virtual
bool IsWritable() const noexcept override;
261 virtual
void Clean() noexcept override;
268 virtual
void Clear() noexcept override;
275 void Close() noexcept override;
291 virtual
void Seek(const
std::ptrdiff_t& offset, const
Position& mode) const noexcept override;
296 void SetError() noexcept override;
334 void ExtractUntilEoF(
WriteOnly& outBuffer) noexcept override;
372 void ReadUntilEoF(
WriteOnly& outBuffer) const noexcept override;
468 bool m_closed {
false};
469 bool m_error {
false};
Byte-oriented FIFO buffer with grow-on-demand and close/error support.
Definition fifo.hxx:78
virtual std::ostringstream HexDumpHeader() const noexcept
Build the hexdump header (size / position / status).
FIFO(FIFO &&other) noexcept
Move construct.
virtual ~FIFO() noexcept
Virtual destructor.
FIFO(std::string_view sv) noexcept
Construct FIFO from a string view (no trailing NUL).
Definition fifo.hxx:128
FIFO(const FIFO &other) noexcept
Copy construct, preserving buffer contents and state.
FIFO(StormByte::BinaryData &&data) noexcept
Construct FIFO with initial data (move).
Definition fifo.hxx:101
static StormByte::String::String FormatHexLines(std::span< const std::byte > &data, StormByte::ByteSize start_offset, StormByte::ByteSize columns) noexcept
Format hex/ASCII lines for a data span.
virtual StormByte::ByteSize Available() const noexcept override
Bytes available from the current read position.
FIFO() noexcept=default
Default construct an empty FIFO.
StormByte::BinaryData m_buffer
Owned contiguous byte storage.
Definition fifo.hxx:466
FIFO(Rr &&r) noexcept
Construct FIFO from an rvalue range (moves when StormByte::BinaryData).
Definition fifo.hxx:121
FIFO(const R &r) noexcept
Construct FIFO from an input range (copy / convert).
Definition fifo.hxx:112
Operation
Kind of internal read operation.
Definition fifo.hxx:474
bool operator!=(const FIFO &other) const noexcept
Inequality comparison.
Definition fifo.hxx:193
FIFO(const char *s) noexcept
Construct FIFO from a null-terminated C string.
Definition fifo.hxx:135
Buffer that can be read and not written.
Definition generic.hxx:228
Read and write interface.
Definition generic.hxx:872
Buffer that can be written and not read.
Definition generic.hxx:505
Buffer module of the StormByte suite.
Position
Forward declaration of the WriteOnly interface.
Definition typedefs.hxx:73
Root namespace of the StormByte C++ suite.
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54