1#ifndef PROTOZERO_BASIC_PBF_BUILDER_HPP 
    2#define PROTOZERO_BASIC_PBF_BUILDER_HPP 
   40template <
typename TBuffer, 
typename T>
 
   43    static_assert(std::is_same<pbf_tag_type, std::underlying_type_t<T>>::value,
 
   44                  "T must be enum with underlying type protozero::pbf_tag_type");
 
   51    basic_pbf_builder() = 
default;
 
   75#define PROTOZERO_WRITER_WRAP_ADD_SCALAR(name, type) \ 
   76    void add_##name(T tag, type value) { \ 
   77        basic_pbf_writer<TBuffer>::add_##name(pbf_tag_type(tag), value); \ 
   80    PROTOZERO_WRITER_WRAP_ADD_SCALAR(
bool, 
bool)
 
   81    PROTOZERO_WRITER_WRAP_ADD_SCALAR(
enum, int32_t)
 
   82    PROTOZERO_WRITER_WRAP_ADD_SCALAR(int32, int32_t)
 
   83    PROTOZERO_WRITER_WRAP_ADD_SCALAR(sint32, int32_t)
 
   84    PROTOZERO_WRITER_WRAP_ADD_SCALAR(uint32, uint32_t)
 
   85    PROTOZERO_WRITER_WRAP_ADD_SCALAR(int64, int64_t)
 
   86    PROTOZERO_WRITER_WRAP_ADD_SCALAR(sint64, int64_t)
 
   87    PROTOZERO_WRITER_WRAP_ADD_SCALAR(uint64, uint64_t)
 
   88    PROTOZERO_WRITER_WRAP_ADD_SCALAR(fixed32, uint32_t)
 
   89    PROTOZERO_WRITER_WRAP_ADD_SCALAR(sfixed32, int32_t)
 
   90    PROTOZERO_WRITER_WRAP_ADD_SCALAR(fixed64, uint64_t)
 
   91    PROTOZERO_WRITER_WRAP_ADD_SCALAR(sfixed64, int64_t)
 
   92    PROTOZERO_WRITER_WRAP_ADD_SCALAR(
float, 
float)
 
   93    PROTOZERO_WRITER_WRAP_ADD_SCALAR(
double, 
double)
 
   95#undef PROTOZERO_WRITER_WRAP_ADD_SCALAR 
  105    void add_bytes(T tag, 
const char* value, std::size_t size) {
 
 
  159    template <
typename... Ts>
 
  171    void add_string(T tag, 
const char* value, std::size_t size) {
 
 
  238#define PROTOZERO_WRITER_WRAP_ADD_PACKED(name) \ 
  239    template <typename InputIterator> \ 
  240    void add_packed_##name(T tag, InputIterator first, InputIterator last) { \ 
  241        basic_pbf_writer<TBuffer>::add_packed_##name(pbf_tag_type(tag), first, last); \ 
  244    PROTOZERO_WRITER_WRAP_ADD_PACKED(
bool)
 
  245    PROTOZERO_WRITER_WRAP_ADD_PACKED(
enum)
 
  246    PROTOZERO_WRITER_WRAP_ADD_PACKED(int32)
 
  247    PROTOZERO_WRITER_WRAP_ADD_PACKED(sint32)
 
  248    PROTOZERO_WRITER_WRAP_ADD_PACKED(uint32)
 
  249    PROTOZERO_WRITER_WRAP_ADD_PACKED(int64)
 
  250    PROTOZERO_WRITER_WRAP_ADD_PACKED(sint64)
 
  251    PROTOZERO_WRITER_WRAP_ADD_PACKED(uint64)
 
  252    PROTOZERO_WRITER_WRAP_ADD_PACKED(fixed32)
 
  253    PROTOZERO_WRITER_WRAP_ADD_PACKED(sfixed32)
 
  254    PROTOZERO_WRITER_WRAP_ADD_PACKED(fixed64)
 
  255    PROTOZERO_WRITER_WRAP_ADD_PACKED(sfixed64)
 
  256    PROTOZERO_WRITER_WRAP_ADD_PACKED(
float)
 
  257    PROTOZERO_WRITER_WRAP_ADD_PACKED(
double)
 
  259#undef PROTOZERO_WRITER_WRAP_ADD_PACKED 
 
 
Contains the basic_pbf_writer template class.
void add_bytes_vectored(T tag, Ts &&... values)
Definition basic_pbf_builder.hpp:160
void add_string(T tag, const char *value)
Definition basic_pbf_builder.hpp:202
void add_message(T tag, const char *value, std::size_t size)
Definition basic_pbf_builder.hpp:213
T enum_type
The type of messages this class will build.
Definition basic_pbf_builder.hpp:49
void add_bytes(T tag, const char *value)
Definition basic_pbf_builder.hpp:136
void add_message(T tag, const data_view &value)
Definition basic_pbf_builder.hpp:223
void add_string(T tag, const char *value, std::size_t size)
Definition basic_pbf_builder.hpp:171
void add_string(T tag, const std::string &value)
Definition basic_pbf_builder.hpp:191
void add_string(T tag, const data_view &value)
Definition basic_pbf_builder.hpp:181
void add_bytes(T tag, const char *value, std::size_t size)
Definition basic_pbf_builder.hpp:105
void add_bytes(T tag, const data_view &value)
Definition basic_pbf_builder.hpp:115
basic_pbf_builder(basic_pbf_writer< TBuffer > &parent_writer, P tag)
Definition basic_pbf_builder.hpp:70
void add_message(T tag, const std::string &value)
Definition basic_pbf_builder.hpp:233
void add_bytes(T tag, const std::string &value)
Definition basic_pbf_builder.hpp:125
basic_pbf_builder(TBuffer &data) noexcept
Definition basic_pbf_builder.hpp:58
void add_string(pbf_tag_type tag, const char *value, std::size_t size)
Definition basic_pbf_writer.hpp:617
void add_bytes(pbf_tag_type tag, const char *value, std::size_t size)
Definition basic_pbf_writer.hpp:540
void add_bytes_vectored(pbf_tag_type tag, Ts &&... values)
Definition basic_pbf_writer.hpp:599
basic_pbf_writer(TBuffer &buffer) noexcept
Definition basic_pbf_writer.hpp:236
void add_message(pbf_tag_type tag, const char *value, std::size_t size)
Definition basic_pbf_writer.hpp:659
Definition data_view.hpp:39
All parts of the protozero header-only library are in this namespace.
Definition basic_pbf_builder.hpp:24
uint32_t pbf_tag_type
Definition types.hpp:33
Contains the declaration of low-level types used in the pbf format.