|
ORE Studio 0.0.4
|
Helper class to read binary data in network byte order. More...
#include <reader.hpp>

Static Public Member Functions | |
| static std::expected< std::uint8_t, error_code > | read_uint8 (std::span< const std::byte > &data) |
| Read a single byte. | |
| static std::expected< std::uint16_t, error_code > | read_uint16 (std::span< const std::byte > &data) |
| Read a 16-bit integer in network byte order. | |
| static std::expected< std::uint32_t, error_code > | read_uint32 (std::span< const std::byte > &data) |
| Read a 32-bit integer in network byte order. | |
| static std::expected< std::uint32_t, error_code > | read_count (std::span< const std::byte > &data, std::uint32_t max_count=MAX_ELEMENT_COUNT) |
| Read a 32-bit count with validation against maximum. | |
| static std::expected< std::int64_t, error_code > | read_int64 (std::span< const std::byte > &data) |
| Read a signed 64-bit integer in network byte order. | |
| static std::expected< std::uint64_t, error_code > | read_uint64 (std::span< const std::byte > &data) |
| Read an unsigned 64-bit integer in network byte order. | |
| static std::expected< std::string, error_code > | read_string (std::span< const std::byte > &data) |
| Read a string with 16-bit length prefix. | |
| static std::expected< std::string, error_code > | read_string32 (std::span< const std::byte > &data) |
| Read a string with 32-bit length prefix. | |
| static std::expected< boost::uuids::uuid, error_code > | read_uuid (std::span< const std::byte > &data) |
| Read a UUID (16 bytes). | |
| static std::expected< uuid::tenant_id, error_code > | read_tenant_id (std::span< const std::byte > &data) |
| Read a tenant_id (16 bytes UUID with validation). | |
| static std::expected< bool, error_code > | read_bool (std::span< const std::byte > &data) |
| Read a boolean (1 byte). | |
Helper class to read binary data in network byte order.
Provides static methods to deserialize various data types from a byte span. All multi-byte integers are read in big-endian (network) byte order. The span is advanced past the read data on success.
|
static |
Read a 32-bit count with validation against maximum.
Use this for reading collection sizes to prevent memory exhaustion from corrupted data. Returns limit_exceeded if count > max_count.
| data | The byte span to read from (advanced on success). |
| max_count | Maximum allowed count (default: MAX_ELEMENT_COUNT). |
|
static |
Read a string with 16-bit length prefix.
|
static |
Read a string with 32-bit length prefix.
Use this for strings that may exceed 65535 bytes (e.g., SVG data, large text).
|
static |
Read a tenant_id (16 bytes UUID with validation).
Reads a UUID and converts it to a tenant_id. Returns invalid_request error if the UUID is nil (which is rejected by tenant_id::from_uuid).