StormByte C++ Library: Buffer module 0.0.9999
StormByte-Buffer is a StormByte library module for handling buffers
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
StormByte::Buffer::Generic Class Referenceabstract

Generic class to maintain common API guarantees across buffer types. More...

#include <generic.hxx>

Inheritance diagram for StormByte::Buffer::Generic:
Inheritance graph
[legend]

Public Member Functions

 Generic () noexcept=default
 Construct Generic.
 
 Generic (const DataType &data) noexcept
 Construct Generic.
 
 Generic (DataType &&data) noexcept
 Construct Generic with initial data using move semantics.
 
 Generic (const Generic &) noexcept=default
 Copy construct deleted.
 
 Generic (Generic &&) noexcept=default
 Move construct deleted.
 
virtual ~Generic () noexcept=0
 Virtual destructor.
 
Genericoperator= (const Generic &other)=default
 Copy assign deleted.
 
Genericoperator= (Generic &&) noexcept=default
 Move assign deleted.
 

Static Protected Member Functions

template<std::ranges::input_range Src>
requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Src>>>) && requires(std::ranges::range_value_t<Src> v) { static_cast<std::byte>(v); }
static DataType DataConvert (const Src &src) noexcept
 Convert various source types into the library DataType.
 
template<std::ranges::input_range Src>
requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Src>>>) && requires(std::ranges::range_value_t<Src> v) { static_cast<std::byte>(v); }
static DataType DataConvert (Src &&src) noexcept
 
static DataType DataConvert (std::string_view sv) noexcept
 Convert a std::string_view to DataType.
 
static DataType DataConvert (const char *s) noexcept
 Convert a null-terminated C string to DataType.
 

Protected Attributes

DataType m_buffer
 Internal buffer storage.
 

Detailed Description

Generic class to maintain common API guarantees across buffer types.

Overview
Generic provides a common base class for buffer types, ensuring consistent API behavior and guarantees. It defines standard operations like reading, writing, seeking, and clearing buffers.

Constructor & Destructor Documentation

◆ Generic() [1/2]

StormByte::Buffer::Generic::Generic ( const DataType &  data)
inlinenoexcept

Construct Generic.

Parameters
dataInitial byte vector to populate the Generic.

◆ Generic() [2/2]

StormByte::Buffer::Generic::Generic ( DataType &&  data)
inlinenoexcept

Construct Generic with initial data using move semantics.

Parameters
dataInitial byte vector to move into the Generic.

Member Function Documentation

◆ DataConvert()

template<std::ranges::input_range Src>
requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Src>>>) && requires(std::ranges::range_value_t<Src> v) { static_cast<std::byte>(v); }
static DataType StormByte::Buffer::Generic::DataConvert ( const Src &  src)
inlinestaticprotectednoexcept

Convert various source types into the library DataType.

Overload forms:

  • DataType DataConvert(const Src&) for copying/converting from lvalue ranges
  • DataType DataConvert(Src&&) for consuming rvalue ranges and moving when the source type is already DataType.

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