microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
microfmt::detail::memory_buffer_base Class Reference

Non-templated base class for dynamically growing buffers. More...

#include <memory_buffer.hpp>

Inheritance diagram for microfmt::detail::memory_buffer_base:
Inheritance graph
[legend]

Public Types

using value_type = char
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = value_type *
 
using const_pointer = const value_type *
 
using iterator = pointer
 
using const_iterator = const_pointer
 

Public Member Functions

 memory_buffer_base (const memory_buffer_base &)=delete
 
memory_buffer_base & operator= (const memory_buffer_base &)=delete
 
 RELOCO_BLOCK_RVALUE_ACCESS (memory_buffer_base)
 
 ~memory_buffer_base () noexcept
 
sink as_sink () &noexcept RELOCO_LIFETIMEBOUND
 Creates a type-erased sink adapter pointing to this instance.
 
constexpr microfmt::string_view view () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr pointer data () &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_pointer data () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr iterator begin () &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_iterator begin () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_iterator cbegin () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr iterator end () &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_iterator end () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_iterator cend () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr size_type size () const noexcept
 
constexpr size_type capacity () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr reference operator[] (size_type pos) &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_reference operator[] (size_type pos) const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr reference front () &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_reference front () const &noexcept RELOCO_LIFETIMEBOUND
 
constexpr reference back () &noexcept RELOCO_LIFETIMEBOUND
 
constexpr const_reference back () const &noexcept RELOCO_LIFETIMEBOUND
 
RELOCO_REINITIALIZES void clear () &noexcept
 
void push_back (char c) &noexcept
 Fast-path single character append (enables std::back_inserter compatibility).
 

Protected Member Functions

constexpr memory_buffer_base (reloco::allocator_ref alloc, char *inline_buf, std::size_t inline_cap) noexcept
 Initializes the buffer state using the derived class's stack storage.
 
constexpr memory_buffer_base (memory_buffer_base &&other, char *new_inline_ptr, std::size_t inline_cap) noexcept
 Move-constructs from another buffer base, resolving inline pointers.
 
void move_assign (memory_buffer_base &&other, std::size_t inline_cap) noexcept
 Safely move-assigns the buffer, handling heap/stack transitions.
 

Detailed Description

Non-templated base class for dynamically growing buffers.

Contains all the size, capacity, and reallocation logic to completely avoid template bloat. Functions can accept a reference to this base class to operate on buffers of any inline capacity.

Member Typedef Documentation

◆ const_iterator

◆ const_pointer

◆ const_reference

◆ difference_type

◆ iterator

◆ pointer

◆ reference

◆ size_type

◆ value_type

Constructor & Destructor Documentation

◆ memory_buffer_base() [1/3]

microfmt::detail::memory_buffer_base::memory_buffer_base ( const memory_buffer_base &  )
delete

◆ ~memory_buffer_base()

microfmt::detail::memory_buffer_base::~memory_buffer_base ( )
inlinenoexcept

◆ memory_buffer_base() [2/3]

constexpr microfmt::detail::memory_buffer_base::memory_buffer_base ( reloco::allocator_ref  alloc,
char *  inline_buf,
std::size_t  inline_cap 
)
inlineconstexprprotectednoexcept

Initializes the buffer state using the derived class's stack storage.

◆ memory_buffer_base() [3/3]

constexpr microfmt::detail::memory_buffer_base::memory_buffer_base ( memory_buffer_base &&  other,
char *  new_inline_ptr,
std::size_t  inline_cap 
)
inlineconstexprprotectednoexcept

Move-constructs from another buffer base, resolving inline pointers.

Member Function Documentation

◆ as_sink()

sink microfmt::detail::memory_buffer_base::as_sink ( ) &
inlinenoexcept

Creates a type-erased sink adapter pointing to this instance.

◆ back() [1/2]

constexpr reference microfmt::detail::memory_buffer_base::back ( ) &
inlineconstexprnoexcept

◆ back() [2/2]

constexpr const_reference microfmt::detail::memory_buffer_base::back ( ) const &
inlineconstexprnoexcept

◆ begin() [1/2]

constexpr iterator microfmt::detail::memory_buffer_base::begin ( ) &
inlineconstexprnoexcept

◆ begin() [2/2]

constexpr const_iterator microfmt::detail::memory_buffer_base::begin ( ) const &
inlineconstexprnoexcept

◆ capacity()

constexpr size_type microfmt::detail::memory_buffer_base::capacity ( ) const
inlineconstexprnoexcept

◆ cbegin()

constexpr const_iterator microfmt::detail::memory_buffer_base::cbegin ( ) const &
inlineconstexprnoexcept

◆ cend()

constexpr const_iterator microfmt::detail::memory_buffer_base::cend ( ) const &
inlineconstexprnoexcept

◆ clear()

RELOCO_REINITIALIZES void microfmt::detail::memory_buffer_base::clear ( ) &
inlinenoexcept

◆ data() [1/2]

constexpr pointer microfmt::detail::memory_buffer_base::data ( ) &
inlineconstexprnoexcept

◆ data() [2/2]

constexpr const_pointer microfmt::detail::memory_buffer_base::data ( ) const &
inlineconstexprnoexcept

◆ empty()

constexpr bool microfmt::detail::memory_buffer_base::empty ( ) const
inlineconstexprnoexcept

◆ end() [1/2]

constexpr iterator microfmt::detail::memory_buffer_base::end ( ) &
inlineconstexprnoexcept

◆ end() [2/2]

constexpr const_iterator microfmt::detail::memory_buffer_base::end ( ) const &
inlineconstexprnoexcept

◆ front() [1/2]

constexpr reference microfmt::detail::memory_buffer_base::front ( ) &
inlineconstexprnoexcept

◆ front() [2/2]

constexpr const_reference microfmt::detail::memory_buffer_base::front ( ) const &
inlineconstexprnoexcept

◆ move_assign()

void microfmt::detail::memory_buffer_base::move_assign ( memory_buffer_base &&  other,
std::size_t  inline_cap 
)
inlineprotectednoexcept

Safely move-assigns the buffer, handling heap/stack transitions.

◆ operator=()

memory_buffer_base & microfmt::detail::memory_buffer_base::operator= ( const memory_buffer_base &  )
delete

◆ operator[]() [1/2]

constexpr reference microfmt::detail::memory_buffer_base::operator[] ( size_type  pos) &
inlineconstexprnoexcept

◆ operator[]() [2/2]

constexpr const_reference microfmt::detail::memory_buffer_base::operator[] ( size_type  pos) const &
inlineconstexprnoexcept

◆ push_back()

void microfmt::detail::memory_buffer_base::push_back ( char  c) &
inlinenoexcept

Fast-path single character append (enables std::back_inserter compatibility).

◆ RELOCO_BLOCK_RVALUE_ACCESS()

microfmt::detail::memory_buffer_base::RELOCO_BLOCK_RVALUE_ACCESS ( memory_buffer_base  )

◆ size()

constexpr size_type microfmt::detail::memory_buffer_base::size ( ) const
inlineconstexprnoexcept

◆ view()

constexpr microfmt::string_view microfmt::detail::memory_buffer_base::view ( ) const &
inlineconstexprnoexcept

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