Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Public Member Functions | List of all members
toolbox::io::Buffer Class Reference

#include <toolbox/io/Buffer.hpp>

Public Member Functions

 Buffer (std::size_t capacity)
 
 Buffer ()=default
 
 ~Buffer ()=default
 
 Buffer (const Buffer &)=default
 
Bufferoperator= (const Buffer &)=default
 
 Buffer (Buffer &&) noexcept=default
 
Bufferoperator= (Buffer &&) noexcept=default
 
ConstBuffer data () const noexcept
 Returns available data as a buffer.
 
ConstBuffer data (std::size_t limit) const noexcept
 Returns slice of available data as a buffer.
 
std::string_view str () const noexcept
 Returns available data as a string view.
 
std::string_view front (std::size_t size) const noexcept
 Returns slice of available data at the front of the buffer.
 
std::string_view back (std::size_t size) const noexcept
 Returns slice of available data at the back of the buffer.
 
bool empty () const noexcept
 Returns true if read buffer is empty.
 
std::size_t size () const noexcept
 Returns number of bytes available for read.
 
void clear () noexcept
 Clear buffer.
 
void commit (std::size_t count) noexcept
 Move characters from the write sequence to the read sequence.
 
void consume (std::size_t count) noexcept
 Remove characters from the read sequence.
 
MutableBuffer prepare (std::size_t size)
 Returns write buffer of at least size bytes.
 
void reserve (std::size_t capacity)
 Reserve storage.
 

Detailed Description

Definition at line 34 of file Buffer.hpp.

Constructor & Destructor Documentation

◆ Buffer() [1/4]

toolbox::io::Buffer::Buffer ( std::size_t  capacity)
inlineexplicit

Definition at line 36 of file Buffer.hpp.

◆ Buffer() [2/4]

toolbox::io::Buffer::Buffer ( )
default

◆ ~Buffer()

toolbox::io::Buffer::~Buffer ( )
default

◆ Buffer() [3/4]

toolbox::io::Buffer::Buffer ( const Buffer )
default

◆ Buffer() [4/4]

toolbox::io::Buffer::Buffer ( Buffer &&  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

Buffer & toolbox::io::Buffer::operator= ( const Buffer )
default

◆ operator=() [2/2]

Buffer & toolbox::io::Buffer::operator= ( Buffer &&  )
defaultnoexcept

◆ data() [1/2]

ConstBuffer toolbox::io::Buffer::data ( ) const
inlinenoexcept

Returns available data as a buffer.

Definition at line 49 of file Buffer.hpp.

Referenced by toolbox::http::BasicConn< RequestT, AppT >::dispose_now().

◆ data() [2/2]

ConstBuffer toolbox::io::Buffer::data ( std::size_t  limit) const
inlinenoexcept

Returns slice of available data as a buffer.

Definition at line 52 of file Buffer.hpp.

◆ str()

std::string_view toolbox::io::Buffer::str ( ) const
inlinenoexcept

Returns available data as a string view.

Definition at line 55 of file Buffer.hpp.

◆ front()

std::string_view toolbox::io::Buffer::front ( std::size_t  size) const
inlinenoexcept

Returns slice of available data at the front of the buffer.

Definition at line 58 of file Buffer.hpp.

◆ back()

std::string_view toolbox::io::Buffer::back ( std::size_t  size) const
inlinenoexcept

Returns slice of available data at the back of the buffer.

Definition at line 64 of file Buffer.hpp.

◆ empty()

bool toolbox::io::Buffer::empty ( ) const
inlinenoexcept

Returns true if read buffer is empty.

Definition at line 72 of file Buffer.hpp.

Referenced by toolbox::http::BasicConn< RequestT, AppT >::dispose_now().

◆ size()

std::size_t toolbox::io::Buffer::size ( ) const
inlinenoexcept

Returns number of bytes available for read.

Definition at line 75 of file Buffer.hpp.

◆ clear()

void toolbox::io::Buffer::clear ( )
inlinenoexcept

Clear buffer.

Definition at line 78 of file Buffer.hpp.

◆ commit()

void toolbox::io::Buffer::commit ( std::size_t  count)
inlinenoexcept

Move characters from the write sequence to the read sequence.

Definition at line 81 of file Buffer.hpp.

◆ consume()

void toolbox::io::Buffer::consume ( std::size_t  count)
noexcept

Remove characters from the read sequence.

Definition at line 22 of file Buffer.cpp.

◆ prepare()

MutableBuffer toolbox::io::Buffer::prepare ( std::size_t  size)
inline

Returns write buffer of at least size bytes.

Definition at line 87 of file Buffer.hpp.

◆ reserve()

void toolbox::io::Buffer::reserve ( std::size_t  capacity)
inline

Reserve storage.

Definition at line 98 of file Buffer.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().


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