![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Thrift Compact Protocol reader. More...
#include <compact.hpp>
Public Member Functions | |
| CompactDecoder (const uint8_t *data, size_t size) | |
| Construct a decoder over a byte buffer. | |
| FieldHeader | read_field_header () |
| Read a field header. | |
| bool | read_bool () |
| Read a boolean value. | |
| int8_t | read_i8 () |
| Read an 8-bit signed integer (single raw byte, I8 wire type). | |
| int32_t | read_i32 () |
| Read a 32-bit integer (zigzag + varint decode). | |
| int64_t | read_i64 () |
| Read a 64-bit integer (zigzag + varint64 decode). | |
| double | read_double () |
| Read a double (8 bytes little-endian, IEEE 754). | |
| float | read_float () |
| Read a float (4 bytes little-endian, IEEE 754). | |
| std::string | read_string () |
| Read a string (varint-length-prefixed UTF-8 bytes). | |
| std::vector< uint8_t > | read_binary () |
| Read raw binary data (varint-length-prefixed bytes). | |
| ListHeader | read_list_header () |
| Read a list header. Returns element type and count. | |
| void | skip_field (uint8_t thrift_type) |
| Skip a field without parsing its value. | |
| void | begin_struct () |
| Push a new field-ID context for reading a nested struct. | |
| void | end_struct () |
| Pop the field-ID context after finishing a nested struct. | |
| size_t | remaining () const |
| Returns the number of bytes remaining in the buffer. | |
| size_t | position () const |
| Returns the current read position (offset from start of buffer). | |
| bool | good () const |
| Returns true if no errors have occurred (no bounds violations). | |
Thrift Compact Protocol reader.
Reads Thrift Compact Protocol data from a caller-owned byte buffer. All read operations perform bounds checking and set an internal error flag on overflow, after which all subsequent reads return zero/empty values and good() returns false.
Hardening limits:
Definition at line 267 of file compact.hpp.
|
inline |
Construct a decoder over a byte buffer.
The buffer must remain valid for the lifetime of the decoder.
| data | Pointer to the Thrift Compact Protocol byte buffer. |
| size | Total buffer size in bytes. |
Definition at line 274 of file compact.hpp.
|
inline |
Push a new field-ID context for reading a nested struct.
Definition at line 508 of file compact.hpp.
|
inline |
Pop the field-ID context after finishing a nested struct.
Definition at line 515 of file compact.hpp.
|
inline |
Returns true if no errors have occurred (no bounds violations).
Definition at line 531 of file compact.hpp.
|
inline |
Returns the current read position (offset from start of buffer).
Definition at line 528 of file compact.hpp.
|
inline |
Read raw binary data (varint-length-prefixed bytes).
Definition at line 390 of file compact.hpp.
|
inline |
Read a boolean value.
If the bool was embedded in a field header (types 1/2), returns that cached value. Otherwise reads a single byte.
Definition at line 332 of file compact.hpp.
|
inline |
Read a double (8 bytes little-endian, IEEE 754).
Definition at line 358 of file compact.hpp.
|
inline |
Read a field header.
Returns {0, 0} for the STOP marker. For bool fields (types 1 and 2), the value is captured internally and returned by a subsequent read_bool() call.
Definition at line 285 of file compact.hpp.
|
inline |
Read a float (4 bytes little-endian, IEEE 754).
Definition at line 369 of file compact.hpp.
|
inline |
Read a 32-bit integer (zigzag + varint decode).
Definition at line 348 of file compact.hpp.
|
inline |
Read a 64-bit integer (zigzag + varint64 decode).
Definition at line 353 of file compact.hpp.
|
inline |
Read an 8-bit signed integer (single raw byte, I8 wire type).
Definition at line 342 of file compact.hpp.
|
inline |
Read a list header. Returns element type and count.
Definition at line 400 of file compact.hpp.
|
inline |
Read a string (varint-length-prefixed UTF-8 bytes).
Definition at line 380 of file compact.hpp.
|
inline |
Returns the number of bytes remaining in the buffer.
Definition at line 523 of file compact.hpp.
|
inline |
Skip a field without parsing its value.
Used for forward compatibility when encountering unknown field IDs.
Definition at line 427 of file compact.hpp.