protozero
Minimalistic protocol buffer decoder and encoder in C++.
|
#include <types.hpp>
Public Member Functions | |
constexpr | data_view () noexcept |
constexpr | data_view (const char *data, std::size_t size) noexcept |
data_view (const std::string &str) noexcept | |
data_view (const char *data) noexcept | |
void | swap (data_view &other) noexcept |
constexpr const char * | data () const noexcept |
Return pointer to data. | |
constexpr std::size_t | size () const noexcept |
Return length of data in bytes. | |
std::string | to_string () const |
operator std::string () const | |
Holds a pointer to some data and a length.
This class is supposed to be compatible with the std::string_view that will be available in C++17.
|
inlinenoexcept |
Default constructor. Construct an empty data_view.
|
inlinenoexcept |
Create data_view from pointer and size.
data | Pointer to the data. |
size | Length of the data. |
|
inlinenoexcept |
Create data_view from string.
str | String with the data. |
|
inlinenoexcept |
Create data_view from zero-terminated string.
data | Pointer to the data. |
|
inlineexplicit |
Convert data view to string.
|
inlinenoexcept |
Swap the contents of this object with the other.
other | Other object to swap data with. |
|
inline |
Convert data view to string.