Nameless Engine
Loading...
Searching...
No Matches
StringFieldSerializer.h
1#pragma once
2
3// Custom.
4#include "io/serializers/IFieldSerializer.hpp"
5
6namespace ne {
11 public:
12 StringFieldSerializer() = default;
13 virtual ~StringFieldSerializer() override = default;
14
22 virtual bool isFieldTypeSupported(const rfk::Field* pField) override;
23
42 [[nodiscard]] virtual std::optional<Error> serializeField(
43 toml::value* pTomlData,
44 Serializable* pFieldOwner,
45 const rfk::Field* pField,
46 const std::string& sSectionName,
47 const std::string& sEntityId,
48 size_t& iSubEntityId,
49 Serializable* pOriginalObject = nullptr) override;
50
66 [[nodiscard]] virtual std::optional<Error> deserializeField(
67 const toml::value* pTomlDocument,
68 const toml::value* pTomlValue,
69 Serializable* pFieldOwner,
70 const rfk::Field* pField,
71 const std::string& sOwnerSectionName,
72 const std::string& sEntityId,
73 std::unordered_map<std::string, std::string>& customAttributes) override;
74
85 [[nodiscard]] virtual std::optional<Error> cloneField(
86 Serializable* pFromInstance,
87 const rfk::Field* pFromField,
88 Serializable* pToInstance,
89 const rfk::Field* pToField) override;
90
102 virtual bool isFieldValueEqual(
103 Serializable* pFieldAOwner,
104 const rfk::Field* pFieldA,
105 Serializable* pFieldBOwner,
106 const rfk::Field* pFieldB) override;
107
108 private:
110 static inline const std::string sStringCanonicalTypeName = "std::basic_string<char>";
111 };
112} // namespace ne
Definition: IFieldSerializer.hpp:33
Definition: Serializable.h:113
Definition: StringFieldSerializer.h:10
virtual bool isFieldTypeSupported(const rfk::Field *pField) override
Definition: StringFieldSerializer.cpp:7
virtual std::optional< Error > cloneField(Serializable *pFromInstance, const rfk::Field *pFromField, Serializable *pToInstance, const rfk::Field *pToField) override
Definition: StringFieldSerializer.cpp:69
virtual bool isFieldValueEqual(Serializable *pFieldAOwner, const rfk::Field *pFieldA, Serializable *pFieldBOwner, const rfk::Field *pFieldB) override
Definition: StringFieldSerializer.cpp:89
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: StringFieldSerializer.cpp:13
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: StringFieldSerializer.cpp:37
static const std::string sStringCanonicalTypeName
Definition: StringFieldSerializer.h:110