delphimvcframework/sources/MVCFramework.Serializer.Intf.pas

50 lines
1.7 KiB
ObjectPascal
Raw Normal View History

2017-02-07 14:08:36 +01:00
unit MVCFramework.Serializer.Intf;
interface
uses
2017-02-09 19:33:59 +01:00
Data.DB, MVCFramework.DuckTyping, System.Rtti;
2017-02-07 14:08:36 +01:00
const
DMVC_CLASSNAME = '$dmvc_classname';
2017-02-07 14:08:36 +01:00
type
TMVCSerializationType = (Properties, Fields);
2017-02-09 19:33:59 +01:00
IMVCSerializerListener = interface
2017-02-09 11:24:18 +01:00
['{5976F9DA-1B89-4F8C-B333-C3612071DEE0}']
procedure BeforeSerialize(const AObject: TObject);
procedure AfterDeserialize(const AObject: TObject);
end;
2017-02-09 19:33:59 +01:00
IMVCSerializer = interface
2017-02-07 14:08:36 +01:00
['{1ECA942A-E3C4-45DD-9D23-C00363B5E334}']
function SerializeObject(AObject: TObject; AIgnoredProperties: array of string): String;
function SerializeObjectStrict(AObject: TObject): String;
2017-02-07 14:08:36 +01:00
function SerializeDataSet(ADataSet: TDataSet; AIgnoredFields: array of string): String;
function SerializeCollection(AList: TObject; AIgnoredProperties: array of string): String;
function SerializeCollectionStrict(AList: TObject): String;
2017-02-07 14:08:36 +01:00
procedure DeserializeObject(ASerializedObject: String; AObject: TObject);
2017-02-09 19:33:59 +01:00
procedure DeserializeObjectStrict(ASerializedObject: String; AObject: TObject);
procedure DeserializeCollection(ASerializedObjectList: string; AList: IMVCList; AClazz: TClass);
procedure DeserializeDataSet(ASerializedObject: String; const ADataSet: TDataSet);
2017-02-07 14:08:36 +01:00
end;
2017-02-09 19:33:59 +01:00
IMVCTypeSerializer = interface
['{806EC547-D1CB-4DA9-92D3-A8A7C0BD4009}']
procedure SerializeInstance(
const ElementType: TRTTIType;
const ElementAttributes: TArray<TCustomAttribute>;
2017-02-10 14:19:55 +01:00
const InstanceField: TValue;
var SerializerObject: TObject);
2017-02-09 19:33:59 +01:00
procedure DeserializeInstance(
const ElementType: TRTTIType;
const ElementAttributes: TArray<TCustomAttribute>;
2017-02-10 14:19:55 +01:00
const SerializerObject: TObject;
var InstanceField: TValue);
2017-02-09 19:33:59 +01:00
end;
2017-02-07 14:08:36 +01:00
implementation
end.