|
Devel Lib
|
The namespace encapsulating serializing related functionality in the Devel framework. More...
Classes | |
| struct | SCompareData |
| Structure for comparing serialized data. More... | |
| class | IStruct |
| class | IField |
| Base class for fields. More... | |
| class | IValue |
| Template class representing a value. More... | |
| class | IData |
| Template class representing a data field. More... | |
| class | IArithmetic |
| Class representing an arithmetic value for serialization. More... | |
| class | IBool |
| A class representing a boolean value for serialization. More... | |
| class | ICharArray |
| A class representing a fixed-size character array for serialization. More... | |
| class | IString |
| A class representing a string value for serialization. More... | |
| class | IVector |
| A class representing a vector for serialization. More... | |
| class | IWString |
| A class representing a wide string value for serialization. More... | |
| class | CJsonFieldName |
| A class representing a JSON field name. More... | |
| class | IJsonType |
| Represents a JSON data type with serialization and deserialization functionality. More... | |
| class | IJsonArray |
| Represents a JSON array of a specific type. More... | |
| class | IJsonBool |
| Represents a JSON boolean data type for serialization and deserialization. More... | |
| class | IJsonNumber |
| Represents a JSON number data type and provides serialization and deserialization functionality for arithmetic types. More... | |
| class | IJsonString |
| Represents a JSON string data type and provides serialization and deserialization functionality. More... | |
| class | IJsonStruct |
| Represents a JSON structure data type and provides serialization and deserialization functionality. More... | |
Typedefs | |
| template<typename T > | |
| using | is_data_class = decltype(is_data_class_impl(std::declval< T * >())) |
| template<bool IsHidden = false> | |
| using | IChar = IArithmetic< char, IsHidden > |
| Alias for IArithmetic<char> representing a character value. | |
| template<bool IsHidden = false> | |
| using | IByte = IArithmetic< byte, IsHidden > |
| Alias for IArithmetic<byte> representing a byte value. | |
| template<bool IsHidden = false> | |
| using | IShort = IArithmetic< short, IsHidden > |
| Alias for IArithmetic<short> representing a short integer value. | |
| template<bool IsHidden = false> | |
| using | IUShort = IArithmetic< ushort, IsHidden > |
| Alias for IArithmetic<ushort> representing an unsigned short integer value. | |
| template<bool IsHidden = false> | |
| using | IInt = IArithmetic< int, IsHidden > |
| Alias for IArithmetic<int> representing an integer value. | |
| template<bool IsHidden = false> | |
| using | IUInt = IArithmetic< uint, IsHidden > |
| Alias for IArithmetic<uint> representing an unsigned integer value. | |
| template<bool IsHidden = false> | |
| using | IInt64 = IArithmetic< int64, IsHidden > |
| Alias for IArithmetic<int64> representing a 64-bit integer value. | |
| template<bool IsHidden = false> | |
| using | IUInt64 = IArithmetic< uint64, IsHidden > |
| Alias for IArithmetic<int64> representing a 64-bit integer value. | |
| template<typename T , bool IsHidden = false> | |
| using | IEnum = Devel::Serializing::IArithmetic< T, IsHidden > |
| Alias for IArithmetic representing an enumeration value. | |
| template<typename T > | |
| using | is_json_type_class = decltype(is_json_type_class_impl(std::declval< T * >())) |
| Checks if a type is a JSON type class. More... | |
| typedef IJsonNumber< char > | IJsonChar |
Typedef for IJsonNumber<char> | |
| typedef IJsonNumber< byte > | IJsonByte |
Typedef for IJsonNumber<byte>. | |
| typedef IJsonNumber< short > | IJsonShort |
Typedef for IJsonNumber<short>. | |
| typedef IJsonNumber< ushort > | IJsonUShort |
Typedef for IJsonNumber<ushort>. | |
| typedef IJsonNumber< int > | IJsonInt |
Typedef for IJsonNumber<int>. | |
| typedef IJsonNumber< uint > | IJsonUInt |
Typedef for IJsonNumber<uint>. | |
| typedef IJsonNumber< int64 > | IJsonInt64 |
Typedef for IJsonNumber<int64>. | |
| typedef IJsonNumber< uint64 > | IJsonUInt64 |
Typedef for IJsonNumber<uint64>. | |
| typedef IJsonNumber< float > | IJsonFloat |
Typedef for IJsonNumber<float>. | |
| typedef IJsonNumber< double > | IJsonDouble |
Typedef for IJsonNumber<double>. | |
Functions | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &i_oStream, const IValue< T > &i_tData) |
| Output stream operator for IValue. More... | |
| template<typename T > | |
| std::istream & | operator>> (std::istream &i_oStream, const IValue< T > &i_tData) |
| Input stream operator for IValue. More... | |
| template<typename T > | |
| std::wostream & | operator<< (std::wostream &i_oStream, const IValue< T > &i_tData) |
| Wide output stream operator for IValue. More... | |
| template<typename T > | |
| std::wistream & | operator>> (std::wistream &i_oStream, const IValue< T > &i_tData) |
| Wide input stream operator for IValue. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| bool | IterateSerializableStruct (const TStruct *i_pStruct, std::function< bool(const TStructFieldType *)> i_pCallback, const size_t i_nStructSize=sizeof(TStruct)) |
| Iterates over a serializable struct and applies a callback function to each field. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| bool | IterateSerializableStruct (const TStruct &i_oStruct, std::function< bool(const TStructFieldType *)> i_pCallback, const size_t i_nStructSize=sizeof(TStruct)) |
| Iterates over a serializable struct and applies a callback function to each field. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| bool | IterateDeserializableStruct (TStruct *i_pStruct, std::function< bool(TStructFieldType *)> i_pCallback, const size_t i_nStructSize=sizeof(TStruct)) |
| Iterates over a deserializable struct and applies a callback function to each field. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| bool | IterateDeserializableStruct (TStruct &i_oStruct, std::function< bool(TStructFieldType *)> i_pCallback, const size_t i_nStructSize=sizeof(TStruct)) |
| Iterates over a deserializable struct and applies a callback function to each field. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| std::vector< size_t > | GetSerializableFieldOffsets (const TStruct *i_pStruct, const bool i_fIncludeHidden=true, const size_t i_nStructSize=sizeof(TStruct)) |
| Gets the offsets of the serializable fields in a struct. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| std::vector< size_t > | GetSerializableFieldOffsets (const TStruct &i_oStruct, const bool i_fIncludeHidden=true, const size_t i_nStructSize=sizeof(TStruct)) |
| Gets the offsets of the serializable fields in a struct. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| TStructFieldType * | GetSerializableFieldByIndex (const TStruct *i_pStruct, const size_t i_nIndex) |
| Gets the offsets of the serializable fields in a struct. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| TStructFieldType * | GetSerializableFieldByIndex (const TStruct &i_oStruct, const size_t i_nIndex) |
| Gets a serializable field in a struct by index. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| bool | CompareSerializableStruct (TStruct *i_pStruct, TStruct *i_pCompareStruct, const bool i_fIncludeHidden=false) |
| Compares two serializable structs for equality. More... | |
| template<typename TStructFieldType = IData<>, typename TStruct > | |
| bool | CompareSerializableStruct (TStruct &i_oStruct, TStruct &i_oCompareStruct, const bool i_fIncludeHidden=false) |
| Compares two serializable structs for equality. More... | |
| std::false_type | is_data_class_impl (...) |
| Check if a type is a data class. More... | |
| template<typename T = int, bool IsHidden = false> | |
| std::true_type | is_data_class_impl (IData< T, IsHidden > *) |
| template<typename T > | |
| bool | SerializeStream (const T &i_oStruct, IO::CWriteStream &i_oStream) |
| Serializes a struct to a write stream. More... | |
| template<typename T > | |
| bool | DeserializeStream (T &i_oStruct, IO::CReadStream &i_oStream, size_t i_nStructSize=sizeof(T)) |
| Deserializes a struct from a read stream. More... | |
| template<typename TField , typename TStruct > | |
| TField * | GetJsonFieldByName (TStruct &i_oStruct, const std::string_view i_sName) |
| Retrieves a JSON field by name from a struct. More... | |
| std::false_type | is_json_type_class_impl (...) |
| template<typename T = int, typename TData = IData<T>> | |
| std::true_type | is_json_type_class_impl (IJsonType< T, TData > *) |
| template<typename T > | |
| 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. More... | |
| template<typename T > | |
| bool | DeserializeDocument (T &i_oStruct, IO::CJsonDocument &i_oDocument, const bool i_bIsStrict=false, size_t i_nStructSize=sizeof(T)) |
| Deserializes a JSON document into a struct. More... | |
| template<typename T > | |
| 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. More... | |
| template<typename T > | |
| bool | SerializeDocument (const T &i_oStruct, IO::CJsonDocument &i_oDocument, const bool i_bIsStrict=false, size_t i_nStructSize=sizeof(T)) |
| Serializes a struct into a JSON document. More... | |
The namespace encapsulating serializing related functionality in the Devel framework.
| using Devel::Serializing::is_json_type_class = typedef decltype(is_json_type_class_impl(std::declval<T *>())) |
Checks if a type is a JSON type class.
| T | The type to check. |
| bool Devel::Serializing::CompareSerializableStruct | ( | TStruct & | i_oStruct, |
| TStruct & | i_oCompareStruct, | ||
| const bool | i_fIncludeHidden = false |
||
| ) |
Compares two serializable structs for equality.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_oStruct | The first struct object. |
| i_oCompareStruct | The second struct object. |
| i_fIncludeHidden | Flag indicating whether to include hidden fields in the comparison. |
true if the structs are equal, false otherwise. | bool Devel::Serializing::CompareSerializableStruct | ( | TStruct * | i_pStruct, |
| TStruct * | i_pCompareStruct, | ||
| const bool | i_fIncludeHidden = false |
||
| ) |
Compares two serializable structs for equality.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_pStruct | Pointer to the first struct object. |
| i_pCompareStruct | Pointer to the second struct object. |
| i_fIncludeHidden | Flag indicating whether to include hidden fields in the comparison. |
true if the structs are equal, false otherwise. | bool Devel::Serializing::DeserializeDocument | ( | T & | i_oStruct, |
| IO::CJsonDocument & | i_oDocument, | ||
| const bool | i_bIsStrict = false, |
||
| size_t | i_nStructSize = sizeof(T) |
||
| ) |
Deserializes a JSON document into a struct.
| T | The type of the struct. |
| i_oStruct | The struct to deserialize into. |
| i_oDocument | The JSON document to deserialize. |
| i_bIsStrict | Determines if strict deserialization should be used. |
| i_nStructSize | The size of the struct in bytes. |
| bool Devel::Serializing::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.
| T | The type of the struct. |
| i_oStruct | The struct to deserialize into. |
| i_oObject | The JSON object to deserialize. |
| i_bIsStrict | Determines if strict deserialization should be used. |
| i_nStructSize | The size of the struct in bytes. |
| bool Devel::Serializing::DeserializeStream | ( | T & | i_oStruct, |
| IO::CReadStream & | i_oStream, | ||
| size_t | i_nStructSize = sizeof(T) |
||
| ) |
Deserializes a struct from a read stream.
| T | The type of the struct. |
| i_oStruct | The struct object to deserialize into. |
| i_oStream | The read stream to deserialize from. |
| i_nStructSize | The size of the struct in bytes. |
true if deserialization was successful, false otherwise. | TooLessDataInPacketException | If there is not enough data in the packet to deserialize into the struct. |
| IO::NoBufferException | If the read stream has no buffer. |
| TField* Devel::Serializing::GetJsonFieldByName | ( | TStruct & | i_oStruct, |
| const std::string_view | i_sName | ||
| ) |
Retrieves a JSON field by name from a struct.
| TField | The type of the JSON field. |
| TStruct | The type of the struct. |
| i_oStruct | The struct to search within. |
| i_sName | The name of the JSON field to retrieve. |
| TStructFieldType* Devel::Serializing::GetSerializableFieldByIndex | ( | const TStruct & | i_oStruct, |
| const size_t | i_nIndex | ||
| ) |
Gets a serializable field in a struct by index.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_pStruct | Pointer to the struct object. |
| i_nIndex | The index of the field. |
| TStructFieldType* Devel::Serializing::GetSerializableFieldByIndex | ( | const TStruct * | i_pStruct, |
| const size_t | i_nIndex | ||
| ) |
Gets the offsets of the serializable fields in a struct.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_oStruct | The struct object. |
| i_fIncludeHidden | Flag indicating whether to include hidden fields. |
| i_nStructSize | The size of the struct in bytes. |
| std::vector<size_t> Devel::Serializing::GetSerializableFieldOffsets | ( | const TStruct & | i_oStruct, |
| const bool | i_fIncludeHidden = true, |
||
| const size_t | i_nStructSize = sizeof(TStruct) |
||
| ) |
Gets the offsets of the serializable fields in a struct.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_pStruct | Pointer to the struct object. |
| i_fIncludeHidden | Flag indicating whether to include hidden fields. |
| i_nStructSize | The size of the struct in bytes. |
| std::vector<size_t> Devel::Serializing::GetSerializableFieldOffsets | ( | const TStruct * | i_pStruct, |
| const bool | i_fIncludeHidden = true, |
||
| const size_t | i_nStructSize = sizeof(TStruct) |
||
| ) |
Gets the offsets of the serializable fields in a struct.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_pStruct | Pointer to the struct object. |
| i_fIncludeHidden | Flag indicating whether to include hidden fields. |
| i_nStructSize | The size of the struct in bytes. |
| std::false_type Devel::Serializing::is_data_class_impl | ( | ... | ) |
Check if a type is a data class.
| T | The type to check. |
true if the type is a data class, false otherwise. | bool Devel::Serializing::IterateDeserializableStruct | ( | TStruct & | i_oStruct, |
| std::function< bool(TStructFieldType *)> | i_pCallback, | ||
| const size_t | i_nStructSize = sizeof(TStruct) |
||
| ) |
Iterates over a deserializable struct and applies a callback function to each field.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_oStruct | The struct object. |
| i_pCallback | The callback function to apply to each field. |
| i_nStructSize | The size of the struct in bytes. |
true if the iteration was completed without early termination, false otherwise. | bool Devel::Serializing::IterateDeserializableStruct | ( | TStruct * | i_pStruct, |
| std::function< bool(TStructFieldType *)> | i_pCallback, | ||
| const size_t | i_nStructSize = sizeof(TStruct) |
||
| ) |
Iterates over a deserializable struct and applies a callback function to each field.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_pStruct | Pointer to the struct object. |
| i_pCallback | The callback function to apply to each field. |
| i_nStructSize | The size of the struct in bytes. |
true if the iteration was completed without early termination, false otherwise. | bool Devel::Serializing::IterateSerializableStruct | ( | const TStruct & | i_oStruct, |
| std::function< bool(const TStructFieldType *)> | i_pCallback, | ||
| const size_t | i_nStructSize = sizeof(TStruct) |
||
| ) |
Iterates over a serializable struct and applies a callback function to each field.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_oStruct | The struct object. |
| i_pCallback | The callback function to apply to each field. |
| i_nStructSize | The size of the struct in bytes. |
true if the iteration was completed without early termination, false otherwise. | bool Devel::Serializing::IterateSerializableStruct | ( | const TStruct * | i_pStruct, |
| std::function< bool(const TStructFieldType *)> | i_pCallback, | ||
| const size_t | i_nStructSize = sizeof(TStruct) |
||
| ) |
Iterates over a serializable struct and applies a callback function to each field.
| TStructFieldType | The type of the struct field. |
| TStruct | The type of the struct. |
| i_pStruct | Pointer to the struct object. |
| i_pCallback | The callback function to apply to each field. |
| i_nStructSize | The size of the struct in bytes. |
true if the iteration was completed without early termination, false otherwise. | std::ostream& Devel::Serializing::operator<< | ( | std::ostream & | i_oStream, |
| const IValue< T > & | i_tData | ||
| ) |
| std::wostream& Devel::Serializing::operator<< | ( | std::wostream & | i_oStream, |
| const IValue< T > & | i_tData | ||
| ) |
| std::istream& Devel::Serializing::operator>> | ( | std::istream & | i_oStream, |
| const IValue< T > & | i_tData | ||
| ) |
| std::wistream& Devel::Serializing::operator>> | ( | std::wistream & | i_oStream, |
| const IValue< T > & | i_tData | ||
| ) |
| bool Devel::Serializing::SerializeDocument | ( | const T & | i_oStruct, |
| IO::CJsonDocument & | i_oDocument, | ||
| const bool | i_bIsStrict = false, |
||
| size_t | i_nStructSize = sizeof(T) |
||
| ) |
Serializes a struct into a JSON document.
| T | The type of the struct. |
| i_oStruct | The struct to serialize. |
| i_oDocument | The JSON document to serialize into. |
| i_bIsStrict | Determines if strict serialization should be used. |
| i_nStructSize | The size of the struct in bytes. |
| bool Devel::Serializing::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.
| T | The type of the struct. |
| i_oStruct | The struct to serialize. |
| i_oObject | The JSON object to serialize into. |
| i_bIsStrict | Determines if strict serialization should be used. |
| i_nStructSize | The size of the struct in bytes. |
| bool Devel::Serializing::SerializeStream | ( | const T & | i_oStruct, |
| IO::CWriteStream & | i_oStream | ||
| ) |
Serializes a struct to a write stream.
| T | The type of the struct. |
| i_oStruct | The struct object to serialize. |
| i_oStream | The write stream to serialize to. |
true if serialization was successful, false otherwise.