|
JASSv2
|
Functions to read a protobuf buffer. More...
#include <protobuf.h>
Public Types | |
| enum | wire_type { VARINT = 0, SIXTY_FOUR_BIT = 1, BLOB = 2, GROUP_START = 3, GROUP_END = 4, THIRTY_TWO_BIT = 5 } |
| The known protobuf types for protobuf 3. More... | |
Static Public Member Functions | |
| static uint64_t | get_uint64_t (const uint8_t *&stream) |
| static uint64_t | get_int64_t (const uint8_t *&stream) |
| static uint32_t | get_uint32_t (const uint8_t *&stream) |
| static int32_t | get_int32_t (const uint8_t *&stream) |
| static slice | get_blob (const uint8_t *&stream) |
| static uint64_t | get_64_t (const uint8_t *&stream) |
| static uint32_t | get_32_t (const uint8_t *&stream) |
| static double | get_double (const uint8_t *&stream) |
| static uint8_t | get_type_and_field (wire_type &type, const uint8_t *&stream) |
| Extract the field number and its type from the stream. More... | |
Static Private Member Functions | |
| static int64_t | un_zigzag (uint64_t bits) |
| Turn unsigned ZigZaged integer into a signed integer. More... | |
Functions to read a protobuf buffer.
For details of the encoding see: https://developers.google.com/protocol-buffers/docs/encoding This class is written to be standalone from JASSv2 so that others can use it without including all of JASSv2
The known protobuf types for protobuf 3.
|
inlinestatic |
Extract the field number and its type from the stream.
The spec (https://developers.google.com/protocol-buffers/docs/encoding) states: "Each key in the streamed message is a varint with the value (field_number << 3) | wire_type" ... "in other words, the last three bits of the number store the wire type.".
| type | [out] The type of the field |
| stream | [in, out] A reference to a pointer to the start of the value, points to the next byte on return. |
|
inlinestaticprivate |
Turn unsigned ZigZaged integer into a signed integer.
The spec (https://developers.google.com/protocol-buffers/docs/encoding) states: "ZigZag encoding maps signed integers to unsigned integers so that numbers with a small absolute value (for instance, -1) have a small varint encoded value too. It does this in a way that "zig-zags" back and forth through the positive and negative integers, so that -1 is encoded as 1, 1 is encodedas 2, -2 is encoded as 3, and so on". This method undoes the encoding.
| bits | [in] The ZigZag encoding to convert |
1.8.13