RADLib
RADical C++ application framework
RADData::RADByteArray Class Reference

Owning byte array with lightweight append/view helpers. More...

#include <RADDataStructures.h>

Public Member Functions

 RADByteArray ()=default
 Creates an empty byte array. More...
 
 RADByteArray (size_t count)
 Creates count zero-initialized bytes. More...
 
 RADByteArray (const void *data, size_t size)
 Creates bytes from raw memory. More...
 
size_t size () const
 Returns number of bytes. More...
 
bool empty () const
 Returns true when no bytes are stored. More...
 
uint8_t * data ()
 Returns mutable byte pointer. More...
 
const uint8_t * data () const
 Returns const byte pointer. More...
 
uint8_t & operator[] (size_t index)
 Returns mutable byte at index. More...
 
const uint8_t & operator[] (size_t index) const
 Returns const byte at index. More...
 
void clear ()
 Clears all bytes. More...
 
void reserve (size_t capacity)
 Reserves byte capacity. More...
 
void append (uint8_t byte)
 Appends one byte. More...
 
void append (const void *data, size_t size)
 Appends raw memory bytes. More...
 
RADByteArrayView view ()
 Returns mutable view. More...
 
RADConstByteArrayView view () const
 Returns const view. More...
 
const std::vector< uint8_t > & vector () const
 Returns std::vector-compatible storage. More...
 

Detailed Description

Owning byte array with lightweight append/view helpers.

Constructor & Destructor Documentation

◆ RADByteArray() [1/3]

RADData::RADByteArray::RADByteArray ( )
default

Creates an empty byte array.

◆ RADByteArray() [2/3]

RADData::RADByteArray::RADByteArray ( size_t  count)
inlineexplicit

Creates count zero-initialized bytes.

◆ RADByteArray() [3/3]

RADData::RADByteArray::RADByteArray ( const void *  data,
size_t  size 
)
inline

Creates bytes from raw memory.

Member Function Documentation

◆ append() [1/2]

void RADData::RADByteArray::append ( const void *  data,
size_t  size 
)
inline

Appends raw memory bytes.

◆ append() [2/2]

void RADData::RADByteArray::append ( uint8_t  byte)
inline

Appends one byte.

◆ clear()

void RADData::RADByteArray::clear ( )
inline

Clears all bytes.

◆ data() [1/2]

uint8_t* RADData::RADByteArray::data ( )
inline

Returns mutable byte pointer.

◆ data() [2/2]

const uint8_t* RADData::RADByteArray::data ( ) const
inline

Returns const byte pointer.

◆ empty()

bool RADData::RADByteArray::empty ( ) const
inline

Returns true when no bytes are stored.

◆ operator[]() [1/2]

uint8_t& RADData::RADByteArray::operator[] ( size_t  index)
inline

Returns mutable byte at index.

◆ operator[]() [2/2]

const uint8_t& RADData::RADByteArray::operator[] ( size_t  index) const
inline

Returns const byte at index.

◆ reserve()

void RADData::RADByteArray::reserve ( size_t  capacity)
inline

Reserves byte capacity.

◆ size()

size_t RADData::RADByteArray::size ( ) const
inline

Returns number of bytes.

◆ vector()

const std::vector<uint8_t>& RADData::RADByteArray::vector ( ) const
inline

Returns std::vector-compatible storage.

◆ view() [1/2]

RADByteArrayView RADData::RADByteArray::view ( )
inline

Returns mutable view.

◆ view() [2/2]

RADConstByteArrayView RADData::RADByteArray::view ( ) const
inline

Returns const view.


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