|
CeresEngine 0.2.0
A game development framework
|
The deserializer class has basic support for reflection-based deserializers. More...
#include <CeresEngine/Serialization/Deserializer.hpp>
Classes | |
| struct | Array |
| A context struct that contains information for the decoding of an array. More... | |
| struct | Map |
| A context struct that contains information for the decoding of a map. More... | |
| struct | Object |
| A context struct that contains information for the decoding of an object. More... | |
| struct | Property |
| A context struct that contains information for the decoding of a property. More... | |
Public Member Functions | |
| Deserializer (const SerializationContext &context=SerializationContext::getDefault()) | |
| Creates a new deserializer with a custom context. | |
| ~Deserializer () noexcept override | |
| Destroys the deserializer. | |
| Optional< Box > | deserialize () final |
Deserializes a value from a stream of bytes read from dataStream. | |
| virtual void | resetState () |
| Resets the deserializer state. | |
| virtual Box | decode (Box &&existingObject={})=0 |
| Starts decoding from the deserializer implementation. | |
Public Member Functions inherited from CeresEngine::IDeserializer | |
| virtual | ~IDeserializer ()=default |
Public Attributes | |
| const SerializationContext & | context |
| A shared context that contains a context for the deserializer. | |
| DeserializerState | state |
| An object that stores context for the deserializer. | |
Protected Member Functions | |
| Object | beginObject (const SerializedObjectMetadata &metadata, Box &&existingObject={}) |
| Notifies the deserializer that a new object is starting deserialization. | |
| Box | endObject (Object &object) |
| Notifies the deserializer that an object has ended deserialization. | |
| Property | beginObjectProperty (const Object &object, const SerializedPropertyMetadata &metadata) |
| Notifies the deserializer that a new property is starting deserialization. | |
| void | endObjectProperty (Object &object, const Property &property, Box &&value) |
| Notifies the deserializer that a property has ended deserialization. | |
| Box | objectReference (SerializedObjectID referenceID) |
| Notifies the deserializer that an object reference was deserialized. | |
| Box | binary (InputStream &stream, Box &&existingObject) |
Decodes a binary input stream into a MetaValue object. | |
| Array | beginArray (const SerializedArrayMetadata &metadata, Box &&existingObject={}) |
| Notifies the deserializer that an array is starting deserialization. | |
| void | arrayElement (const Array &array, Box &&value) |
| Notifies the deserializer that an array element was deserialized. | |
| Box | endArray (Array &array) |
| Notifies the deserializer that an array has ended deserialization. | |
| Map | beginMap (const SerializedMapMetadata &metadata, Box &&existingObject={}) |
| Notifies the deserializer that a map is starting deserialization. | |
| void | mapElement (const Map &map, Box &&key, Box &&value) |
| Notifies the deserializer that a map element was deserialized. | |
| Box | endMap (Map &map) |
| Notifies the deserializer that a map has ended deserialization. | |
The deserializer class has basic support for reflection-based deserializers.
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 deserializer with a custom context.
|
overridenoexcept |
Destroys the deserializer.
Notifies the deserializer that an array element was deserialized.
| array | The context of the array that contains the element value. |
| value | The value of the array element. |
|
protected |
Notifies the deserializer that an array is starting deserialization.
| metadata | The metadata as stored on the serialized array. |
| existingObject | If not empty, determines the object to which perform inplace deserialization to. |
|
protected |
Notifies the deserializer that a map is starting deserialization.
| metadata | The metadata as stored on the serialized map. |
| existingObject | If not empty, determines the object to which perform inplace deserialization to. |
|
protected |
Notifies the deserializer that a new object is starting deserialization.
If existingObject is not empty, deserialization will be performed inplace, directly on the object.
| metadata | The metadata as stored on the serialized object. |
| existingObject | If not empty, determines the object to which perform inplace deserialization to. |
|
protected |
Notifies the deserializer that a new property is starting deserialization.
| object | The context for which the deserialized property belongs to. |
| metadata | The metadata as stored on the serialized property. |
|
protected |
Decodes a binary input stream into a MetaValue object.
This function receives an input stream and an optional existing MetaValue object. It decodes the binary data from the input stream and populates the MetaValue object with the deserialized data.
| stream | The input stream to read the binary data from. |
| existingObject | An optional existing MetaValue object to populate with the deserialized data. |
MetaValue object containing the deserialized data. Starts decoding from the deserializer implementation.
Usually called from deserialize, but can be called manually by the implementation under certain conditions.
| existingObject | If not empty, will attempt to decode the value inplace on this object. |
Implemented in CeresEngine::BinaryDeserializer, and CeresEngine::JSONDeserializer.
Deserializes a value from a stream of bytes read from dataStream.
The layout, format and details on how the object is deserialized is open for the deserializer implementation to decide.
Implements CeresEngine::IDeserializer.
Notifies the deserializer that an array has ended deserialization.
| array | The context for the deserialized array. |
Notifies the deserializer that a map has ended deserialization.
| map | The context for the deserialized map. |
Notifies the deserializer that an object has ended deserialization.
| object | The context for the deserialized object. |
|
protected |
Notifies the deserializer that a property has ended deserialization.
| object | The context for which the deserialized property belongs to. |
| property | The context for deserializing the property. |
| value | The value to set the property to. Must be compatible with the type held by the property. |
Notifies the deserializer that a map element was deserialized.
| map | The context of the map that contains the element value. |
| key | The key of the map element. |
| value | The value of the map element. |
|
protected |
Notifies the deserializer that an object reference was deserialized.
| referenceID | The serialized object ID. |
| const SerializationContext& CeresEngine::Deserializer::context |
A shared context that contains a context for the deserializer.
| DeserializerState CeresEngine::Deserializer::state |
An object that stores context for the deserializer.