matador::buffer Class Reference

#include <buffer.hpp>

Public Member Functions

 buffer ()=default
 
 buffer (const buffer &x)=delete
 
bufferoperator= (const buffer &x)=delete
 
 ~buffer ()=default
 
void append (const char *chunk, std::size_t size)
 
void append (const buffer &buf)
 
void append (const std::string &str)
 
char * data ()
 
const char * data () const
 
std::size_t capacity () const
 
std::size_t size () const
 
void size (std::size_t s)
 
bool empty () const
 
void clear ()
 

Detailed Description

Simple buffer class with a fixed size of 16384 bytes.

Constructor & Destructor Documentation

◆ buffer() [1/2]

matador::buffer::buffer ( )
default

Creates an empty buffer

◆ buffer() [2/2]

matador::buffer::buffer ( const buffer x)
delete

Copy constructs from given buffer x

Parameters
xBuffer to copy from

◆ ~buffer()

matador::buffer::~buffer ( )
default

Destroys the buffer

Member Function Documentation

◆ append() [1/3]

void matador::buffer::append ( const buffer buf)

Appends the given buffer to this buffer. If the new buffer size exceeds the maximum size of the buffer an out of bound exception is thrown

Parameters
bufBuffer to append

◆ append() [2/3]

void matador::buffer::append ( const char *  chunk,
std::size_t  size 
)

Appends the given chunk of the given size to the buffer. If the new buffer size exceeds the maximum size of the buffer an out of bound exception is thrown

Parameters
chunkChunk to append
sizeSize of the chunk to append

◆ append() [3/3]

void matador::buffer::append ( const std::string &  str)

Appends the given string to this buffer. If the new buffer size exceeds the maximum size of the buffer an out of bound exception is thrown

Parameters
strString to append

◆ capacity()

std::size_t matador::buffer::capacity ( ) const

Returns the capacity of the buffer i.e. 16384 bytes

Returns
The capacity of the buffer

◆ clear()

void matador::buffer::clear ( )

Empties the buffer

◆ data() [1/2]

char * matador::buffer::data ( )

Pointer to the beginning of the buffer data

Returns
Pointer to the beginning of the data

◆ data() [2/2]

const char * matador::buffer::data ( ) const

Pointer to the beginning of the buffer data

Returns
Pointer to the beginning of the data

◆ empty()

bool matador::buffer::empty ( ) const

Returns true if the buffer is empty

Returns
True if empty

◆ operator=()

buffer & matador::buffer::operator= ( const buffer x)
delete

Copy assigns from given buffer x

Parameters
xBuffer to assign from
Returns
The assign buffer

◆ size() [1/2]

std::size_t matador::buffer::size ( ) const

Returns the current size of buffer data.

Returns
The current size of the buffer

◆ size() [2/2]

void matador::buffer::size ( std::size_t  s)

Sets the new size of the buffer

Parameters
sSize of the buffer

The documentation for this class was generated from the following file:
  • matador/utils/buffer.hpp