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

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

#include <StormByte/serializable.hxx>

Static Public Member Functions

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

Detailed Description

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

Wire: uint64 UTF-8 byte count (LE) + UTF-8 payload. Host wchar_t width (2 on Windows, 4 on POSIX) never appears on the wire.

Member Function Documentation

◆ Read()

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

Decodes a wide string from the start of data.

Parameters
dataInput span.
Returns
Value, or StormByte::DeserializeError.

◆ Size()

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

Serialized size of data.

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

◆ Write()

static BinaryData StormByte::Detail::Codec< std::wstring >::Write ( const std::wstring &  data)
staticnoexcept

Encodes data.

Parameters
dataValue to encode.
Returns
Blob owned by Base.

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