Encodes and decodes one value of type T.
More...
#include <StormByte/serializable.hxx>
Public Member Functions | |
| Serializable (const DecayedT &data) noexcept | |
Binds data for a later StormByte::Serializable::Serialize. | |
| Serializable (const Serializable &other) noexcept=delete | |
| Copy is deleted: the wrapper only holds a reference. | |
| Serializable (Serializable &&other) noexcept=delete | |
| Move is deleted: the wrapper only holds a reference. | |
| ~Serializable () noexcept=default | |
| Destructor. | |
| Serializable & | operator= (const Serializable &other) noexcept=delete |
| Copy assignment is deleted. | |
| Serializable & | operator= (Serializable &&other) noexcept=delete |
| Move assignment is deleted. | |
| BinaryData | Serialize () const noexcept |
| Encodes the bound value to a little-endian blob. | |
Static Public Member Functions | |
| static Expected< T, DeserializeError > | Deserialize (std::span< const std::byte > data) noexcept |
Decodes one T from the start of data. | |
| static Expected< T, DeserializeError > | Deserialize (const BinaryData &data) noexcept |
Decodes one T from a StormByte::BinaryData. | |
| static ByteSize | Size (const DecayedT &data) noexcept |
Serialized size of data. | |
Encodes and decodes one value of type T.
| T | Type to serialize. Dispatch uses the undecayed T. |
Dispatch order is intentional: optional / pair / container run before trivially-copyable. std::optional<U> with trivial U may report is_trivially_copyable and copying its object representation includes padding (observed on MSVC).
Custom types: specialize StormByte::Detail::Codec, then this class routes them through the “complex” path automatically.
The blob is a StormByte::BinaryData. The wire layout is unchanged.
Type::String (string / wstring / u16string / u32string) is excluded from StormByte::Type::Container so those types hit Codec instead of being encoded as a sequence of code units. StormByte::CString and StormByte::WCString are not containers; they hit StormByte::Detail::Codec from the fallback in serializable.txx.
|
inlinenoexcept |
Binds data for a later StormByte::Serializable::Serialize.
| [in] | data | Value to encode. Must outlive this object. |
|
deletenoexcept |
Copy is deleted: the wrapper only holds a reference.
|
deletenoexcept |
Move is deleted: the wrapper only holds a reference.
|
defaultnoexcept |
Destructor.
|
staticnoexcept |
Decodes one T from a StormByte::BinaryData.
| [in] | data | Input blob. |
|
staticnoexcept |
Decodes one T from the start of data.
| [in] | data | Input span; may be longer than one value. |
|
deletenoexcept |
Copy assignment is deleted.
|
deletenoexcept |
Move assignment is deleted.
|
noexcept |
Encodes the bound value to a little-endian blob.
|
staticnoexcept |
Serialized size of data.
| [in] | data | Value to measure. |