1 #ifndef PROTOZERO_TYPES_HPP 2 #define PROTOZERO_TYPES_HPP 53 #ifdef PROTOZERO_USE_VIEW 84 constexpr
data_view(
const char* data, std::size_t size) noexcept
106 m_size(std::strlen(data)) {
116 swap(m_data, other.m_data);
117 swap(m_size, other.m_size);
121 constexpr
const char*
data() const noexcept {
126 constexpr std::size_t
size() const noexcept {
136 protozero_assert(m_data);
137 return std::string{m_data, m_size};
145 explicit operator std::string()
const {
146 protozero_assert(m_data);
147 return std::string{m_data, m_size};
170 return lhs.size() == rhs.size() && !std::strcmp(lhs.data(), rhs.data());
181 return !(lhs == rhs);
189 #endif // PROTOZERO_TYPES_HPP data_view(const std::string &str) noexcept
Definition: types.hpp:94
std::string to_string() const
Definition: types.hpp:135
Contains macro checks for different configurations.
bool operator!=(data_view &lhs, data_view &rhs) noexcept
Definition: types.hpp:180
void swap(iterator_range< T > &lhs, iterator_range< T > &rhs) noexcept
Definition: iterators.hpp:152
data_view(const char *data) noexcept
Definition: types.hpp:104
constexpr std::size_t size() const noexcept
Return length of data in bytes.
Definition: types.hpp:126
pbf_wire_type
Definition: types.hpp:39
constexpr data_view() noexcept
Definition: types.hpp:73
void swap(data_view &other) noexcept
Definition: types.hpp:114
uint32_t pbf_length_type
Definition: types.hpp:51
constexpr data_view(const char *data, std::size_t size) noexcept
Definition: types.hpp:84
uint32_t pbf_tag_type
Definition: types.hpp:32
constexpr const char * data() const noexcept
Return pointer to data.
Definition: types.hpp:121
bool operator==(data_view &lhs, data_view &rhs) noexcept
Definition: types.hpp:169
All parts of the protozero header-only library are in this namespace.
Definition: byteswap.hpp:24
void swap(data_view &lhs, data_view &rhs) noexcept
Definition: types.hpp:158