Sleeping Wombat Common Library  0.50.0
swCommonLibrary
Public Member Functions | Static Public Member Functions | List of all members
sw::SerializationCore Class Reference

Core serialization/deserialization functions. More...

#include <SerializationCore.h>

Public Member Functions

template<>
void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 Template specialization for classes derived from EngineObject. More...
 
template<>
void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 Specialization for all not polymorphic objects. More...
 
template<>
void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 Specialization for deserializing generic objects inheriting EngineObject.
 
template<>
void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 Specialization for deserializing non generic structures..
 

Static Public Member Functions

static std::vector< rttr::property > & GetTypeFilteredProperties (rttr::type objType, SerializationContext *context)
 
static bool ShouldSave (const rttr::property &prop, MetaDataType saveFlag)
 
static bool IsPolymorphicType (TypeID type)
 We support only polymorphic types derived from EngineObject.
 
static void DefaultSerialize (ISerializer &ser, const EngineObject *object)
 
static void DefaultDeserialize (const IDeserializer &deser, EngineObject *object)
 
static void DefaultSerializeImpl (ISerializer &ser, const rttr::instance &object, rttr::type dynamicType)
 
static void DefaultDeserializeImpl (const IDeserializer &deser, const rttr::instance &object, rttr::type dynamicType)
 
static void SerializePolymorphic (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 
static void SerializePropertiesVec (ISerializer &ser, const rttr::instance &object, std::vector< rttr::property > &properties)
 
static void DeserializePolymorphic (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 
static void DeserializeNotPolymorphic (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 
static rttr::variant CreateAndSetObjectProperty (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop, TypeID dynamicType)
 
static rttr::variant CreateInstance (TypeID type)
 
static std::string WstringToUTF (const std::wstring &str)
 
static std::wstring UTFToWstring (const std::string &str)
 
template<typename PropertyType >
static PropertyType GetPropertyValue (rttr::property prop, const rttr::instance &object)
 Returns typed property value.
 
template<typename PropertyType >
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 Serializuje właściwość podanego typu. More...
 
template<typename PropertyType >
static void SerializeProperty (ISerializer &ser, rttr::string_view name, const rttr::variant &propertyValue)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::string_view name, const rttr::variant &propertyValue)
 
template<typename PropertyType >
static void SetPropertyValue (rttr::property prop, const rttr::instance &object, PropertyType value)
 Ustawia wartość podanej właściwości.
 
template<typename PropertyType >
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 Deserializuje właściwość podanego typu. More...
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
static TypeID GetRealType (const rttr::instance &object)
 Gets real type of the object that means most derived and wrapped type.
 
static TypeID GetWrappedType (TypeID type)
 Gets wrapped type. If type isn't wrapper it returns it unmodified.
 
static TypeID GetRawWrappedType (TypeID type)
 First extracts wrapped type and then returns raw type.
 
static SerializationContextContext (const IDeserializer &deser)
 Returns SerialziationContext from deserializer.
 
static void DestroyObject (rttr::variant &object)
 Destroy object in variant.
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::property prop, const rttr::instance &object)
 
template<>
static void SerializeProperty (ISerializer &ser, rttr::string_view name, const rttr::variant &propertyValue)
 
template<>
static void DeserializeProperty (const IDeserializer &deser, rttr::property prop, const rttr::instance &object)
 
Types serialization
static bool SerializeBasicTypes (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 Serialize basic arithemtic types and bool.
 
static bool SerializeVectorTypes (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 
static bool SerializeStringTypes (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 
static bool SerializeEnumTypes (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 
static bool SerializeArrayTypes (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 
static bool SerializeObjectTypes (ISerializer &ser, const rttr::instance &object, rttr::property &prop)
 
static bool SerializeBasicTypes (ISerializer &ser, rttr::string_view name, const rttr::variant &propertyValue)
 
Types deserialization
static bool DeserializeBasicTypes (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 Deserialize basic arithemtic types and bool. More...
 
static bool DeserializeVectorTypes (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 Deserializuje typy DirectXMath. More...
 
static bool DeserializeStringTypes (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 Deserializuje std::string i std::wstring. More...
 
static bool DeserializeEnumTypes (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 Deserializes enum properties from string. More...
 
static bool DeserializeArrayTypes (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 Deserializes arrays. More...
 
static bool DeserializeObjectTypes (const IDeserializer &deser, const rttr::instance &object, rttr::property &prop)
 Deserializes structures and generic objects. More...
 

Detailed Description

Core serialization/deserialization functions.

This class is usefull only if you write your own serialization implementation.

Member Function Documentation

rttr::variant sw::SerializationCore::CreateAndSetObjectProperty ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop,
TypeID  dynamicType 
)
static
Todo:
When created type is raw pointer and property is wrapped type, we could handle this case by creating wrapper from pointer. Consider this in future. Many problems could apear, when it comes to ownership of memory and so on.
Todo:
We must take into considerations other wrapper types which not necessary take ownership of object. To do this we must be able to determine wrapper template type and have some traits connected to ownership. Think about it in future.
bool sw::SerializationCore::DeserializeArrayTypes ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Deserializes arrays.

Returns
Returns true when object have been deserialized. Otherwise you should try with functions deserializing other types.
Todo:
Error handling.
Todo:
This warning should be conditional depending on flag in SerializationContext.
bool sw::SerializationCore::DeserializeBasicTypes ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Deserialize basic arithemtic types and bool.

Deserializuje podstawowe typy.

Funkcja sprawdza typ własciwości i deserializuje go tylko jeżeli jest jednym z obsługiwanych przez nią typów. W przeciwnym razie nie robi nic.

Returns
Funkcja zwraca true, jeżeli udało jej się obsłużyć podany typ.
bool sw::SerializationCore::DeserializeEnumTypes ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Deserializes enum properties from string.

Returns
Returns true when object have been deserialized. Otherwise you should try with functions deserializing other types.

Type haven't been registered.

void sw::SerializationCore::DeserializeNotPolymorphic ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static
Todo:
This warning should be conditional depending on flag in SerializationContext.
Todo:
This warning should be conditional depending on flag in SerializationContext.
bool sw::SerializationCore::DeserializeObjectTypes ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Deserializes structures and generic objects.

Returns
Returns true when object have been deserialized. Otherwise you should try with functions deserializing other types.
void sw::SerializationCore::DeserializePolymorphic ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static
Todo:
This warning should be conditional depending on flag in SerializationContext.
template<typename PropertyType >
void sw::SerializationCore::DeserializeProperty ( const IDeserializer deser,
rttr::property  prop,
const rttr::instance &  object 
)
static

Deserializuje właściwość podanego typu.

Todo:
Można zoptymalizować pobieranie nazwy z właściwości i ograniczyć alokację stringów.
template<>
static void sw::SerializationCore::DeserializeProperty ( const IDeserializer deser,
rttr::property  prop,
const rttr::instance &  object 
)
static
Todo:
Error handling.
bool sw::SerializationCore::DeserializeStringTypes ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Deserializuje std::string i std::wstring.

Returns
Returns true when object have been deserialized. Otherwise you should try with functions deserializing other types.
bool sw::SerializationCore::DeserializeVectorTypes ( const IDeserializer deser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Deserializuje typy DirectXMath.

Returns
Returns true when object have been deserialized. Otherwise you should try with functions deserializing other types.
bool sw::SerializationCore::SerializeEnumTypes ( ISerializer ser,
const rttr::instance &  object,
rttr::property &  prop 
)
static

Type haven't been registered.

template<typename PropertyType >
void sw::SerializationCore::SerializeProperty ( ISerializer ser,
rttr::property  prop,
const rttr::instance &  object 
)
static

Serializuje właściwość podanego typu.

Todo:
Można zoptymalizować pobieranie nazwy z właściwości i ograniczyć alokację stringów.
template<>
void sw::SerializationCore::SerializeProperty ( ISerializer ser,
rttr::property  prop,
const rttr::instance &  object 
)

Template specialization for classes derived from EngineObject.

Function serializes property name as first. Then EngineObject::Serialize method is invoked.

Deprecated:
Use SerializePolymorphic instead.
template<>
void sw::SerializationCore::SerializeProperty ( ISerializer ser,
rttr::property  prop,
const rttr::instance &  object 
)

Specialization for all not polymorphic objects.

Deprecated:
Use DeserializeNotPolymorphic instead.

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