3#include <StormByte/buffer/exception.hxx>
4#include <StormByte/buffer/typedefs.hxx>
5#include <StormByte/visibility.h>
48 explicit
Simple(const std::
size_t& size);
56 Simple(const
char* data, const std::
size_t& length);
98 virtual ~
Simple() noexcept = default;
148 virtual
Simple& operator<<(const std::
string& data);
161 template <typename NumericType, typename = std::enable_if_t<std::is_arithmetic_v<std::decay_t<NumericType>>>>
162 Simple& operator<<(const NumericType& value) {
163 const auto* raw_data =
reinterpret_cast<const std::byte*
>(&value);
164 m_data.insert(m_data.end(), raw_data, raw_data +
sizeof(NumericType));
185 virtual
size_t Capacity() const noexcept;
191 virtual
void Clear();
216 virtual
void Discard(const std::
size_t& length, const
Read::Position& mode =
Read::Position::Relative) noexcept;
222 virtual
bool Empty() const noexcept;
228 virtual
bool End() const noexcept;
257 virtual
bool HasEnoughData(const std::
size_t& length);
268 virtual std::
string HexData(const std::
size_t& column_size = 16) const;
274 virtual
bool IsEoF() const noexcept;
292 virtual std::
size_t Position() const noexcept;
331 virtual
void Reserve(const std::
size_t& size);
338 virtual
void Seek(const std::ptrdiff_t& position, const
Read::Position& mode) const;
344 virtual std::
size_t Size() const noexcept;
356 const std::span<const
Byte> Span() const noexcept;
368 std::span<
Byte> Span() noexcept;
421 std::vector<std::
byte> m_data;
422 mutable std::
size_t m_position;
423 mutable std::
size_t m_minimum_chunk_size;
Exception class for buffer overflow errors.
Definition exception.hxx:48
A lightweight class for storing and manipulating simple byte buffers.
Definition simple.hxx:36
virtual Simple & operator>>(Simple &buffer)
Appends current simple buffer to target simple buffer.
virtual size_t AvailableBytes() const noexcept
Gets the available bytes to read from current position.
Simple() noexcept
Default constructor Initializes an empty simple buffer.
Namespace for buffer-related components in the StormByte library.
Namespace for read-related utilities in the StormByte library.
Namespace for buffer-related components in the StormByte library.
Definition consumer.hxx:19
Expected< Byte, T > ExpectedByte
Represents a single byte with error handling.
Definition typedefs.hxx:143
std::function< std::shared_ptr< Simple >(const Simple &)> Processor
Represents a function that processes a buffer.
Definition typedefs.hxx:157
std::byte Byte
Represents a single byte of data.
Definition typedefs.hxx:138
Expected< Data, T > ExpectedData
Represents a collection of bytes with error handling.
Definition typedefs.hxx:155
std::vector< Byte > Data
Represents collection of bytes stored in the buffer.
Definition typedefs.hxx:139
Status
Defines the status of the buffer during producer/consumer operations.
Definition typedefs.hxx:106
Namespace for write-related utilities in the StormByte library.