1#ifndef PROTOZERO_BUFFER_STRING_HPP
2#define PROTOZERO_BUFFER_STRING_HPP
33struct buffer_customization<std::string> {
35 static std::size_t size(
const std::string* buffer)
noexcept {
36 return buffer->size();
39 static void append(std::string* buffer,
const char* data, std::size_t count) {
40 buffer->append(data, count);
43 static void append_zeros(std::string* buffer, std::size_t count) {
44 buffer->append(count,
'\0');
47 static void resize(std::string* buffer, std::size_t size) {
48 protozero_assert(size < buffer->size());
52 static void reserve_additional(std::string* buffer, std::size_t size) {
53 buffer->reserve(buffer->size() + size);
56 static void erase_range(std::string* buffer, std::size_t from, std::size_t to) {
57 protozero_assert(from <= buffer->size());
58 protozero_assert(to <= buffer->size());
59 protozero_assert(from <= to);
60 buffer->erase(std::next(buffer->begin(),
static_cast<std::string::iterator::difference_type
>(from)),
61 std::next(buffer->begin(),
static_cast<std::string::iterator::difference_type
>(to)));
64 static char* at_pos(std::string* buffer, std::size_t pos) {
65 protozero_assert(pos <= buffer->size());
66 return (&*buffer->begin()) + pos;
69 static void push_back(std::string* buffer,
char ch) {
70 buffer->push_back(ch);
Contains the customization points for buffer implementations.
Contains macro checks for different configurations.
All parts of the protozero header-only library are in this namespace.
Definition basic_pbf_builder.hpp:24