-
Notifications
You must be signed in to change notification settings - Fork 10
/
msObjectWrap.mixin.pas
53 lines (36 loc) · 996 Bytes
/
msObjectWrap.mixin.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{$IfNDef TmsObjectWrap_uses_intf}
// interface
{$Define TmsObjectWrap_uses_intf}
// uses
msSerializeInterfaces
{$Else TmsObjectWrap_uses_intf}
{$IfNDef TmsObjectWrap_intf}
TmsObjectWrap = class abstract(TmsObjectWrapParent{, ImsObjectWrap})
protected
function toObject: TObject;
function EQ(const anOther: ImsObjectWrap): Boolean;
end;//TmsObjectWrap
// http://programmingmindstream.blogspot.ru/2014/12/generic-2.html
{$Define TmsObjectWrap_intf}
{$Else TmsObjectWrap_intf}
// implementation
{$IfNDef TmsObjectWrap_uses_impl}
// uses
{$Define TmsObjectWrap_uses_impl}
{$Else TmsObjectWrap_uses_impl}
// TmsObjectWrap
function TmsObjectWrap.toObject: TObject;
begin
Result := Self;
end;
function TmsObjectWrap.EQ(const anOther: ImsObjectWrap): Boolean;
begin
Assert(Self <> nil);
if (anOther = nil) then
Result := false
else
Result := (Self = anOther.toObject);
end;
{$EndIf TmsObjectWrap_uses_impl}
{$EndIf TmsObjectWrap_intf}
{$EndIf TmsObjectWrap_uses_intf}