Nameless Engine
|
#include <IFieldSerializer.hpp>
Public Member Functions | |
virtual bool | isFieldTypeSupported (const rfk::Field *pField)=0 |
virtual std::optional< Error > | serializeField (toml::value *pTomlData, Serializable *pFieldOwner, const rfk::Field *pField, const std::string &sSectionName, const std::string &sEntityId, size_t &iSubEntityId, Serializable *pOriginalObject=nullptr)=0 |
virtual std::optional< Error > | deserializeField (const toml::value *pTomlDocument, const toml::value *pTomlValue, Serializable *pFieldOwner, const rfk::Field *pField, const std::string &sOwnerSectionName, const std::string &sEntityId, std::unordered_map< std::string, std::string > &customAttributes)=0 |
virtual std::optional< Error > | cloneField (Serializable *pFromInstance, const rfk::Field *pFromField, Serializable *pToInstance, const rfk::Field *pToField)=0 |
virtual bool | isFieldValueEqual (Serializable *pFieldAOwner, const rfk::Field *pFieldA, Serializable *pFieldBOwner, const rfk::Field *pFieldB)=0 |
Interface for implementing support for serialization of new field types.
By implementing this interface and registering it in the FieldSerializerManager class you can add support for serialization/deserialization of new field types and extend serialization/deserialization functionality for Serializable derived classes.
|
pure virtual |
Clones field's data from one object to another.
pFromInstance | Instance to copy the field from. |
pFromField | Field to copy. |
pToInstance | Instance to copy to. |
pToField | Field to copy to. |
Implemented in ne::GlmVecFieldSerializer, ne::PrimitiveFieldSerializer, ne::SerializableObjectFieldSerializer, ne::StringFieldSerializer, ne::UnorderedMapFieldSerializer, and ne::VectorFieldSerializer.
|
pure virtual |
Deserializes field from a TOML value.
pTomlDocument | TOML document that contains a value to deserialize. |
pTomlValue | TOML value to deserialize the field from. |
pFieldOwner | Field's owner. |
pField | Field to deserialize TOML value to. |
sOwnerSectionName | Name of the TOML section where is field was found. |
sEntityId | Current ID string of the entity (field owner) that we are deserializing. |
customAttributes | Pairs of values that were found with this object in TOML data. Only found when deserializing a field of type that derives from Serializable. |
Implemented in ne::GlmVecFieldSerializer, ne::PrimitiveFieldSerializer, ne::SerializableObjectFieldSerializer, ne::StringFieldSerializer, ne::UnorderedMapFieldSerializer, and ne::VectorFieldSerializer.
|
pure virtual |
Tests if this serializer supports serialization/deserialization of this field.
pField | Field to test for serialization/deserialization support. |
true
if this serializer can be used to serialize this field, false
otherwise. Implemented in ne::GlmVecFieldSerializer, ne::PrimitiveFieldSerializer, ne::SerializableObjectFieldSerializer, ne::StringFieldSerializer, ne::UnorderedMapFieldSerializer, and ne::VectorFieldSerializer.
|
pure virtual |
Checks if the specified fields' values are equal or not.
pFieldAOwner | Owner of the field A. |
pFieldA | Field A to compare. |
pFieldBOwner | Owner of the field B. |
pFieldB | Field B to compare. |
false
if some field is unsupported by this serializer or if fields' values are not equal, true
otherwise. Implemented in ne::GlmVecFieldSerializer, ne::PrimitiveFieldSerializer, ne::SerializableObjectFieldSerializer, ne::StringFieldSerializer, ne::UnorderedMapFieldSerializer, and ne::VectorFieldSerializer.
|
pure virtual |
Serializes field into a TOML value.
pTomlData | TOML value to serialize the field to. |
pFieldOwner | Field's owner. |
pField | Field to serialize. |
sSectionName | Name of the section (for TOML value) to use for this field. |
sEntityId | Current ID string of the entity (field owner) that we are serializing. Only used when serializing a field of type that derives from Serializable. |
iSubEntityId | Current ID of the sub entity (sub entity of the field owner). Only used when serializing a field of type that derives from Serializable. |
pOriginalObject | Optional. Original object of the same type as the object being serialized, this object is a deserialized version of the object being serialized, used to compare serializable fields' values and only serialize changed values. Only used when serializing a field of type that derives from Serializable. |
Implemented in ne::GlmVecFieldSerializer, ne::PrimitiveFieldSerializer, ne::SerializableObjectFieldSerializer, ne::StringFieldSerializer, ne::UnorderedMapFieldSerializer, and ne::VectorFieldSerializer.