Data serializer plugin v1.0.2
DataSerializer
Loading...
Searching...
No Matches
USerializerObject Class Reference

A class for serializing various data types into a byte array for use in Unreal Engine. More...

#include <SerializerObject.h>

Public Member Functions

virtual void GetBytes (TArray< uint8 > &OutBytes)
 Retrieves the serialized bytes.
 
virtual void PushBytes (const TArray< uint8 > &InBytes)
 Appends input bytes to the current serialized data.
 
virtual void Clear ()
 Clears the current serialized data and resets the writer.
 
virtual void Prepare ()
 Prepares the serializer for writing new data by clearing existing data.
 
virtual void SerializeInt (UPARAM(DisplayName="Value") int32 InInteger)
 Serializes a 32-bit integer.
 
virtual void SerializeBigInt (UPARAM(DisplayName="Value") int64 InBigInt)
 Serializes a 64-bit integer.
 
virtual void SerializeFloat (UPARAM(DisplayName="Value") float InFloat)
 Serializes a floating-point number.
 
virtual void SerializeDouble (UPARAM(DisplayName="Value") double InDouble)
 Serializes a double-precision floating-point number.
 
virtual void SerializeBool (UPARAM(DisplayName="Value") bool InBool)
 Serializes a boolean value.
 
virtual void SerializeByte (UPARAM(DisplayName="Value") uint8 InByte)
 Serializes a single byte.
 
virtual void SerializeVector (UPARAM(DisplayName="Value") FVector InVector)
 Serializes a 3D vector (FVector).
 
virtual void SerializeIntVector (UPARAM(DisplayName="Value") FIntVector InVector)
 Serializes a 3D integer vector (FIntVector).
 
virtual void SerializeVector2D (UPARAM(DisplayName="Value") FVector2D InVector)
 Serializes a 2D vector (FVector2D).
 
virtual void SerializePoint (UPARAM(DisplayName="Value") FIntPoint InPoint)
 Serializes a 2D integer point (FIntPoint).
 
virtual void SerializeRotator (UPARAM(DisplayName="Value") FRotator InRotator)
 Serializes a rotation (FRotator).
 
virtual void SerializeTransform (UPARAM(DisplayName="Value") FTransform InTransform)
 Serializes a transform (FTransform).
 
virtual void SerializeString (UPARAM(DisplayName="Value") FString InString)
 Serializes a string (FString).
 
virtual void SerializeObject (UPARAM(DisplayName="Value") UObject *InObject)
 Serializes a object (UObject).
 
virtual void SerializeObjects (UPARAM(DisplayName="Value") const TArray< UObject * > &InObjects)
 Serializes a array of objects (TArray<UObject*>).
 

Protected Member Functions

virtual FMemoryWriter & GetMemoryWriterRef ()
 Gets a reference to the memory writer.
 

Protected Attributes

TArray< uint8 > Bytes
 Array of bytes representing the serialized data.
 
TSharedPtr< FMemoryWriter > MemoryWriter
 Shared pointer to a memory writer used for serialization.
 

Detailed Description

A class for serializing various data types into a byte array for use in Unreal Engine.

The USerializerObject class provides functionality to serialize common data types into a byte array (TArray<uint8>). It is designed to work within Unreal Engine and leverages the FMemoryWriter class to handle the byte serialization. This class is Blueprintable and can be used directly in Unreal Engine Blueprints.

The class includes methods to serialize integers, floating point numbers, vectors, rotators, and transforms, as well as to clear the serialized data and prepare the writer for new data.

Member Function Documentation

◆ GetBytes()

virtual void USerializerObject::GetBytes ( TArray< uint8 > & OutBytes)
virtual

Retrieves the serialized bytes.

Parameters
OutBytesAn array to store the retrieved bytes.

◆ GetMemoryWriterRef()

virtual FMemoryWriter & USerializerObject::GetMemoryWriterRef ( )
protectedvirtual

Gets a reference to the memory writer.

Note
If MemoryWriter has not been set, then it will call the Prepare() method
See also
Prepare
MemoryWriter
Returns
Reference to FMemoryWriter.

◆ Prepare()

virtual void USerializerObject::Prepare ( )
virtual

Prepares the serializer for writing new data by clearing existing data.

This method initializes the MemoryWriter with a fresh Bytes array.

Note
Should be called before any use!

◆ PushBytes()

virtual void USerializerObject::PushBytes ( const TArray< uint8 > & InBytes)
virtual

Appends input bytes to the current serialized data.

Parameters
InBytesThe array of bytes to append.

◆ SerializeBigInt()

virtual void USerializerObject::SerializeBigInt ( UPARAM(DisplayName="Value") int64 InBigInt)
virtual

Serializes a 64-bit integer.

Parameters
InBigIntThe 64-bit integer value to serialize.

◆ SerializeBool()

virtual void USerializerObject::SerializeBool ( UPARAM(DisplayName="Value") bool InBool)
virtual

Serializes a boolean value.

Parameters
InBoolThe boolean value to serialize.

◆ SerializeByte()

virtual void USerializerObject::SerializeByte ( UPARAM(DisplayName="Value") uint8 InByte)
virtual

Serializes a single byte.

Parameters
InByteThe byte value to serialize.

◆ SerializeDouble()

virtual void USerializerObject::SerializeDouble ( UPARAM(DisplayName="Value") double InDouble)
virtual

Serializes a double-precision floating-point number.

Parameters
InDoubleThe double value to serialize.

◆ SerializeFloat()

virtual void USerializerObject::SerializeFloat ( UPARAM(DisplayName="Value") float InFloat)
virtual

Serializes a floating-point number.

Parameters
InFloatThe float value to serialize.

◆ SerializeInt()

virtual void USerializerObject::SerializeInt ( UPARAM(DisplayName="Value") int32 InInteger)
virtual

Serializes a 32-bit integer.

Parameters
InIntegerThe integer value to serialize.

◆ SerializeIntVector()

virtual void USerializerObject::SerializeIntVector ( UPARAM(DisplayName="Value") FIntVector InVector)
virtual

Serializes a 3D integer vector (FIntVector).

Parameters
InVectorThe FIntVector to serialize.

◆ SerializeObject()

virtual void USerializerObject::SerializeObject ( UPARAM(DisplayName="Value") UObject * InObject)
virtual

Serializes a object (UObject).

Parameters
InObjectThe UObject to serialize.

◆ SerializeObjects()

virtual void USerializerObject::SerializeObjects ( UPARAM(DisplayName="Value") const TArray< UObject * > & InObjects)
virtual

Serializes a array of objects (TArray<UObject*>).

Parameters
InObjectsThe Array of UObjects to serialize.

◆ SerializePoint()

virtual void USerializerObject::SerializePoint ( UPARAM(DisplayName="Value") FIntPoint InPoint)
virtual

Serializes a 2D integer point (FIntPoint).

Parameters
InPointThe FIntPoint to serialize.

◆ SerializeRotator()

virtual void USerializerObject::SerializeRotator ( UPARAM(DisplayName="Value") FRotator InRotator)
virtual

Serializes a rotation (FRotator).

Parameters
InRotatorThe FRotator to serialize.

◆ SerializeString()

virtual void USerializerObject::SerializeString ( UPARAM(DisplayName="Value") FString InString)
virtual

Serializes a string (FString).

Parameters
InStringThe FString to serialize.

◆ SerializeTransform()

virtual void USerializerObject::SerializeTransform ( UPARAM(DisplayName="Value") FTransform InTransform)
virtual

Serializes a transform (FTransform).

Parameters
InTransformThe FTransform to serialize.

◆ SerializeVector()

virtual void USerializerObject::SerializeVector ( UPARAM(DisplayName="Value") FVector InVector)
virtual

Serializes a 3D vector (FVector).

Parameters
InVectorThe FVector to serialize.

◆ SerializeVector2D()

virtual void USerializerObject::SerializeVector2D ( UPARAM(DisplayName="Value") FVector2D InVector)
virtual

Serializes a 2D vector (FVector2D).

Parameters
InVectorThe FVector2D to serialize.

Member Data Documentation

◆ Bytes

TArray<uint8> USerializerObject::Bytes
protected

Array of bytes representing the serialized data.

This array is populated with the serialized form of the data that is written using the various serialization methods.

◆ MemoryWriter

TSharedPtr<FMemoryWriter> USerializerObject::MemoryWriter
protected

Shared pointer to a memory writer used for serialization.

The FMemoryWriter is used to write data into the Bytes array.


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