Namespace: | Sirenix.Serialization |
Assembly: | Sirenix.Serialization |
public abstract class BaseFormatter<T> : IFormatter<T>, IFormatter
System.Runtime.Serialization.IObjectReference,
The type which can be serialized and deserialized by the formatter.
protected BaseFormatter()
protected static readonly bool ImplementsIDeserializationCallback
protected static readonly bool ImplementsIObjectReference
protected static readonly bool ImplementsISerializationCallbackReceiver
protected static readonly bool IsValueType
protected static readonly BaseFormatter<T>.SerializationCallback[] OnDeserializedCallbacks
protected static readonly BaseFormatter<T>.SerializationCallback[] OnDeserializingCallbacks
protected static readonly BaseFormatter<T>.SerializationCallback[] OnSerializedCallbacks
protected static readonly BaseFormatter<T>.SerializationCallback[] OnSerializingCallbacks
public Type SerializedType { get; }
public T Deserialize(IDataReader reader)
Sirenix.Serialization.IDataReader | reader | The reader to use. |
T | The deserialized value. |
protected abstract void DeserializeImplementation(ref T value, IDataReader reader)
T | value | The uninitialized value to serialize into. This value will have been created earlier using GetUninitializedObject(). |
Sirenix.Serialization.IDataReader | reader | The reader to deserialize with. |
protected virtual T GetUninitializedObject()
T | An uninitialized object of type |
WARNING: This method will not be called automatically if you override GetUninitializedObject and return null! You will have to call it manually after having created the object instance during deserialization.
protected void InvokeOnDeserializingCallbacks(ref T value, DeserializationContext context)
T | value | The value to invoke the callbacks on. |
DeserializationContext | context | The deserialization context. |
NOTE that this method only does anything if
protected void RegisterReferenceID(T value, IDataReader reader)
T | value | The value to register. |
Sirenix.Serialization.IDataReader | reader | The reader which is currently being used. |
public void Serialize(T value, IDataWriter writer)
T | value | The value to serialize. |
Sirenix.Serialization.IDataWriter | writer | The writer to use. |
protected abstract void SerializeImplementation(ref T value, IDataWriter writer)
T | value | The value to serialize. |
Sirenix.Serialization.IDataWriter | writer | The writer to serialize with. |