StormByte 3.0.0
C++26 foundation of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Detail::Codec< std::string > Struct Reference

StormByte::Detail::Codec specialization for std::string. More...

#include <StormByte/serializable.hxx>

Static Public Member Functions

static ByteSize Size (const std::string &data) noexcept
 Serialized size of data.
static Safe::Binary Write (const std::string &data) noexcept
 Encodes data.
static Expected< std::string, DeserializeError > Read (std::span< const std::byte > data) noexcept
 Decodes a string from the start of data.

Detailed Description

StormByte::Detail::Codec specialization for std::string.

Wire: uint64 byte count (LE) + raw bytes. No encoding transform.

Member Function Documentation

◆ Read()

STORMBYTE_FORCE_INLINE Expected< std::string, DeserializeError > StormByte::Detail::Codec< std::string >::Read ( std::span< const std::byte > data)
staticnoexcept

Decodes a string from the start of data.

Parameters
dataInput span.
Returns
Value, or StormByte::DeserializeError. The string is built in the caller. The DLL returns StormByte::Safe::String.

◆ Size()

ByteSize StormByte::Detail::Codec< std::string >::Size ( const std::string & data)
staticnoexcept

Serialized size of data.

Parameters
dataValue to measure.
Returns
Size in bytes as ByteSize.

◆ Write()

Safe::Binary StormByte::Detail::Codec< std::string >::Write ( const std::string & data)
staticnoexcept

Encodes data.

Parameters
dataValue to encode.
Returns
Blob owned by Base.

The documentation for this struct was generated from the following file: