protozero 1.7.1
Minimalistic protocol buffer decoder and encoder in C++.
|
#include <data_view.hpp>
Public Member Functions | |
constexpr | data_view () noexcept=default |
constexpr | data_view (const char *ptr, std::size_t length) noexcept |
data_view (const std::string &str) noexcept | |
data_view (const char *ptr) 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. | |
constexpr bool | empty () const noexcept |
Returns true if size is 0. | |
std::string | to_string () const |
operator std::string () const | |
int | compare (data_view other) const noexcept |
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.
|
constexprdefaultnoexcept |
Default constructor. Construct an empty data_view.
|
inlineconstexprnoexcept |
Create data_view from pointer and size.
ptr | Pointer to the data. |
length | Length of the data. |
|
inlinenoexcept |
Create data_view from string.
str | String with the data. |
|
inlinenoexcept |
Create data_view from zero-terminated string.
ptr | Pointer to the data. |
|
inlinenoexcept |
Compares the contents of this object with the given other object.
|
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.