RESTinio
Public Member Functions | Private Attributes | List of all members
restinio::impl::fixed_buffer_t Class Reference

Helper class for reading bytes and feeding them to parser. More...

#include <fixed_buffer.hpp>

Public Member Functions

 fixed_buffer_t (const fixed_buffer_t &)=delete
 
fixed_buffer_toperator= (const fixed_buffer_t &)=delete
 
 fixed_buffer_t (fixed_buffer_t &&)=delete
 
fixed_buffer_toperator= (fixed_buffer_t &&)=delete
 
 fixed_buffer_t (std::size_t size)
 
auto make_asio_buffer () noexcept
 Make asio buffer for reading bytes from socket. More...
 
void obtained_bytes (std::size_t length) noexcept
 Mark how many bytes were obtained. More...
 
void consumed_bytes (std::size_t length) noexcept
 Mark how many bytes were obtained. More...
 
std::size_t length () const noexcept
 How many unconsumed bytes are there in buffer. More...
 
const char * bytes () const noexcept
 Get pointer to unconsumed bytes. More...
 

Private Attributes

std::vector< char > m_buf
 Buffer for io operation. More...
 
std::size_t m_ready_pos {0}
 unconsumed data left in buffer:Start of data in buffer. More...
 
std::size_t m_ready_length {0}
 Data size. More...
 

Detailed Description

Helper class for reading bytes and feeding them to parser.

Definition at line 26 of file fixed_buffer.hpp.

Constructor & Destructor Documentation

◆ fixed_buffer_t() [1/3]

restinio::impl::fixed_buffer_t::fixed_buffer_t ( const fixed_buffer_t )
delete

◆ fixed_buffer_t() [2/3]

restinio::impl::fixed_buffer_t::fixed_buffer_t ( fixed_buffer_t &&  )
delete

◆ fixed_buffer_t() [3/3]

restinio::impl::fixed_buffer_t::fixed_buffer_t ( std::size_t  size)
inlineexplicit

Definition at line 34 of file fixed_buffer.hpp.

Member Function Documentation

◆ bytes()

const char* restinio::impl::fixed_buffer_t::bytes ( ) const
inlinenoexcept

Get pointer to unconsumed bytes.

Note
To check that buffer has unconsumed bytes use length().

Definition at line 69 of file fixed_buffer.hpp.

◆ consumed_bytes()

void restinio::impl::fixed_buffer_t::consumed_bytes ( std::size_t  length)
inlinenoexcept

Mark how many bytes were obtained.

Definition at line 56 of file fixed_buffer.hpp.

◆ length()

std::size_t restinio::impl::fixed_buffer_t::length ( ) const
inlinenoexcept

How many unconsumed bytes are there in buffer.

Definition at line 63 of file fixed_buffer.hpp.

◆ make_asio_buffer()

auto restinio::impl::fixed_buffer_t::make_asio_buffer ( )
inlinenoexcept

Make asio buffer for reading bytes from socket.

Definition at line 41 of file fixed_buffer.hpp.

◆ obtained_bytes()

void restinio::impl::fixed_buffer_t::obtained_bytes ( std::size_t  length)
inlinenoexcept

Mark how many bytes were obtained.

Definition at line 48 of file fixed_buffer.hpp.

◆ operator=() [1/2]

fixed_buffer_t& restinio::impl::fixed_buffer_t::operator= ( const fixed_buffer_t )
delete

◆ operator=() [2/2]

fixed_buffer_t& restinio::impl::fixed_buffer_t::operator= ( fixed_buffer_t &&  )
delete

Member Data Documentation

◆ m_buf

std::vector< char > restinio::impl::fixed_buffer_t::m_buf
private

Buffer for io operation.

Definition at line 73 of file fixed_buffer.hpp.

◆ m_ready_length

std::size_t restinio::impl::fixed_buffer_t::m_ready_length {0}
private

Data size.

Definition at line 81 of file fixed_buffer.hpp.

◆ m_ready_pos

std::size_t restinio::impl::fixed_buffer_t::m_ready_pos {0}
private

unconsumed data left in buffer:Start of data in buffer.

Definition at line 78 of file fixed_buffer.hpp.


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