10 #include "swCommonLib/Common/RTTR.h"
11 #include "swCommonLib/Serialization/Serializer.h"
14 #include "swCommonLib/Serialization/PropertySerialization/SerializationContext.h"
15 #include <DirectXMath.h>
34 static std::vector< rttr::property >& GetTypeFilteredProperties ( rttr::type objType,
SerializationContext* context );
37 static bool ShouldSave (
const rttr::property& prop, MetaDataType saveFlag );
43 static void DefaultSerializeImpl (
ISerializer& ser,
const rttr::instance&
object, rttr::type dynamicType );
44 static void DefaultDeserializeImpl (
const IDeserializer& deser,
const rttr::instance&
object, rttr::type dynamicType );
51 static bool SerializeVectorTypes (
ISerializer& ser,
const rttr::instance&
object, rttr::property& prop );
52 static bool SerializeStringTypes (
ISerializer& ser,
const rttr::instance&
object, rttr::property& prop );
54 static bool SerializeArrayTypes (
ISerializer& ser,
const rttr::instance&
object, rttr::property& prop );
55 static bool SerializeObjectTypes (
ISerializer& ser,
const rttr::instance&
object, rttr::property& prop );
60 static void SerializePolymorphic (
ISerializer& ser,
const rttr::instance&
object, rttr::property& prop );
61 static void SerializePropertiesVec (
ISerializer& ser,
const rttr::instance&
object, std::vector< rttr::property >& properties );
80 static rttr::variant CreateInstance ( TypeID type );
83 static std::string WstringToUTF (
const std::wstring& str );
84 static std::wstring UTFToWstring (
const std::string& str );
86 template<
typename PropertyType >
87 static PropertyType
GetPropertyValue ( rttr::property prop,
const rttr::instance&
object );
89 template<
typename PropertyType >
92 template<
typename PropertyType >
96 template<>
static void SerializeProperty< EngineObject* > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
97 template<>
static void SerializeProperty< void* > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
98 template<>
static void SerializeProperty< DirectX::XMFLOAT2* > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
99 template<>
static void SerializeProperty< DirectX::XMFLOAT3* > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
100 template<>
static void SerializeProperty< DirectX::XMFLOAT4* > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
101 template<>
static void SerializeProperty< std::wstring > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
102 template<>
static void SerializeProperty< char > (
ISerializer& ser, rttr::property prop,
const rttr::instance& object );
104 template<>
static void SerializeProperty< char > (
ISerializer& ser, rttr::string_view name,
const rttr::variant& propertyValue );
107 template<
typename PropertyType >
108 static void SetPropertyValue ( rttr::property prop,
const rttr::instance&
object, PropertyType value );
110 template<
typename PropertyType >
114 template<>
static void DeserializeProperty< EngineObject* > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
115 template<>
static void DeserializeProperty< void* > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
116 template<>
static void DeserializeProperty< DirectX::XMFLOAT2* > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
117 template<>
static void DeserializeProperty< DirectX::XMFLOAT3* > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
118 template<>
static void DeserializeProperty< DirectX::XMFLOAT4* > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
119 template<>
static void DeserializeProperty< std::wstring > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
120 template<>
static void DeserializeProperty< char > (
const IDeserializer& deser, rttr::property prop,
const rttr::instance& object );
123 static TypeID
GetRealType (
const rttr::instance&
object );
static void SerializeProperty(ISerializer &ser, rttr::property prop, const rttr::instance &object)
Serializuje właściwość podanego typu.
Definition: SerializationCore.inl:63
Serialization context for automatic serialization.
Definition: SerializationContext.h:30
static bool DeserializeArrayTypes(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Deserializes arrays.
Definition: SerializationCore.cpp:433
static void SetPropertyValue(rttr::property prop, const rttr::instance &object, PropertyType value)
Ustawia wartość podanej właściwości.
Definition: SerializationCore.inl:79
Interface for deserializers.
Definition: Deserializer.h:39
static void DestroyObject(rttr::variant &object)
Destroy object in variant.
Definition: SerializationCore.inl:125
Definition: Exception.h:11
static rttr::variant CreateAndSetObjectProperty(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop, TypeID dynamicType)
Definition: SerializationCore.cpp:664
Deklaracja klasy deserializatora.
static bool DeserializeStringTypes(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Deserializuje std::string i std::wstring.
Definition: SerializationCore.cpp:393
Serializers interface.
Definition: Serializer.h:31
Base class for serializable objects.
Definition: EngineObject.h:24
static PropertyType GetPropertyValue(rttr::property prop, const rttr::instance &object)
Returns typed property value.
Definition: SerializationCore.inl:52
static void DeserializeNotPolymorphic(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Definition: SerializationCore.cpp:633
static bool DeserializeVectorTypes(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Deserializuje typy DirectXMath.
Definition: SerializationCore.cpp:374
Core serialization/deserialization functions.
Definition: SerializationCore.h:30
static bool DeserializeBasicTypes(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Deserialize basic arithemtic types and bool.
Definition: SerializationCore.cpp:334
static SerializationContext * Context(const IDeserializer &deser)
Returns SerialziationContext from deserializer.
Definition: SerializationCore.inl:118
static void DeserializeProperty(const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
Deserializuje właściwość podanego typu.
Definition: SerializationCore.inl:88
static bool DeserializeEnumTypes(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Deserializes enum properties from string.
Definition: SerializationCore.cpp:410
static TypeID GetRealType(const rttr::instance &object)
Gets real type of the object that means most derived and wrapped type.
Definition: SerializationCore.inl:96
static bool DeserializeObjectTypes(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Deserializes structures and generic objects.
Definition: SerializationCore.cpp:522
static bool SerializeEnumTypes(ISerializer &ser, const rttr::instance &object, rttr::property &prop)
Definition: SerializationCore.cpp:208
static bool IsPolymorphicType(TypeID type)
We support only polymorphic types derived from EngineObject.
Definition: SerializationCore.cpp:68
static TypeID GetRawWrappedType(TypeID type)
First extracts wrapped type and then returns raw type.
Definition: SerializationCore.inl:111
static void DeserializePolymorphic(const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
Definition: SerializationCore.cpp:563
static TypeID GetWrappedType(TypeID type)
Gets wrapped type. If type isn't wrapper it returns it unmodified.
Definition: SerializationCore.inl:104
static bool SerializeBasicTypes(ISerializer &ser, const rttr::instance &object, rttr::property &prop)
Serialize basic arithemtic types and bool.
Definition: SerializationCore.cpp:128