Nameless Engine
Loading...
Searching...
No Matches
VectorFieldSerializer.h
1#pragma once
2
3// Custom.
4#include "io/serializers/IFieldSerializer.hpp"
5
6namespace ne {
14 public:
15 VectorFieldSerializer() = default;
16 virtual ~VectorFieldSerializer() override = default;
17
25 virtual bool isFieldTypeSupported(const rfk::Field* pField) override;
26
45 [[nodiscard]] virtual std::optional<Error> serializeField(
46 toml::value* pTomlData,
47 Serializable* pFieldOwner,
48 const rfk::Field* pField,
49 const std::string& sSectionName,
50 const std::string& sEntityId,
51 size_t& iSubEntityId,
52 Serializable* pOriginalObject = nullptr) override;
53
69 [[nodiscard]] virtual std::optional<Error> deserializeField(
70 const toml::value* pTomlDocument,
71 const toml::value* pTomlValue,
72 Serializable* pFieldOwner,
73 const rfk::Field* pField,
74 const std::string& sOwnerSectionName,
75 const std::string& sEntityId,
76 std::unordered_map<std::string, std::string>& customAttributes) override;
77
88 [[nodiscard]] virtual std::optional<Error> cloneField(
89 Serializable* pFromInstance,
90 const rfk::Field* pFromField,
91 Serializable* pToInstance,
92 const rfk::Field* pToField) override;
93
105 virtual bool isFieldValueEqual(
106 Serializable* pFieldAOwner,
107 const rfk::Field* pFieldA,
108 Serializable* pFieldBOwner,
109 const rfk::Field* pFieldB) override;
110
111 private:
120 static bool isMostInnerTypeSerializable(const std::string& sFieldCanonicalTypeName);
121
123 static inline const std::string sStringCanonicalTypeName = "std::basic_string<char>";
124 };
125} // namespace ne
Definition: IFieldSerializer.hpp:33
Definition: Serializable.h:113
Definition: VectorFieldSerializer.h:13
virtual bool isFieldValueEqual(Serializable *pFieldAOwner, const rfk::Field *pFieldA, Serializable *pFieldBOwner, const rfk::Field *pFieldB) override
Definition: VectorFieldSerializer.cpp:474
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) override
Definition: VectorFieldSerializer.cpp:50
static const std::string sStringCanonicalTypeName
Definition: VectorFieldSerializer.h:123
virtual std::optional< Error > cloneField(Serializable *pFromInstance, const rfk::Field *pFromField, Serializable *pToInstance, const rfk::Field *pToField) override
Definition: VectorFieldSerializer.cpp:403
static bool isMostInnerTypeSerializable(const std::string &sFieldCanonicalTypeName)
Definition: VectorFieldSerializer.cpp:536
virtual bool isFieldTypeSupported(const rfk::Field *pField) override
Definition: VectorFieldSerializer.cpp:12
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) override
Definition: VectorFieldSerializer.cpp:157