|
CeresEngine 0.2.0
A game development framework
|
The serializer class has basic support for reflection-based serializers. More...
#include <CeresEngine/Serialization/Serializer.hpp>
Public Member Functions | |
| Serializer (const SerializationContext &context=SerializationContext::getDefault()) | |
| Creates a new serializer instance. | |
| ~Serializer () noexcept override | |
| Destroys the serializer. | |
| void | serialize (const Box &value) final |
Serializes the given value into a stream of bytes written to dataStream. ISerializer::serialize | |
| virtual void | resetState () |
| Resets the deserializer state. | |
Public Member Functions inherited from CeresEngine::ISerializer | |
| virtual | ~ISerializer () noexcept=default |
Public Attributes | |
| const SerializationContext & | context |
| A shared context that contains a context for the deserializer. | |
| SerializerState | state |
| An object that stores context for the serializer. | |
Protected Member Functions | |
| virtual void | beginObject (const SerializedObjectMetadata &metadata)=0 |
| Begins serialization of an object. | |
| virtual void | endObject ()=0 |
| Ends the low-level serialization of an object. | |
| virtual void | beginObjectProperty (const SerializedPropertyMetadata &metadata)=0 |
| Begins the serialization of an object property. | |
| virtual void | endObjectProperty ()=0 |
| Ends the serialization of an object property. | |
| virtual void | encodeObjectReference (SerializedObjectID referenceID)=0 |
| Encodes a object reference. | |
| virtual void | beginCustomObject (const SerializedCustomObjectMetadata &metadata)=0 |
| Begins serialization of a custom object. | |
| virtual void | endCustomObject ()=0 |
| Ends the low-level serialization of a custom object. | |
| virtual void | beginArray (const SerializedArrayMetadata &metadata)=0 |
| Begins the serialization of an array. | |
| virtual void | endArray ()=0 |
| Ends the low-level serialization of an array. | |
| virtual void | beginMap (const SerializedMapMetadata &metadata)=0 |
| Begins the serialization of a map. | |
| virtual void | endMap ()=0 |
| Ends the low-level serialization of a map. | |
| virtual void | encodeFloat (float value)=0 |
| virtual void | encodeDouble (double value)=0 |
| virtual void | encodeUInt8 (UInt8 value)=0 |
| virtual void | encodeUInt16 (UInt16 value)=0 |
| virtual void | encodeUInt32 (UInt32 value)=0 |
| virtual void | encodeUInt64 (UInt64 value)=0 |
| virtual void | encodeInt8 (Int8 value)=0 |
| virtual void | encodeInt16 (Int16 value)=0 |
| virtual void | encodeInt32 (Int32 value)=0 |
| virtual void | encodeInt64 (Int64 value)=0 |
| virtual void | encodeBoolean (bool value)=0 |
| virtual void | encodeString (StringView string)=0 |
| virtual void | encodeBinary (MemoryView< const Byte > data)=0 |
| virtual void | encodeUndefined ()=0 |
| Encodes an undefined value to the serialization stream. | |
| virtual void | encodeNull ()=0 |
| Encodes a null value to the serialization stream. | |
Private Member Functions | |
| void | visit (const Box &value) |
Visits the given value. | |
| void | visitObject (const Box &value) |
Visits the object value. | |
| void | visitObjectProperty (const Box &value, const ClassProperty &metaProperty) |
Visits a property of the object value. | |
| void | visitEnum (const Box &value) |
| Visits an enum. | |
| void | visitArray (const Box &value) |
| Visits the object as an array. | |
| void | visitMap (const Box &value) |
| Visits the object as a map. | |
| bool | shouldSerializeObjectProperty (const Box &value, const ClassProperty &property) const |
The serializer class has basic support for reflection-based serializers.
It implements the more complicated logic to deal with reflection and leave only the actual wire serialization details for the implementer.
|
explicit |
Creates a new serializer instance.
|
overridenoexcept |
Destroys the serializer.
|
protectedpure virtual |
Begins the serialization of an array.
| metadata | An object that describes metadata for the serialized array. |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Begins serialization of a custom object.
| metadata | An object that describes metadata for the serialized object. |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Begins the serialization of a map.
| metadata | An object that describes metadata for the serialized map. |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Begins serialization of an object.
| metadata | An object that describes metadata for the serialized object. |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Begins the serialization of an object property.
| metadata | An object that describes metadata for the serialized object property. |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Encodes a null value to the serialization stream.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Encodes a object reference.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
|
protectedpure virtual |
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Encodes an undefined value to the serialization stream.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Ends the low-level serialization of an array.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Ends the low-level serialization of a custom object.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Ends the low-level serialization of a map.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Ends the low-level serialization of an object.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Ends the serialization of an object property.
Implemented in CeresEngine::BinarySerializer, and CeresEngine::JSONSerializer.
Serializes the given value into a stream of bytes written to dataStream. ISerializer::serialize
The layout, format and details on how the object is serialized is open for the serializer implementation to decide.
| value | The value to be written to the data stream. ISerializer::serialize |
Implements CeresEngine::ISerializer.
|
private |
Visits the given value.
Recurse into all serializable object properties.
Visits the object as an array.
|
private |
Visits a property of the object value.
| const SerializationContext& CeresEngine::Serializer::context |
A shared context that contains a context for the deserializer.
| SerializerState CeresEngine::Serializer::state |
An object that stores context for the serializer.