|
StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
|
The class to serialize and deserialize data. More...
#include <serializable.hxx>
Public Member Functions | |
| Serializable (const DecayedT &data) noexcept | |
| The constructor of the Serializable class. | |
| Serializable (const Serializable &other) noexcept=delete | |
| The copy constructor of the Serializable class. | |
| Serializable (Serializable &&other) noexcept=delete | |
| The move constructor of the Serializable class. | |
| ~Serializable () noexcept=default | |
| The destructor of the Serializable class. | |
| Serializable & | operator= (const Serializable &other) noexcept=delete |
| The assignment operator of the Serializable class. | |
| Serializable & | operator= (Serializable &&other) noexcept=delete |
| The move assignment operator of the Serializable class. | |
| std::vector< std::byte > | Serialize () const noexcept |
| Serializes the data into a byte vector. | |
Static Public Member Functions | |
| static StormByte::Expected< T, DeserializeError > | Deserialize (std::span< const std::byte > data) noexcept |
| Deserializes data from a byte span. | |
| static StormByte::Expected< T, DeserializeError > | Deserialize (const std::vector< std::byte > &data) noexcept |
| Deserializes data from a byte vector. | |
| static std::size_t | Size (const DecayedT &data) noexcept |
| Calculates the serialized size of the data. | |
The class to serialize and deserialize data.
| T | The type of the data to serialize and deserialize. |
|
inlinenoexcept |
The constructor of the Serializable class.
| data | The data to serialize. |
|
deletenoexcept |
The copy constructor of the Serializable class.
| other | The other Serializable to copy. |
|
deletenoexcept |
The move constructor of the Serializable class.
| other | The other Serializable to move. |
|
inlinestaticnoexcept |
Deserializes data from a byte vector.
This function automatically selects the appropriate deserialization method based on the type of data: trivial types, containers, pairs, optionals, or complex types.
| data | The byte vector containing the serialized data. |
|
inlinestaticnoexcept |
Deserializes data from a byte span.
This function is a convenience overload that accepts a std::span of bytes and forwards it to the vector-based Deserialize function.
| data | The byte span containing the serialized data. |
|
deletenoexcept |
The assignment operator of the Serializable class.
| other | The other Serializable to assign. |
|
deletenoexcept |
The move assignment operator of the Serializable class.
| other | The other Serializable to assign. |
|
inlinenoexcept |
Serializes the data into a byte vector.
This function automatically selects the appropriate serialization method based on the type of data: trivial types, containers, pairs, optionals, or complex types.
|
inlinestaticnoexcept |
Calculates the serialized size of the data.
This function computes the size in bytes that the serialized data will occupy.
| data | The data to calculate the size for. |