3 #include "Core/Global.h"
4 #include "Serializing/Json/JsonSerializableType.h"
5 #include "Serializing/Json/JsonSerializer.h"
15 template<
typename TStruct>
27 bool onDeserialize(
IO::CJsonObject &i_oObject,
const bool i_bIsStrict)
final {
34 throw DifferentTypesException;
44 bool onSerialize(IO::CJsonObject &i_oObject,
const bool i_bIsStrict)
const final {
55 bool onDeserialize(IO::CJsonObject &i_oObject)
final {
56 return this->onDeserialize(i_oObject,
false);
62 bool onSerialize(IO::CJsonObject &i_oObject)
const final {
63 return this->onSerialize(i_oObject,
false);
67 using IJsonType<TStruct, IData<TStruct>>
::IJsonType;
82 this->
m_tValue = std::move(i_tValue);
A class that encapsulates a JSON object.
Definition: JsonObject.h:50
EJsonType type() const
Returns the type of the JSON object.
Definition: JsonObject.h:123
A class representing a JSON field name.
Definition: JsonFieldName.h:49
Template class representing a data field.
Definition: SerializableData.h:86
Represents a JSON structure data type and provides serialization and deserialization functionality.
Definition: JsonSerializableStruct.h:16
IJsonStruct(const CJsonFieldName i_oFieldName)
Constructs an IJsonStruct object with the specified field name.
Definition: JsonSerializableStruct.h:20
IJsonStruct & operator=(TStruct &&i_tValue)
Assigns an rvalue to the IJsonStruct object.
Definition: JsonSerializableStruct.h:81
IJsonStruct & operator=(const TStruct &i_tValue)
Assigns a value to the IJsonStruct object.
Definition: JsonSerializableStruct.h:72
Represents a JSON data type with serialization and deserialization functionality.
Definition: JsonSerializableType.h:84
IO::CJsonObject * getObject(IO::CJsonObject &i_oObject, const bool i_bIsStrict)
Retrieves the JSON object for the specified JSON field.
Definition: JsonSerializableType.h:177
void setNull(bool i_bState)
Sets the null state of the JSON field.
Definition: JsonSerializableType.h:169
bool checkSerializeObject(IO::CJsonObject &i_oObject, const bool i_bIsStrict) const
Checks if serialization of the object is allowed and handles null fields.
Definition: JsonSerializableType.h:200
IJsonType(const CJsonFieldName i_oFieldName)
Constructs an IJsonType object with the specified JSON field name.
Definition: JsonSerializableType.h:88
int m_tValue
The value.
Definition: SerializableData.h:78
@ JTObject
An object type (an unordered set of name/value pairs).
The namespace encapsulating serializing related functionality in the Devel framework.
bool SerializeObject(const T &i_oStruct, IO::CJsonObject &i_oObject, const bool i_bIsStrict=false, size_t i_nStructSize=sizeof(T))
Serializes a struct into a JSON object.
Definition: JsonSerializer.h:51
bool DeserializeObject(T &i_oStruct, IO::CJsonObject &i_oObject, const bool i_bIsStrict=false, size_t i_nStructSize=sizeof(T))
Deserializes a JSON object into a struct.
Definition: JsonSerializer.h:17