Sleeping Wombat GUI  0.100
swGUI
Serialization.h
Go to the documentation of this file.
1 #pragma once
2 
7 
9 #include <DirectXMath.h>
10 #include <string>
11 
12 
14 {
15 public:
16 
17  static std::vector< rttr::property >& GetTypeFilteredProperties ( rttr::type objType, EngineSerializationContext* context );
18 
19 
20  static bool ShouldSave ( const rttr::property& prop, MetaDataType saveFlag );
21 
22  static void DefaultSerialize ( ISerializer* ser, const EngineObject* object );
23  static void DefaultDeserialize ( IDeserializer* deser, EngineObject* object );
24 
25  static void DefaultSerializeImpl ( ISerializer* ser, const rttr::instance& object, rttr::type dynamicType );
26  static void DefaultDeserializeImpl ( IDeserializer* deser, const rttr::instance& object, rttr::type dynamicType );
27 
28  static bool SerializeBasicTypes ( ISerializer* ser, const rttr::instance& object, rttr::property& prop );
29  static bool SerializeVectorTypes ( ISerializer* ser, const rttr::instance& object, rttr::property& prop );
30  static bool SerializeStringTypes ( ISerializer* ser, const rttr::instance& object, rttr::property& prop );
31  static bool SerializeEnumTypes ( ISerializer* ser, const rttr::instance& object, rttr::property& prop );
32  static bool SerializeArrayTypes ( ISerializer* ser, const rttr::instance& object, rttr::property& prop );
33 
34  static void SerializePropertiesVec ( ISerializer* ser, const rttr::instance& object, std::vector< rttr::property >& properties );
35 
36  static bool DeserializeBasicTypes ( IDeserializer* deser, const rttr::instance& object, rttr::property& prop );
37  static bool DeserializeVectorTypes ( IDeserializer* deser, const rttr::instance& object, rttr::property& prop );
38  static bool DeserializeStringTypes ( IDeserializer* deser, const rttr::instance& object, rttr::property& prop );
39  static bool DeserializeEnumTypes ( IDeserializer* deser, const rttr::instance& object, rttr::property& prop );
40  static bool DeserializeArrayTypes ( IDeserializer* deser, const rttr::instance& object, rttr::property& prop );
41  static bool DeserializeObjectTypes ( IDeserializer* deser, const rttr::instance& object, rttr::property& prop );
42 
43 
44  static std::string WstringToUTF ( const std::wstring& str );
45  static std::wstring UTFToWstring ( const std::string& str );
46 
47  template< typename PropertyType >
48  static PropertyType GetPropertyValue ( rttr::property prop, const rttr::instance& object );
49 
50  template< typename PropertyType >
51  static void SerializeProperty ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
52 
53 
54 
55  template<> static void SerializeProperty< EngineObject* > ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
56  template<> static void SerializeProperty< void* > ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
57  template<> static void SerializeProperty< DirectX::XMFLOAT2* > ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
58  template<> static void SerializeProperty< DirectX::XMFLOAT3* > ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
59  template<> static void SerializeProperty< DirectX::XMFLOAT4* > ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
60  template<> static void SerializeProperty< std::wstring > ( ISerializer* ser, rttr::property prop, const rttr::instance& object );
61 
62 
63  template< typename PropertyType >
64  static void SetPropertyValue ( rttr::property prop, const rttr::instance& object, PropertyType value );
65 
66  template< typename PropertyType >
67  static void DeserializeProperty ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
68 
69 
70  template<> static void DeserializeProperty< EngineObject* > ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
71  template<> static void DeserializeProperty< void* > ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
72  template<> static void DeserializeProperty< DirectX::XMFLOAT2* > ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
73  template<> static void DeserializeProperty< DirectX::XMFLOAT3* > ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
74  template<> static void DeserializeProperty< DirectX::XMFLOAT4* > ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
75  template<> static void DeserializeProperty< std::wstring > ( IDeserializer* deser, rttr::property prop, const rttr::instance& object );
76 };
77 
78 #include "Serialization.inl"
static bool DeserializeVectorTypes(IDeserializer *deser, const rttr::instance &object, rttr::property &prop)
Deserializuje typy DirectXMath.
Definition: Serialization.cpp:320
static bool DeserializeEnumTypes(IDeserializer *deser, const rttr::instance &object, rttr::property &prop)
Deserializes enum properties from string.
Definition: Serialization.cpp:356
static bool SerializeBasicTypes(ISerializer *ser, const rttr::instance &object, rttr::property &prop)
Serializuje podstawowe typy.
Definition: Serialization.cpp:141
static bool SerializeArrayTypes(ISerializer *ser, const rttr::instance &object, rttr::property &prop)
Serializes static or dynamic array.
Definition: Serialization.cpp:228
static void SerializeProperty(ISerializer *ser, rttr::property prop, const rttr::instance &object)
Serializuje właściwość podanego typu.
Definition: Serialization.inl:42
static void DefaultSerialize(ISerializer *ser, const EngineObject *object)
Domyślny tryb serialziacji obiektów.
Definition: Serialization.cpp:62
static bool SerializeStringTypes(ISerializer *ser, const rttr::instance &object, rttr::property &prop)
Serializes string types.
Definition: Serialization.cpp:192
static bool DeserializeStringTypes(IDeserializer *deser, const rttr::instance &object, rttr::property &prop)
Deserializuje std::string i std::wstring.
Definition: Serialization.cpp:339
Interface for deserializers.
Definition: Deserializer.h:38
Definition: Serialization.h:13
static PropertyType GetPropertyValue(rttr::property prop, const rttr::instance &object)
Returns typed property value.
Definition: Serialization.inl:31
static std::vector< rttr::property > & GetTypeFilteredProperties(rttr::type objType, EngineSerializationContext *context)
Zwraca wektor propertiesów dla danego typu.
Definition: Serialization.cpp:12
Deklaracja klasy deserializatora.
static void DefaultSerializeImpl(ISerializer *ser, const rttr::instance &object, rttr::type dynamicType)
Definition: Serialization.cpp:70
Serializers interface.
Definition: Serializer.h:35
static void DefaultDeserializeImpl(IDeserializer *deser, const rttr::instance &object, rttr::type dynamicType)
Definition: Serialization.cpp:116
&RenderTargetObject::m_colorBuffer property("DepthBuffer",&RenderTargetObject::m_depthBuffer).property("StencilBuffer"
static void DeserializeProperty(IDeserializer *deser, rttr::property prop, const rttr::instance &object)
Deserializuje właściwość podanego typu.
Definition: Serialization.inl:59
MetaDataType
Typy metadanych widoczne z poziomu edytora.
Definition: RTTR.h:23
Klasa bazowa dla obiektów, które mają być dostępne w edytorze poprzez rttr. Należy po niej odziedzicz...
Definition: EngineObject.h:22
static bool SerializeEnumTypes(ISerializer *ser, const rttr::instance &object, rttr::property &prop)
Serializes enum types to string representation.
Definition: Serialization.cpp:207
static bool DeserializeArrayTypes(IDeserializer *deser, const rttr::instance &object, rttr::property &prop)
Deserializes arrays.
Definition: Serialization.cpp:379
static bool SerializeVectorTypes(ISerializer *ser, const rttr::instance &object, rttr::property &prop)
Serializuje typy DirectXMath.
Definition: Serialization.cpp:175
static std::wstring UTFToWstring(const std::string &str)
Definition: Serialization.cpp:496
static void SerializePropertiesVec(ISerializer *ser, const rttr::instance &object, std::vector< rttr::property > &properties)
Definition: Serialization.cpp:84
Definition: EngineSerializationContext.h:11
static bool ShouldSave(const rttr::property &prop, MetaDataType saveFlag)
Sprawdza czy właściwość powinna zostać zapisana.
Definition: Serialization.cpp:47
static bool DeserializeObjectTypes(IDeserializer *deser, const rttr::instance &object, rttr::property &prop)
Deserializes structures and generic objects.
Definition: Serialization.cpp:454
static void SetPropertyValue(rttr::property prop, const rttr::instance &object, PropertyType value)
Ustawia wartość podanej właściwości.
Definition: Serialization.inl:50
static std::string WstringToUTF(const std::wstring &str)
Definition: Serialization.cpp:490
static void DefaultDeserialize(IDeserializer *deser, EngineObject *object)
Domyślny tryb deserialziacji obiektów.
Definition: Serialization.cpp:109
static bool DeserializeBasicTypes(IDeserializer *deser, const rttr::instance &object, rttr::property &prop)
Deserializuje podstawowe typy.
Definition: Serialization.cpp:282