23#define CE_SERIALIZER_PRIMITIVE_TYPES(F) \
89 void serialize(const
Box& value) final;
92 virtual
void resetState();
101 virtual
void endObject() = 0;
109 virtual
void endObjectProperty() = 0;
120 virtual
void endCustomObject() = 0;
129 virtual
void endArray() = 0;
138 virtual
void endMap() = 0;
141#define CE_SERIALIZER_ENCODER_PRIMITIVE_TYPE(T, N) virtual void encode##N(T value) = 0;
143#undef CE_SERIALIZER_ENCODER_PRIMITIVE_TYPE
#define CE_SERIALIZER_ENCODER_PRIMITIVE_TYPE(T, N)
Definition Serializer.hpp:141
#define CE_SERIALIZER_PRIMITIVE_TYPES(F)
Definition Serializer.hpp:23
A value type that can hold any alongside it's type information.
Definition Box.hpp:40
Represents a reflected property from metadata defined by the class.
Definition Class.hpp:176
The serializer is responsible from taking a C++ object and make it into stream of bytes from it.
Definition Serializer.hpp:41
virtual void serialize(const Box &value)=0
Serializes the given value into a stream of bytes written to dataStream.
virtual ~ISerializer() noexcept=default
A memory view is a class which attaches to an chunk of memory and provides a view to it (optionally c...
Definition MemoryView.hpp:62
A context that is shared between multiple serializer and deserializer instances.
Definition Serialization.hpp:196
A base class for serializer and deserializer states.
Definition Serialization.hpp:402
The serializer class has basic support for reflection-based serializers.
Definition Serializer.hpp:72
void visitObject(const Box &value)
Visits the object value.
SerializerState state
An object that stores context for the serializer.
Definition Serializer.hpp:78
virtual void encodeBinary(MemoryView< const Byte > data)=0
virtual void encodeString(StringView string)=0
virtual void encodeNull()=0
Encodes a null value to the serialization stream.
void visitMap(const Box &value)
Visits the object as a map.
const SerializationContext & context
A shared context that contains a context for the deserializer.
Definition Serializer.hpp:75
virtual void encodeUndefined()=0
Encodes an undefined value to the serialization stream.
bool shouldSerializeObjectProperty(const Box &value, const ClassProperty &property) const
void visitObjectProperty(const Box &value, const ClassProperty &metaProperty)
Visits a property of the object value.
void visitEnum(const Box &value)
Visits an enum.
void visit(const Box &value)
Visits the given value.
void visitArray(const Box &value)
Visits the object as an array.
Serializer(const SerializationContext &context=SerializationContext::getDefault())
Creates a new serializer instance.
~Serializer() noexcept override
Destroys the serializer.
A class that represents context for a serializer.
Definition Serializer.hpp:57
HashMap< Pair< TypeID, const void * >, SerializedObjectID > serializedObjects
Maps all known serialized objects to a known ID, so they can be re-used later.
Definition Serializer.hpp:64
Definition Application.hpp:19
std::unordered_map< Key, T, Hash, KeyEqual, ScopedAllocatorAdaptor< StdAllocator< Pair< const Key, T >, RawAllocator > > > HashMap
HashMap is an associative container that contains key-value pairs with unique keys.
Definition Map.hpp:33
UInt32 SerializedObjectID
Definition Forward.hpp:24
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25