|
protozero
Minimalistic protocol buffer decoder and encoder in C++.
|
#include <pbf_message.hpp>


Additional Inherited Members | |
Public Types inherited from protozero::pbf_reader | |
| using | const_bool_iterator = const_varint_iterator< int32_t > |
| Forward iterator for iterating over bool (int32 varint) values. | |
| using | const_enum_iterator = const_varint_iterator< int32_t > |
| Forward iterator for iterating over enum (int32 varint) values. | |
| using | const_int32_iterator = const_varint_iterator< int32_t > |
| Forward iterator for iterating over int32 (varint) values. | |
| using | const_sint32_iterator = const_svarint_iterator< int32_t > |
| Forward iterator for iterating over sint32 (varint) values. | |
| using | const_uint32_iterator = const_varint_iterator< uint32_t > |
| Forward iterator for iterating over uint32 (varint) values. | |
| using | const_int64_iterator = const_varint_iterator< int64_t > |
| Forward iterator for iterating over int64 (varint) values. | |
| using | const_sint64_iterator = const_svarint_iterator< int64_t > |
| Forward iterator for iterating over sint64 (varint) values. | |
| using | const_uint64_iterator = const_varint_iterator< uint64_t > |
| Forward iterator for iterating over uint64 (varint) values. | |
Public Member Functions inherited from protozero::pbf_reader | |
| pbf_reader (const data_view &view) noexcept | |
| pbf_reader (const char *data, std::size_t size) noexcept | |
| pbf_reader (const std::pair< const char *, std::size_t > &data) noexcept | |
| pbf_reader (const std::string &data) noexcept | |
| pbf_reader () noexcept=default | |
| pbf_reader (const pbf_reader &) noexcept=default | |
| pbf_reader messages can be copied trivially. | |
| pbf_reader (pbf_reader &&) noexcept=default | |
| pbf_reader messages can be moved trivially. | |
| pbf_reader & | operator= (const pbf_reader &other) noexcept=default |
| pbf_reader messages can be copied trivially. | |
| pbf_reader & | operator= (pbf_reader &&other) noexcept=default |
| pbf_reader messages can be moved trivially. | |
| void | swap (pbf_reader &other) noexcept |
| operator bool () const noexcept | |
| std::size_t | length () const noexcept |
| bool | next () |
| bool | next (pbf_tag_type next_tag) |
| bool | next (pbf_tag_type next_tag, pbf_wire_type wire_type) |
| pbf_tag_type | tag () const noexcept |
| pbf_wire_type | wire_type () const noexcept |
| uint32_t | tag_and_type () const noexcept |
| bool | has_wire_type (pbf_wire_type type) const noexcept |
| void | skip () |
| bool | get_bool () |
| int32_t | get_enum () |
| int32_t | get_int32 () |
| int32_t | get_sint32 () |
| uint32_t | get_uint32 () |
| int64_t | get_int64 () |
| int64_t | get_sint64 () |
| uint64_t | get_uint64 () |
| uint32_t | get_fixed32 () |
| int32_t | get_sfixed32 () |
| uint64_t | get_fixed64 () |
| int64_t | get_sfixed64 () |
| float | get_float () |
| double | get_double () |
| data_view | get_view () |
| std::pair< const char *, pbf_length_type > | get_data () |
| std::string | get_bytes () |
| std::string | get_string () |
| pbf_reader | get_message () |
| iterator_range < pbf_reader::const_bool_iterator > | get_packed_bool () |
| iterator_range < pbf_reader::const_enum_iterator > | get_packed_enum () |
| iterator_range < pbf_reader::const_int32_iterator > | get_packed_int32 () |
| iterator_range < pbf_reader::const_sint32_iterator > | get_packed_sint32 () |
| iterator_range < pbf_reader::const_uint32_iterator > | get_packed_uint32 () |
| iterator_range < pbf_reader::const_int64_iterator > | get_packed_int64 () |
| iterator_range < pbf_reader::const_sint64_iterator > | get_packed_sint64 () |
| iterator_range < pbf_reader::const_uint64_iterator > | get_packed_uint64 () |
| auto | get_packed_fixed32 () -> decltype(packed_fixed< uint32_t >()) |
| auto | get_packed_sfixed32 () -> decltype(packed_fixed< int32_t >()) |
| auto | get_packed_fixed64 () -> decltype(packed_fixed< uint64_t >()) |
| auto | get_packed_sfixed64 () -> decltype(packed_fixed< int64_t >()) |
| auto | get_packed_float () -> decltype(packed_fixed< float >()) |
| auto | get_packed_double () -> decltype(packed_fixed< double >()) |
This class represents a protobuf message. Either a top-level message or a nested sub-message. Top-level messages can be created from any buffer with a pointer and length:
Sub-messages are created using get_message():
All methods of the pbf_message class except get_bytes() and get_string() provide the strong exception guarantee, ie they either succeed or do not change the pbf_message object they are called on. Use the get_data() method instead of get_bytes() or get_string(), if you need this guarantee.
This template class is based on the pbf_reader class and has all the same methods. The difference is that whereever the pbf_reader class takes an integer tag, this template class takes a tag of the template type T.
Read the tutorial to understand how this class is used.
1.8.8