ORE Studio 0.0.4
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
writer Class Reference

Helper class to write binary data in network byte order. More...

#include <writer.hpp>

Collaboration diagram for writer:
Collaboration graph

Static Public Member Functions

static void write_uint8 (std::vector< std::byte > &buffer, std::uint8_t value)
 Write a single byte.
 
static void write_uint16 (std::vector< std::byte > &buffer, std::uint16_t value)
 Write a 16-bit integer in network byte order.
 
static void write_uint32 (std::vector< std::byte > &buffer, std::uint32_t value)
 Write a 32-bit integer in network byte order.
 
static void write_int64 (std::vector< std::byte > &buffer, std::int64_t value)
 Write a signed 64-bit integer in network byte order.
 
static void write_uint64 (std::vector< std::byte > &buffer, std::uint64_t value)
 Write an unsigned 64-bit integer in network byte order.
 
static void write_string (std::vector< std::byte > &buffer, const std::string &str)
 Write a string with 16-bit length prefix.
 
static void write_string32 (std::vector< std::byte > &buffer, const std::string &str)
 Write a string with 32-bit length prefix.
 
static void write_bool (std::vector< std::byte > &buffer, bool value)
 Write a boolean (1 byte).
 
static void write_uuid (std::vector< std::byte > &buffer, const boost::uuids::uuid &uuid)
 Write a UUID (16 bytes).
 
static void write_tenant_id (std::vector< std::byte > &buffer, const uuid::tenant_id &tenant_id)
 Write a tenant_id (16 bytes UUID).
 

Detailed Description

Helper class to write binary data in network byte order.

Provides static methods to serialize various data types into a byte buffer. All multi-byte integers are written in big-endian (network) byte order.

Member Function Documentation

◆ write_string()

void write_string ( std::vector< std::byte > &  buffer,
const std::string &  str 
)
static

Write a string with 16-bit length prefix.

Note
Maximum string length is 65535 bytes. For larger strings, use write_string32.

◆ write_string32()

void write_string32 ( std::vector< std::byte > &  buffer,
const std::string &  str 
)
static

Write a string with 32-bit length prefix.

Use this for strings that may exceed 65535 bytes (e.g., SVG data, large text).

◆ write_tenant_id()

void write_tenant_id ( std::vector< std::byte > &  buffer,
const uuid::tenant_id tenant_id 
)
static

Write a tenant_id (16 bytes UUID).

Writes the underlying UUID bytes of the tenant_id.