Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
Buffer Class Reference

#include <Buffer.h>

Public Member Functions

 Buffer ()
 Construct an empty buffer that owns no data.
 
 Buffer (std::size_t size)
 Construct a Buffer that owns a new underlying buffer of size size.
 
 Buffer (std::shared_ptr< unsigned char > buffer, MutableByteRange data)
 
 Buffer (Buffer &&)=default
 
Bufferoperator= (Buffer &&)=default
 
Buffer splitAt (std::size_t n)
 
void advance (std::size_t n)
 Modifies the buffer to point to the range [begin + n, end).
 
void subtract (std::size_t n)
 Modifies the buffer to point to the range [begin, end - n).
 
ByteRange range () const
 Returns a read only Range pointing to the Buffers data.
 
MutableByteRange range ()
 Returns a mutable Range pointing to the Buffers data.
 
const unsigned char * data () const
 
unsigned char * data ()
 
std::size_t size () const
 
bool empty () const
 
 Buffer ()
 Construct an empty buffer that owns no data.
 
 Buffer (std::size_t size)
 Construct a Buffer that owns a new underlying buffer of size size.
 
 Buffer (std::shared_ptr< unsigned char > buffer, MutableByteRange data)
 
 Buffer (Buffer &&)=default
 
Bufferoperator= (Buffer &&)=default
 
Buffer splitAt (std::size_t n)
 
void advance (std::size_t n)
 Modifies the buffer to point to the range [begin + n, end).
 
void subtract (std::size_t n)
 Modifies the buffer to point to the range [begin, end - n).
 
ByteRange range () const
 Returns a read only Range pointing to the Buffers data.
 
MutableByteRange range ()
 Returns a mutable Range pointing to the Buffers data.
 
const unsigned char * data () const
 
unsigned char * data ()
 
std::size_t size () const
 
bool empty () const
 
 Buffer ()
 Construct an empty buffer that owns no data.
 
 Buffer (std::size_t size)
 Construct a Buffer that owns a new underlying buffer of size size.
 
 Buffer (std::shared_ptr< unsigned char > buffer, MutableByteRange data)
 
 Buffer (Buffer &&)=default
 
Bufferoperator= (Buffer &&)=default
 
Buffer splitAt (std::size_t n)
 
void advance (std::size_t n)
 Modifies the buffer to point to the range [begin + n, end).
 
void subtract (std::size_t n)
 Modifies the buffer to point to the range [begin, end - n).
 
ByteRange range () const
 Returns a read only Range pointing to the Buffers data.
 
MutableByteRange range ()
 Returns a mutable Range pointing to the Buffers data.
 
const unsigned char * data () const
 
unsigned char * data ()
 
std::size_t size () const
 
bool empty () const
 

Detailed Description

A Buffer has a pointer to a shared buffer, and a range of the buffer that it owns. The idea is that you can allocate one buffer, and write chunks into it and break off those chunks. The underlying buffer is reference counted, and will be destroyed when all Buffers that reference it are destroyed.

Constructor & Destructor Documentation

◆ Buffer() [1/12]

Buffer ( )
inlineexplicit

Construct an empty buffer that owns no data.

◆ Buffer() [2/12]

Buffer ( std::size_t size)
inlineexplicit

Construct a Buffer that owns a new underlying buffer of size size.

◆ Buffer() [3/12]

Buffer ( std::shared_ptr< unsigned char > buffer,
MutableByteRange data )
inlineexplicit

◆ Buffer() [4/12]

Buffer ( Buffer && )
default

◆ Buffer() [5/12]

Buffer ( )
inlineexplicit

Construct an empty buffer that owns no data.

◆ Buffer() [6/12]

Buffer ( std::size_t size)
inlineexplicit

Construct a Buffer that owns a new underlying buffer of size size.

◆ Buffer() [7/12]

Buffer ( std::shared_ptr< unsigned char > buffer,
MutableByteRange data )
inlineexplicit

◆ Buffer() [8/12]

Buffer ( Buffer && )
default

◆ Buffer() [9/12]

Buffer ( )
inlineexplicit

Construct an empty buffer that owns no data.

◆ Buffer() [10/12]

Buffer ( std::size_t size)
inlineexplicit

Construct a Buffer that owns a new underlying buffer of size size.

◆ Buffer() [11/12]

Buffer ( std::shared_ptr< unsigned char > buffer,
MutableByteRange data )
inlineexplicit

◆ Buffer() [12/12]

Buffer ( Buffer && )
default

Member Function Documentation

◆ advance() [1/3]

void advance ( std::size_t n)
inline

Modifies the buffer to point to the range [begin + n, end).

◆ advance() [2/3]

void advance ( std::size_t n)
inline

Modifies the buffer to point to the range [begin + n, end).

◆ advance() [3/3]

void advance ( std::size_t n)
inline

Modifies the buffer to point to the range [begin + n, end).

◆ data() [1/6]

unsigned char * data ( )
inline

◆ data() [2/6]

unsigned char * data ( )
inline

◆ data() [3/6]

unsigned char * data ( )
inline

◆ data() [4/6]

const unsigned char * data ( ) const
inline

◆ data() [5/6]

const unsigned char * data ( ) const
inline

◆ data() [6/6]

const unsigned char * data ( ) const
inline

◆ empty() [1/3]

bool empty ( ) const
inline

◆ empty() [2/3]

bool empty ( ) const
inline

◆ empty() [3/3]

bool empty ( ) const
inline

◆ operator=() [1/3]

Buffer & operator= ( Buffer && )
default

◆ operator=() [2/3]

Buffer & operator= ( Buffer && )
default

◆ operator=() [3/3]

Buffer & operator= ( Buffer && )
default

◆ range() [1/6]

MutableByteRange range ( )
inline

Returns a mutable Range pointing to the Buffers data.

◆ range() [2/6]

MutableByteRange range ( )
inline

Returns a mutable Range pointing to the Buffers data.

◆ range() [3/6]

MutableByteRange range ( )
inline

Returns a mutable Range pointing to the Buffers data.

◆ range() [4/6]

ByteRange range ( ) const
inline

Returns a read only Range pointing to the Buffers data.

◆ range() [5/6]

ByteRange range ( ) const
inline

Returns a read only Range pointing to the Buffers data.

◆ range() [6/6]

ByteRange range ( ) const
inline

Returns a read only Range pointing to the Buffers data.

◆ size() [1/3]

std::size_t size ( ) const
inline

◆ size() [2/3]

std::size_t size ( ) const
inline

◆ size() [3/3]

std::size_t size ( ) const
inline

◆ splitAt() [1/3]

Buffer splitAt ( std::size_t n)
inline

Splits the data into two pieces: [begin, begin + n), [begin + n, end). Their data both points into the same underlying buffer. Modifies the original Buffer to point to only [begin + n, end).

Parameters
nThe offset to split at.
Returns
A buffer that owns the data [begin, begin + n).

◆ splitAt() [2/3]

Buffer splitAt ( std::size_t n)
inline

Splits the data into two pieces: [begin, begin + n), [begin + n, end). Their data both points into the same underlying buffer. Modifies the original Buffer to point to only [begin + n, end).

Parameters
nThe offset to split at.
Returns
A buffer that owns the data [begin, begin + n).

◆ splitAt() [3/3]

Buffer splitAt ( std::size_t n)
inline

Splits the data into two pieces: [begin, begin + n), [begin + n, end). Their data both points into the same underlying buffer. Modifies the original Buffer to point to only [begin + n, end).

Parameters
nThe offset to split at.
Returns
A buffer that owns the data [begin, begin + n).

◆ subtract() [1/3]

void subtract ( std::size_t n)
inline

Modifies the buffer to point to the range [begin, end - n).

◆ subtract() [2/3]

void subtract ( std::size_t n)
inline

Modifies the buffer to point to the range [begin, end - n).

◆ subtract() [3/3]

void subtract ( std::size_t n)
inline

Modifies the buffer to point to the range [begin, end - n).


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