CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::CopyableBuffer Class Reference

#include <CeresEngine/Foundation/Buffer.hpp>

Inheritance diagram for CeresEngine::CopyableBuffer:
CeresEngine::Buffer

Public Member Functions

 CopyableBuffer () noexcept
 
 CopyableBuffer (const CopyableBuffer &other) noexcept
 
CopyableBufferoperator= (const CopyableBuffer &other) noexcept
 
 CopyableBuffer (CopyableBuffer &&other) noexcept
 
CopyableBufferoperator= (CopyableBuffer &&other) noexcept
 
 CopyableBuffer (const Buffer &other) noexcept
 
 CopyableBuffer (Buffer &&other) noexcept
 
 Buffer () noexcept
 Creates a new empty buffer.
 
 Buffer (std::nullptr_t) noexcept
 Creates a new null buffer.
 
 Buffer (size_t size) noexcept
 Creates a new buffer with "size" bytes preallocated.
 
 Buffer (Byte *buffer, size_t size, bool copy=false) noexcept
 Creates a new buffer by referecning another raw buffer.
 
 Buffer (const Byte *buffer, size_t size) noexcept
 Creates a new buffer by copying another raw buffer.
 
 Buffer (std::initializer_list< unsigned char > bytes) noexcept
 Creates a new buffer using a initializer list.
 
 Buffer (const Buffer &other) noexcept=delete
 Creates a new buffer by creating a copy of another.
 
 Buffer (Buffer &&other) noexcept
 Creates a new buffer by moving another.
 
- Public Member Functions inherited from CeresEngine::Buffer
 Buffer () noexcept
 Creates a new empty buffer.
 
 Buffer (std::nullptr_t) noexcept
 Creates a new null buffer.
 
 Buffer (size_t size) noexcept
 Creates a new buffer with "size" bytes preallocated.
 
 Buffer (Byte *buffer, size_t size, bool copy=false) noexcept
 Creates a new buffer by referecning another raw buffer.
 
 Buffer (const Byte *buffer, size_t size) noexcept
 Creates a new buffer by copying another raw buffer.
 
 Buffer (std::initializer_list< unsigned char > bytes) noexcept
 Creates a new buffer using a initializer list.
 
 Buffer (const Buffer &other) noexcept=delete
 Creates a new buffer by creating a copy of another.
 
Bufferoperator= (const Buffer &other) noexcept=delete
 Assigns this buffer a copy of another.
 
 Buffer (Buffer &&other) noexcept
 Creates a new buffer by moving another.
 
Bufferoperator= (Buffer &&other) noexcept
 Assigns this buffer another buffer's content by moving it.
 
 ~Buffer () noexcept
 Destroys and releases the buffer content.
 
Buffer copy () const noexcept
 Creates a explicit buffer copy.
 
Bytedata () noexcept
 Gets a pointer to the raws buffer data.
 
const Bytedata () const noexcept
 Gets a pointer to the raws buffer data.
 
Bytebuffer () noexcept
 Gets a pointer to the raws buffer data.
 
const Bytebuffer () const noexcept
 Gets a pointer to the raws buffer data.
 
size_t size () const noexcept
 Gets the number of bytes currently allocated in the buffer.
 
size_t capacity () const noexcept
 Gets the buffer capacity.
 
bool empty () const noexcept
 Checks if the buffer is currently empty (i.e.
 
bool owns () const noexcept
 Checks if the buffer is currently owned.
 
bool valid () const noexcept
 Checks if the buffer is valid.
 
Iterator begin () noexcept
 Gets a iterator that points to the begining of the buffer.
 
Iterator end () noexcept
 Gets a iterator that points to the end of the buffer.
 
ConstIterator begin () const noexcept
 Gets a iterator that points to the beginning of the buffer.
 
ConstIterator end () const noexcept
 Gets a iterator that points to the end of the buffer.
 
ConstIterator cbegin () const noexcept
 Gets a iterator that points to the beginning of the buffer.
 
ConstIterator cend () const noexcept
 Gets a iterator that points to the end of the buffer.
 
bool operator== (const Buffer &other) const noexcept
 Compares a buffer for equality If either buffer contain the same address and size, retuns true.
 
bool operator!= (const Buffer &other) const noexcept
 Compares a buffer for inequality If either buffer contain the same address and size, retuns false.
 
Byteoperator[] (size_t offset) noexcept
 Accesses a buffer element by its offset.
 
Byte operator[] (size_t offset) const noexcept
 Accesses a buffer element by its offset.
 
 operator bool () const noexcept
 Checks if the buffer is valid (i.e.
 
 operator const unsigned char * () const noexcept
 
 operator const char * () const noexcept
 
 operator unsigned char * () noexcept
 
 operator char * () noexcept
 
void resize (size_t newSize) noexcept
 Resizes the buffer to be able to store up-to "newSize" bytes.
 
void reserve (size_t newCapacity) noexcept
 Reservers at least newCapacity bytes in the buffer.
 
void own () noexcept
 Transforms a unowned buffer into a owned buffer.
 
void append (const Buffer &buffer) noexcept
 Appends a buffer to the end of this buffer.
 
void write (const char *buf, size_t length) noexcept
 Writes buf to the end of the buffer.
 
auto reference (size_t start=0, size_t length=std::numeric_limits< size_t >::max()) const noexcept -> Buffer
 Creates a buffer reference.
 
std::string hexdump () const noexcept
 Creates a hexdump representation.
 
std::string hexstring () const noexcept
 Creates a hexdump representation.
 

Additional Inherited Members

- Public Types inherited from CeresEngine::Buffer
using Iterator = Byte *
 The buffer iterator.
 
using ConstIterator = const Byte *
 The buffer const iterator.
 

Constructor & Destructor Documentation

◆ CopyableBuffer() [1/5]

CeresEngine::CopyableBuffer::CopyableBuffer ( )
noexcept

◆ CopyableBuffer() [2/5]

CeresEngine::CopyableBuffer::CopyableBuffer ( const CopyableBuffer other)
noexcept

◆ CopyableBuffer() [3/5]

CeresEngine::CopyableBuffer::CopyableBuffer ( CopyableBuffer &&  other)
noexcept

◆ CopyableBuffer() [4/5]

CeresEngine::CopyableBuffer::CopyableBuffer ( const Buffer other)
noexcept

◆ CopyableBuffer() [5/5]

CeresEngine::CopyableBuffer::CopyableBuffer ( Buffer &&  other)
noexcept

Member Function Documentation

◆ Buffer() [1/8]

CeresEngine::Buffer::Buffer ( )
noexcept

Creates a new empty buffer.

◆ Buffer() [2/8]

CeresEngine::Buffer::Buffer ( Buffer &&  other)
noexcept

Creates a new buffer by moving another.

Parameters
otherThe instance to move from

◆ Buffer() [3/8]

CeresEngine::Buffer::Buffer ( Byte buffer,
size_t  size,
bool  copy = false 
)
explicitnoexcept

Creates a new buffer by referecning another raw buffer.

Important: the data is not copied!

Parameters
bufferThe buffer
sizeThe buffer size
copyA flag that configures copying

◆ Buffer() [4/8]

CeresEngine::Buffer::Buffer ( const Buffer other)
deletenoexcept

Creates a new buffer by creating a copy of another.

Parameters
otherThe instance to copy from

◆ Buffer() [5/8]

CeresEngine::Buffer::Buffer ( const Byte buffer,
size_t  size 
)
explicitnoexcept

Creates a new buffer by copying another raw buffer.

Parameters
bufferThe buffer
sizeThe buffer size

◆ Buffer() [6/8]

CeresEngine::Buffer::Buffer ( size_t  size)
explicitnoexcept

Creates a new buffer with "size" bytes preallocated.

Parameters
sizeThe number of bytes to preallocate

◆ Buffer() [7/8]

CeresEngine::Buffer::Buffer ( std::initializer_list< unsigned char bytes)
noexcept

Creates a new buffer using a initializer list.

Parameters
bytesThe buffer content

◆ Buffer() [8/8]

CeresEngine::Buffer::Buffer ( std::nullptr_t  )
noexcept

Creates a new null buffer.

◆ operator=() [1/2]

CopyableBuffer & CeresEngine::CopyableBuffer::operator= ( const CopyableBuffer other)
noexcept

◆ operator=() [2/2]

CopyableBuffer & CeresEngine::CopyableBuffer::operator= ( CopyableBuffer &&  other)
noexcept

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