|
unilink
0.4.3
A simple C++ library for unified async communication
|
Safe data buffer for type-safe data transfer. More...
#include <safe_data_buffer.hpp>
Public Member Functions | |
| SafeDataBuffer (const std::string &data) | |
| SafeDataBuffer (std::string_view data) | |
| SafeDataBuffer (std::vector< uint8_t > data) | |
| SafeDataBuffer (const uint8_t *data, size_t size) | |
| SafeDataBuffer (const char *data, size_t size) | |
| SafeDataBuffer (ConstByteSpan span) | |
| SafeDataBuffer (const SafeDataBuffer &)=default | |
| SafeDataBuffer & | operator= (const SafeDataBuffer &)=default |
| SafeDataBuffer (SafeDataBuffer &&)=default | |
| SafeDataBuffer & | operator= (SafeDataBuffer &&)=default |
| ~SafeDataBuffer ()=default | |
| std::string | as_string () const |
| ConstByteSpan | as_span () const noexcept |
| const uint8_t * | data () const noexcept |
| size_t | size () const noexcept |
| bool | empty () const noexcept |
| const uint8_t & | operator[] (size_t index) const |
| const uint8_t & | at (size_t index) const |
| bool | operator== (const SafeDataBuffer &other) const noexcept |
| bool | operator!= (const SafeDataBuffer &other) const noexcept |
| void | clear () noexcept |
| void | reserve (size_t capacity) |
| void | resize (size_t new_size) |
| bool | is_valid () const noexcept |
| void | validate () const |
Safe data buffer for type-safe data transfer.
This class provides a safe wrapper around binary data that can be constructed from various sources and provides safe access methods.
Definition at line 40 of file safe_data_buffer.hpp.
|
explicit |
Definition at line 26 of file safe_data_buffer.cc.
|
explicit |
Definition at line 30 of file safe_data_buffer.cc.
|
explicit |
Definition at line 34 of file safe_data_buffer.cc.
|
explicit |
Definition at line 38 of file safe_data_buffer.cc.
|
explicit |
Definition at line 45 of file safe_data_buffer.cc.
|
explicit |
Definition at line 52 of file safe_data_buffer.cc.
|
default |
|
default |
|
default |
|
noexcept |
Definition at line 62 of file safe_data_buffer.cc.
| std::string unilink::memory::SafeDataBuffer::as_string | ( | ) | const |
Definition at line 60 of file safe_data_buffer.cc.
| const uint8_t & unilink::memory::SafeDataBuffer::at | ( | size_t | index | ) | const |
Definition at line 76 of file safe_data_buffer.cc.
|
noexcept |
Definition at line 87 of file safe_data_buffer.cc.
|
noexcept |
Definition at line 64 of file safe_data_buffer.cc.
|
noexcept |
Definition at line 68 of file safe_data_buffer.cc.
|
noexcept |
Definition at line 94 of file safe_data_buffer.cc.
|
noexcept |
Definition at line 84 of file safe_data_buffer.cc.
|
default |
|
default |
|
noexcept |
Definition at line 82 of file safe_data_buffer.cc.
| const uint8_t & unilink::memory::SafeDataBuffer::operator[] | ( | size_t | index | ) | const |
Definition at line 71 of file safe_data_buffer.cc.
| void unilink::memory::SafeDataBuffer::reserve | ( | size_t | capacity | ) |
Definition at line 89 of file safe_data_buffer.cc.
| void unilink::memory::SafeDataBuffer::resize | ( | size_t | new_size | ) |
Definition at line 91 of file safe_data_buffer.cc.
|
noexcept |
Definition at line 66 of file safe_data_buffer.cc.
| void unilink::memory::SafeDataBuffer::validate | ( | ) | const |
Definition at line 98 of file safe_data_buffer.cc.