Nameless Engine
Loading...
Searching...
No Matches
ne::IBinaryFieldSerializer Class Referenceabstract

#include <IBinaryFieldSerializer.hpp>

Inheritance diagram for ne::IBinaryFieldSerializer:
ne::MeshDataBinaryFieldSerializer

Public Member Functions

virtual bool isFieldTypeSupported (const rfk::Field *pField)=0
 
virtual std::variant< std::string, ErrorserializeField (const std::filesystem::path &pathToOutputDirectory, const std::string &sFilenameWithoutExtension, Serializable *pFieldOwner, const rfk::Field *pField)=0
 
virtual std::optional< ErrordeserializeField (const std::filesystem::path &pathToBinaryFile, Serializable *pFieldOwner, const rfk::Field *pField)=0
 

Detailed Description

Interface for implementing support for binary serialization of new field types.

Remarks
Same as IFieldSerializer but stores data in binary form providing smaller size, faster deserialization but sacrificing readability of the file.

Member Function Documentation

◆ deserializeField()

virtual std::optional< Error > ne::IBinaryFieldSerializer::deserializeField ( const std::filesystem::path &  pathToBinaryFile,
Serializable pFieldOwner,
const rfk::Field *  pField 
)
pure virtual

Deserializes data from a binary file into the specified field.

Parameters
pathToBinaryFilePath to the binary file to deserialize.
pFieldOwnerField's owner.
pFieldField to deserialize TOML value to.
Returns
Error if something went wrong, empty otherwise.

Implemented in ne::MeshDataBinaryFieldSerializer.

◆ isFieldTypeSupported()

virtual bool ne::IBinaryFieldSerializer::isFieldTypeSupported ( const rfk::Field *  pField)
pure virtual

Tests if this serializer supports serialization/deserialization of this field.

Parameters
pFieldField to test for serialization/deserialization support.
Returns
true if this serializer can be used to serialize this field, false otherwise.

Implemented in ne::MeshDataBinaryFieldSerializer.

◆ serializeField()

virtual std::variant< std::string, Error > ne::IBinaryFieldSerializer::serializeField ( const std::filesystem::path &  pathToOutputDirectory,
const std::string &  sFilenameWithoutExtension,
Serializable pFieldOwner,
const rfk::Field *  pField 
)
pure virtual

Serializes the specified field into a binary file.

Parameters
pathToOutputDirectoryPath to the directory where the resulting file will be located.
sFilenameWithoutExtensionName of the resulting file without extension.
pFieldOwnerField's owner.
pFieldField to serialize.
Returns
Error if something went wrong, otherwise file extension with a starting dot, for example: .meshbin.

Implemented in ne::MeshDataBinaryFieldSerializer.


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