Class TSerializationProcess
Unit
Declaration
type TSerializationProcess = class abstract(TObject)
Description
Call methods of this class within TCastleComponent.CustomSerialization override. Do not create instances of this class yourself.
Hierarchy
- TObject
- TSerializationProcess
Overview
Nested Types
TListAddEvent = procedure (const NewComponent: TComponent) of object; |
|
TListClearEvent = procedure of object; |
|
TListEnumerateEvent = procedure (const Proc: TGetChildProc) of object; |
Methods
procedure ReadWriteInteger(const Key: String; var Value: Integer; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteBoolean(const Key: String; var Value: Boolean; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteString(const Key: String; var Value: String; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteSingle(const Key: String; var Value: Single; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteSubComponent(const Key: String; const Value: TComponent; const IsStored: Boolean); virtual; abstract; |
|
procedure ReadWriteList(const Key: String; const ListEnumerate: TListEnumerateEvent; const ListAdd: TListAddEvent; const ListClear: TListClearEvent); virtual; abstract; |
Description
Nested Types
TListAddEvent = procedure (const NewComponent: TComponent) of object; |
|
TListClearEvent = procedure of object; |
|
TListEnumerateEvent = procedure (const Proc: TGetChildProc) of object; |
|
Methods
procedure ReadWriteInteger(const Key: String; var Value: Integer; const IsStored: Boolean); overload; virtual; abstract; |
|
Serialize and deserialize given simple Value. This mechanism allows to explicitly serialize/deserialize any internal value, without the need to make it a published property. When deserializing, we always try to read it from file. If it is not present, the Value is not modified. When serializing, we write it to file only if IsStored. Generally IsStored=false should indicate "the Value is the same as when the object is created, thus there's no point in serializing it". The values are guaranteed to be read/written in the same way as if a published property with the same name (Key) and same type would be read/written. This allows to utilize this mechanism to read, to a local/private variable, a value that was previously a published property value. This is a way to provide backward-compatibility for old designs: this way class can interpret old values in design files, even though it no longer publishes given property.
See also
|
procedure ReadWriteBoolean(const Key: String; var Value: Boolean; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteString(const Key: String; var Value: String; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteSingle(const Key: String; var Value: Single; const IsStored: Boolean); overload; virtual; abstract; |
|
procedure ReadWriteSubComponent(const Key: String; const Value: TComponent; const IsStored: Boolean); virtual; abstract; |
|
Serialize and deserialize a subcomponent. Being a subcomponent, we know that Value is not nil, and it is not referenced anywhere else in the design (so serialization/deserialization can expect class contents, not just name), so we just serialize and deserialize the contents. When deserializing, we always try to read it from file. If it is not present, nothing is modified. When serializing, we write it to file only if IsStored. Generally IsStored=false should indicate "the Value is the same as when the object is created, thus there's no point in serializing it". The values are guaranteed to be read/written in the same way as if a published property with the same name (Key) and same type would be read/written. This allows to utilize this mechanism to read, to a local/private variable, a value that was previously a published property value. This is a way to provide backward-compatibility for old designs: this way class can interpret old values in design files, even though it no longer publishes given property.
See also
|
procedure ReadWriteList(const Key: String; const ListEnumerate: TListEnumerateEvent; const ListAdd: TListAddEvent; const ListClear: TListClearEvent); virtual; abstract; |
|
Make a list serialized and deserialized. The definition of list is very flexible here, you provide callbacks that should, when called,
Do not worry about conflict between Key and some published property. We internally "mangle" keys to avoid it. |
Generated by PasDoc 0.16.0.