protozero  1.7.0
Minimalistic protocol buffer decoder and encoder in C++.
buffer_tmpl.hpp
Go to the documentation of this file.
1 #ifndef PROTOZERO_BUFFER_TMPL_HPP
2 #define PROTOZERO_BUFFER_TMPL_HPP
3 
4 /*****************************************************************************
5 
6 protozero - Minimalistic protocol buffer decoder and encoder in C++.
7 
8 This file is from https://github.com/mapbox/protozero where you can find more
9 documentation.
10 
11 *****************************************************************************/
12 
19 #include <cstddef>
20 #include <iterator>
21 #include <string>
22 
23 namespace protozero {
24 
25 // Implementation of buffer customizations points for std::string
26 
28 template <typename T>
29 struct buffer_customization {
30 
37  static std::size_t size(const std::string* buffer);
38 
46  static void append(std::string* buffer, const char* data, std::size_t count);
47 
54  static void append_zeros(std::string* buffer, std::size_t count);
55 
65  static void resize(std::string* buffer, std::size_t size);
66 
75  static void reserve_additional(std::string* buffer, std::size_t size);
76 
87  static void erase_range(std::string* buffer, std::size_t from, std::size_t to);
88 
98  static char* at_pos(std::string* buffer, std::size_t pos);
99 
106  static void push_back(std::string* buffer, char ch);
107 
108 };
110 
111 } // namespace protozero
112 
113 #endif // PROTOZERO_BUFFER_TMPL_HPP
protozero
All parts of the protozero header-only library are in this namespace.
Definition: basic_pbf_builder.hpp:24