pbf_message.hpp
Go to the documentation of this file.
#ifndef PROTOZERO_PBF_MESSAGE_HPP
#define PROTOZERO_PBF_MESSAGE_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 <type_traits>
#include <protozero/pbf_reader.hpp>
#include <protozero/pbf_types.hpp>
namespace protozero {
template <typename T>
class pbf_message : public pbf_reader {
static_assert(std::is_same<pbf_tag_type, typename std::underlying_type<T>::type>::value, "T must be enum with underlying type protozero::pbf_tag_type");
public:
using enum_type = T;
template <typename... Args>
pbf_message(Args&&... args) noexcept :
pbf_reader(std::forward<Args>(args)...) {
}
inline bool next() {
return pbf_reader::next();
}
inline bool next(T tag) {
return pbf_reader::next(pbf_tag_type(tag));
}
inline T tag() const noexcept {
return T(pbf_reader::tag());
}
};
} // end namespace protozero
#endif // PROTOZERO_PBF_MESSAGE_HPP
protozero::pbf_reader::pbf_reader
pbf_reader() noexcept=default
pbf_types.hpp
Contains the declaration of low-level types used in the pbf format.
protozero::pbf_tag_type
uint32_t pbf_tag_type
Definition: pbf_types.hpp:26
protozero::pbf_message
Definition: pbf_message.hpp:65
pbf_reader.hpp
Contains the pbf_reader class.
protozero::pbf_reader::tag
pbf_tag_type tag() const noexcept
Definition: pbf_reader.hpp:897
protozero::pbf_reader
Definition: pbf_reader.hpp:61
protozero::pbf_reader::next
bool next()
Definition: pbf_reader.hpp:860
protozero
All parts of the protozero header-only library are in this namespace.
Definition: byteswap.hpp:24