3 #include "Serializing/Core/Types/SerializableArithmetic.h"
4 #include "Serializing/Json/JsonSerializableType.h"
25 bool onDeserialize(
IO::CJsonObject &i_oObject,
const bool i_bIsStrict)
override {
26 auto *pObject = this->
getObject(i_oObject, i_bIsStrict);
31 if (std::is_same_v<T, float>) {
32 this->
operator=(
static_cast<T
>(pObject->toFloat()));
33 }
else if (std::is_same_v<T, double>) {
34 this->
operator=(
static_cast<T
>(pObject->toDouble()));
35 }
else if (
sizeof(T) == 8) {
36 this->
operator=(
static_cast<T
>(pObject->toUInt64()));
38 this->
operator=(
static_cast<T
>(pObject->toInt()));
41 throw DifferentTypesException;
51 bool onSerialize(IO::CJsonObject &i_oObject,
const bool i_bIsStrict)
override {
52 return this->
serialize(i_oObject, i_bIsStrict);
58 bool onDeserialize(IO::CJsonObject &i_oObject)
final {
59 return this->onDeserialize(i_oObject,
false);
65 bool onSerialize(IO::CJsonObject &i_oObject)
final {
66 return this->onSerialize(i_oObject,
false);
A class that encapsulates a JSON object.
Definition: JsonObject.h:50
A class representing a JSON field name.
Definition: JsonFieldName.h:49
Class representing an arithmetic value for serialization.
Definition: SerializableArithmetic.h:19
Represents a JSON number data type and provides serialization and deserialization functionality for a...
Definition: JsonSerializableNumber.h:14
auto & operator=(T &&i_tValue)
Assigns a rvalue to the IJsonNumber object.
Definition: JsonSerializableNumber.h:84
IJsonNumber(const CJsonFieldName i_oFieldName)
Constructs an IJsonNumber object with the specified field name.
Definition: JsonSerializableNumber.h:18
auto & operator=(const T &i_tValue)
Assigns a value to the IJsonNumber object.
Definition: JsonSerializableNumber.h:75
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
bool serialize(IO::CJsonObject &i_oObject, const bool i_bIsStrict=false) const
Serializes the data to a JSON object.
Definition: JsonSerializableType.h:142
void setNull(bool i_bState)
Sets the null state of the JSON field.
Definition: JsonSerializableType.h:169
IJsonType(const CJsonFieldName i_oFieldName)
Constructs an IJsonType object with the specified JSON field name.
Definition: JsonSerializableType.h:88
T m_tValue
The value.
Definition: SerializableData.h:78
The namespace encapsulating serializing related functionality in the Devel framework.
IJsonNumber< short > IJsonShort
Typedef for IJsonNumber<short>.
Definition: JsonSerializableNumber.h:96
IJsonNumber< double > IJsonDouble
Typedef for IJsonNumber<double>.
Definition: JsonSerializableNumber.h:110
IJsonNumber< char > IJsonChar
Typedef for IJsonNumber<char>
Definition: JsonSerializableNumber.h:92
IJsonNumber< float > IJsonFloat
Typedef for IJsonNumber<float>.
Definition: JsonSerializableNumber.h:108
IJsonNumber< uint > IJsonUInt
Typedef for IJsonNumber<uint>.
Definition: JsonSerializableNumber.h:102
IJsonNumber< int64 > IJsonInt64
Typedef for IJsonNumber<int64>.
Definition: JsonSerializableNumber.h:104
IJsonNumber< int > IJsonInt
Typedef for IJsonNumber<int>.
Definition: JsonSerializableNumber.h:100
IJsonNumber< ushort > IJsonUShort
Typedef for IJsonNumber<ushort>.
Definition: JsonSerializableNumber.h:98
IJsonNumber< uint64 > IJsonUInt64
Typedef for IJsonNumber<uint64>.
Definition: JsonSerializableNumber.h:106
IJsonNumber< byte > IJsonByte
Typedef for IJsonNumber<byte>.
Definition: JsonSerializableNumber.h:94