Class of binary data.
More...
#include <msgpack_light/binary.h>
|
| binary () |
| Constructor.
|
| binary (binary_view data) |
| Constructor.
|
| binary (const std::vector< unsigned char > &data) |
| Constructor.
|
| binary (const unsigned char *data, std::size_t size) |
| Constructor.
|
| binary (std::initializer_list< unsigned char > data) |
| Constructor.
|
| binary (std::size_t size) |
| Constructor.
|
| binary (std::string_view data_string) |
| Constructor.
|
void | append (const unsigned char *data, std::size_t size) |
| Append another binary data.
|
std::size_t | capacity () const noexcept |
| Get the size of the internal buffer for data.
|
const unsigned char * | data () const noexcept |
| Get the pointer to the data.
|
unsigned char * | data () noexcept |
| Get the pointer to the data.
|
bool | operator!= (const binary &other) const noexcept |
| Compare with another instance.
|
binary & | operator+= (const binary &other) |
| Append another binary data.
|
bool | operator== (const binary &other) const noexcept |
| Compare with another instance.
|
unsigned char | operator[] (std::size_t index) const noexcept |
| Access to a byte.
|
unsigned char & | operator[] (std::size_t index) noexcept |
| Access to a byte.
|
void | reserve (std::size_t size) |
| Change the size of the internal buffer.
|
void | resize (std::size_t size) |
| Change the size of this data.
|
std::size_t | size () const noexcept |
| Get the size of the data.
|
Class of binary data.
Definition at line 129 of file binary.h.
◆ binary() [1/7]
msgpack_light::binary::binary |
( |
| ) |
|
|
inline |
Constructor.
Create empty data.
Definition at line 136 of file binary.h.
◆ binary() [2/7]
msgpack_light::binary::binary |
( |
std::size_t | size | ) |
|
|
inlineexplicit |
Constructor.
Create a buffer with uninitialized data.
- Parameters
-
[in] | size | Size of the buffer. |
Definition at line 145 of file binary.h.
◆ binary() [3/7]
msgpack_light::binary::binary |
( |
const unsigned char * | data, |
|
|
std::size_t | size ) |
|
inline |
Constructor.
- Parameters
-
[in] | data | Pointer to the data. |
[in] | size | Size of the data. |
Definition at line 153 of file binary.h.
◆ binary() [4/7]
Constructor.
- Parameters
-
Definition at line 165 of file binary.h.
◆ binary() [5/7]
msgpack_light::binary::binary |
( |
const std::vector< unsigned char > & | data | ) |
|
|
inlineexplicit |
Constructor.
- Parameters
-
Definition at line 172 of file binary.h.
◆ binary() [6/7]
msgpack_light::binary::binary |
( |
std::initializer_list< unsigned char > | data | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 180 of file binary.h.
◆ binary() [7/7]
msgpack_light::binary::binary |
( |
std::string_view | data_string | ) |
|
|
inlineexplicit |
Constructor.
- Note
- This function accepts hex expression of data written with numeric characters from 0 to 9 and uppercase characters from A to F.
- Warning
- Current implementation doesn't accept lowercase characters from a to f.
- Parameters
-
[in] | data_string | Hex expression of data. |
Definition at line 195 of file binary.h.
◆ append()
void msgpack_light::binary::append |
( |
const unsigned char * | data, |
|
|
std::size_t | size ) |
|
inline |
Append another binary data.
- Parameters
-
[in] | data | Pointer to the appended data. |
[in] | size | Size of the appended data. |
Definition at line 257 of file binary.h.
◆ capacity()
std::size_t msgpack_light::binary::capacity |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the size of the internal buffer for data.
- Returns
- Size of the internal buffer.
Definition at line 327 of file binary.h.
◆ data() [1/2]
const unsigned char * msgpack_light::binary::data |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the pointer to the data.
- Returns
- Pointer to the data.
Definition at line 311 of file binary.h.
◆ data() [2/2]
unsigned char * msgpack_light::binary::data |
( |
| ) |
|
|
inlinenodiscardnoexcept |
Get the pointer to the data.
- Returns
- Pointer to the data.
Definition at line 304 of file binary.h.
◆ operator!=()
bool msgpack_light::binary::operator!= |
( |
const binary & | other | ) |
const |
|
inlinenodiscardnoexcept |
Compare with another instance.
- Parameters
-
[in] | other | Another instance. |
- Return values
-
true | Two instances are not equal. |
false | Two instances are equal. |
Definition at line 350 of file binary.h.
◆ operator+=()
binary & msgpack_light::binary::operator+= |
( |
const binary & | other | ) |
|
|
inline |
Append another binary data.
- Parameters
-
[in] | other | Another binary data to append. |
- Returns
- This.
Definition at line 274 of file binary.h.
◆ operator==()
bool msgpack_light::binary::operator== |
( |
const binary & | other | ) |
const |
|
inlinenodiscardnoexcept |
Compare with another instance.
- Parameters
-
[in] | other | Another instance. |
- Return values
-
true | Two instances are equal. |
false | Two instances are not equal. |
Definition at line 338 of file binary.h.
◆ operator[]() [1/2]
unsigned char msgpack_light::binary::operator[] |
( |
std::size_t | index | ) |
const |
|
inlinenodiscardnoexcept |
Access to a byte.
- Parameters
-
[in] | index | Index of the byte. |
- Returns
- Value of the byte.
Definition at line 295 of file binary.h.
◆ operator[]() [2/2]
unsigned char & msgpack_light::binary::operator[] |
( |
std::size_t | index | ) |
|
|
inlinenodiscardnoexcept |
Access to a byte.
- Parameters
-
[in] | index | Index of the byte. |
- Returns
- Reference to the byte.
Definition at line 285 of file binary.h.
◆ reserve()
void msgpack_light::binary::reserve |
( |
std::size_t | size | ) |
|
|
inline |
Change the size of the internal buffer.
This function preserves the existing data and its size.
- Parameters
-
Definition at line 245 of file binary.h.
◆ resize()
void msgpack_light::binary::resize |
( |
std::size_t | size | ) |
|
|
inline |
Change the size of this data.
This function preserves the existing data. Additional bytes will be left uninitialized.
- Parameters
-
Definition at line 231 of file binary.h.
◆ size()
std::size_t msgpack_light::binary::size |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the size of the data.
- Returns
- Size of the data.
Definition at line 320 of file binary.h.
◆ buffer_
◆ size_
std::size_t msgpack_light::binary::size_ |
|
private |
The documentation for this class was generated from the following file: