CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::JSONDeserializer Class Referencefinal

A Deserializer that reads the serialized content from a JSON value. More...

#include <CeresEngine/Serialization/JSONSerialization.hpp>

Inheritance diagram for CeresEngine::JSONDeserializer:
CeresEngine::Deserializer CeresEngine::IDeserializer

Public Member Functions

 JSONDeserializer (JSON &&json, const SerializationContext &context=SerializationContext::getDefault())
 Creates a new JSON deserializer backed by an object.
 
 ~JSONDeserializer () noexcept override
 Destroys the JSON deserializer.
 
Box decode (Box &&existingObject={}) final
 
- Public Member Functions inherited from CeresEngine::Deserializer
 Deserializer (const SerializationContext &context=SerializationContext::getDefault())
 Creates a new deserializer with a custom context.
 
 ~Deserializer () noexcept override
 Destroys the deserializer.
 
Optional< Boxdeserialize () final
 Deserializes a value from a stream of bytes read from dataStream.
 
virtual void resetState ()
 Resets the deserializer state.
 
- Public Member Functions inherited from CeresEngine::IDeserializer
virtual ~IDeserializer ()=default
 

Private Member Functions

Box decode (const JSON &value, Box &&existingObject={})
 
Box decodeNumber (const JSON &value, Box &&existingObject={})
 
Box decodeString (const JSON &value, Box &&existingObject={})
 
Box decodeObject (const JSON &value, Box &&existingObject={})
 
Box decodeObjectReference ()
 
Box decodeArray (const JSON &array, Box &&existingObject={})
 
Box decodeMap (const JSON &map, Box &&existingObject={})
 

Private Attributes

JSON mValue
 The JSON value for the deserializer.
 

Additional Inherited Members

- Public Attributes inherited from CeresEngine::Deserializer
const SerializationContextcontext
 A shared context that contains a context for the deserializer.
 
DeserializerState state
 An object that stores context for the deserializer.
 
- Protected Member Functions inherited from CeresEngine::Deserializer
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.
 

Detailed Description

A Deserializer that reads the serialized content from a JSON value.

Constructor & Destructor Documentation

◆ JSONDeserializer()

CeresEngine::JSONDeserializer::JSONDeserializer ( JSON &&  json,
const SerializationContext context = SerializationContext::getDefault() 
)
explicit

Creates a new JSON deserializer backed by an object.

Parameters
jsonThe JSON value to be deserialized.
contextA context for the deserializer to operate on.

◆ ~JSONDeserializer()

CeresEngine::JSONDeserializer::~JSONDeserializer ( )
overridenoexcept

Destroys the JSON deserializer.

Member Function Documentation

◆ decode() [1/2]

Box CeresEngine::JSONDeserializer::decode ( Box &&  existingObject = {})
finalvirtual

◆ decode() [2/2]

Box CeresEngine::JSONDeserializer::decode ( const JSON value,
Box &&  existingObject = {} 
)
private

◆ decodeArray()

Box CeresEngine::JSONDeserializer::decodeArray ( const JSON array,
Box &&  existingObject = {} 
)
private

◆ decodeMap()

Box CeresEngine::JSONDeserializer::decodeMap ( const JSON map,
Box &&  existingObject = {} 
)
private

◆ decodeNumber()

Box CeresEngine::JSONDeserializer::decodeNumber ( const JSON value,
Box &&  existingObject = {} 
)
private

◆ decodeObject()

Box CeresEngine::JSONDeserializer::decodeObject ( const JSON value,
Box &&  existingObject = {} 
)
private

◆ decodeObjectReference()

Box CeresEngine::JSONDeserializer::decodeObjectReference ( )
private

◆ decodeString()

Box CeresEngine::JSONDeserializer::decodeString ( const JSON value,
Box &&  existingObject = {} 
)
private

Member Data Documentation

◆ mValue

JSON CeresEngine::JSONDeserializer::mValue
private

The JSON value for the deserializer.


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