types.hpp
Go to the documentation of this file.
#ifndef PROTOZERO_TYPES_HPP
#define PROTOZERO_TYPES_HPP
/*****************************************************************************
protozero - Minimalistic protocol buffer decoder and encoder in C++.
This file is from https://github.com/mapbox/protozero where you can find more
documentation.
*****************************************************************************/
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <string>
#include <utility>
#include <protozero/config.hpp>
namespace protozero {
using pbf_tag_type = uint32_t;
enum class pbf_wire_type : uint32_t {
varint = 0, // int32/64, uint32/64, sint32/64, bool, enum
fixed64 = 1, // fixed64, sfixed64, double
length_delimited = 2, // string, bytes, embedded messages,
// packed repeated fields
fixed32 = 5, // fixed32, sfixed32, float
unknown = 99 // used for default setting in this library
};
template <typename T>
constexpr inline uint32_t tag_and_type(T tag, pbf_wire_type wire_type) noexcept {
return (static_cast<uint32_t>(static_cast<pbf_tag_type>(tag)) << 3) | static_cast<uint32_t>(wire_type);
}
using pbf_length_type = uint32_t;
} // end namespace protozero
#endif // PROTOZERO_TYPES_HPP
protozero::tag_and_type
constexpr uint32_t tag_and_type(T tag, pbf_wire_type wire_type) noexcept
Definition: types.hpp:56
config.hpp
Contains macro checks for different configurations.
protozero::pbf_wire_type
pbf_wire_type
Definition: types.hpp:40
protozero::pbf_length_type
uint32_t pbf_length_type
Definition: types.hpp:63
protozero::pbf_tag_type
uint32_t pbf_tag_type
Definition: types.hpp:33
protozero
All parts of the protozero header-only library are in this namespace.
Definition: byteswap.hpp:24