Devel Lib
Devel::Serializing::IJsonNumber< T > Class Template Reference

Represents a JSON number data type and provides serialization and deserialization functionality for arithmetic types. More...

#include <JsonSerializableNumber.h>

Inheritance diagram for Devel::Serializing::IJsonNumber< T >:
Collaboration diagram for Devel::Serializing::IJsonNumber< T >:

Public Member Functions

 IJsonNumber (const CJsonFieldName i_oFieldName)
 Constructs an IJsonNumber object with the specified field name. More...
 
auto & operator= (const T &i_tValue)
 Assigns a value to the IJsonNumber object. More...
 
auto & operator= (T &&i_tValue)
 Assigns a rvalue to the IJsonNumber object. More...
 
- Public Member Functions inherited from Devel::Serializing::IJsonType< T, IArithmetic< T > >
bool doDeserialize (IO::CJsonObject &i_oObject, const bool i_bIsStrict=false)
 Deserializes the object from a JSON object. More...
 
bool doSerialize (IO::CJsonObject &i_oObject, const bool i_bIsStrict=false) const
 Serializes the object to a JSON object. More...
 
size_t size () const override
 Retrieves the size of the object. More...
 
IJsonTypeoperator= (const TJsonFieldName &i_tValue)
 Assigns a JSON field name to the object. More...
 
IJsonTypeoperator= (TJsonFieldName &&i_tValue)
 Assigns a JSON field name to the object (move assignment). More...
 
- Public Member Functions inherited from Devel::Serializing::IArithmetic< T, IsHidden, >
 CreateSerializeOperators (T, IsHidden)
 
- Public Member Functions inherited from Devel::Serializing::IData< T, false >
virtual ~IData ()=default
 Default destructor.
 
bool doSerialize (IO::CWriteStream &i_oStream) const
 Serializes the data to a write stream. More...
 
bool doDeserialize (IO::CReadStream &i_oStream)
 Deserializes the data from a read stream. More...
 
bool doDeserialize (const char *i_szString)
 Deserializes the data from a string. More...
 
bool doDeserialize (std::vector< std::string >::const_iterator &i_oIt, const std::vector< std::string >::const_iterator &i_oItEnd)
 Deserializes the data from a range of strings. More...
 
virtual bool isHidden () const
 Returns whether the field is hidden. More...
 
virtual SCompareData compareData () const
 Returns the compare data for the data field. More...
 
auto begin () const
 Returns an iterator pointing to the beginning of the value. More...
 
auto end () const
 Returns an iterator pointing to the end of the value. More...
 
auto & operator[] (const size_t i_nIndex)
 Returns a reference to the value at the specified index. More...
 
const auto & operator[] (const size_t i_nIndex) const
 Returns a const reference to the value at the specified index. More...
 
 SerializerEnableIfNotArithmetic (IData< T > &) operator--()
 Pre-decrement operator. More...
 
 SerializerEnableIfNotArithmetic (IData< T > &) operator--(int)
 Post-decrement operator. More...
 
 SerializerEnableIfNotArithmetic (IData< T > &) operator++()
 Pre-increment operator. More...
 
 SerializerEnableIfNotArithmetic (IData< T > &) operator++(int)
 Post-increment operator. More...
 
- Public Member Functions inherited from Devel::Serializing::IValue< T >
template<typename ... TArgs, std::enable_if_t< std::is_constructible_v< T, TArgs... >> * = nullptr>
 IValue (TArgs... i_tArgs)
 Constructs an IValue object with the specified arguments. More...
 
const T & value () const
 Returns the value. More...
 
T & value ()
 Returns a reference to the value. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Devel::Serializing::IJsonType< T, IArithmetic< T > >
 IJsonType (const CJsonFieldName i_oFieldName)
 Constructs an IJsonType object with the specified JSON field name. More...
 
virtual ~IJsonType ()=default
 Destructor.
 
virtual bool onSerialize (IO::CJsonObject &i_oObject, const bool i_bIsStrict) const
 Called during serialization to convert the object to a JSON object. More...
 
virtual bool onSerialize (IO::CJsonObject &i_oObject) const
 Called during deserialization to populate the object from a JSON object (non-strict mode). More...
 
bool serialize (IO::CJsonObject &i_oObject, const bool i_bIsStrict=false) const
 Serializes the data to a JSON object. More...
 
std::string_view name () const
 Retrieves the name of the JSON field. More...
 
bool isNull () const
 Checks if the JSON field is null. More...
 
void setNull (bool i_bState)
 Sets the null state of the JSON field. More...
 
IO::CJsonObjectgetObject (IO::CJsonObject &i_oObject, const bool i_bIsStrict)
 Retrieves the JSON object for the specified JSON field. More...
 
bool checkSerializeObject (IO::CJsonObject &i_oObject, const bool i_bIsStrict) const
 Checks if serialization of the object is allowed and handles null fields. More...
 
- Protected Attributes inherited from Devel::Serializing::IValue< T >
m_tValue
 The value.
 

Detailed Description

template<typename T>
class Devel::Serializing::IJsonNumber< T >

Represents a JSON number data type and provides serialization and deserialization functionality for arithmetic types.

Template Parameters
TThe underlying arithmetic type.

Constructor & Destructor Documentation

◆ IJsonNumber()

template<typename T >
Devel::Serializing::IJsonNumber< T >::IJsonNumber ( const CJsonFieldName  i_oFieldName)
inline

Constructs an IJsonNumber object with the specified field name.

Parameters
i_oFieldNameThe field name for the JSON number.

Member Function Documentation

◆ operator=() [1/2]

template<typename T >
auto& Devel::Serializing::IJsonNumber< T >::operator= ( const T &  i_tValue)
inline

Assigns a value to the IJsonNumber object.

Parameters
i_tValueThe value to assign.
Returns
A reference to the IJsonNumber object.

◆ operator=() [2/2]

template<typename T >
auto& Devel::Serializing::IJsonNumber< T >::operator= ( T &&  i_tValue)
inline

Assigns a rvalue to the IJsonNumber object.

Parameters
i_tValueThe rvalue to assign.
Returns
A reference to the IJsonNumber object.

The documentation for this class was generated from the following file: