unit SuBaseProperty interface uses System Generics Collections Type PB

 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
unit SuBaseProperty;
interface
uses
System.Generics.Collections;
Type
PBaseProperty = class
private
m_Owner : Cardinal;
m_Entries : TDictionary<Cardinal,TList<String>>;
public
Constructor Create(AOwner:Cardinal);
class function CreateObject(AOwner:Cardinal):PBaseProperty;
function GetParams(ClilocID:Cardinal):TList<String>;
function Contains(ClilocID:Cardinal):Boolean;
property Owner : Cardinal read m_Owner;
end;
implementation
uses
SUStealth; //Stealth_Wrapper.pas => Name may be different!
{ PBaseObject }
function PBaseProperty.Contains(ClilocID: Cardinal): Boolean;
var
ergebnis : Boolean;
begin
ergebnis := False;
if( Assigned(m_Entries))then
begin
ergebnis := m_Entries.ContainsKey(ClilocID);
end;
Result := ergebnis;
end;
constructor PBaseProperty.Create(AOwner: Cardinal);
var
ObjectList : TClilocRec;
SubObject : TClilocItemRec;
list : TList<String>;
begin
m_Owner := AOwner;
ObjectList := TUOObject.GetClilocRec(AOwner);
m_Entries := TDictionary<Cardinal,TList<String>>.Create;;
for SubObject in ObjectList.Items do
begin
list := TList<String>.Create();
list.AddRange(SubObject.Params);
m_Entries.Add(SubObject.ClilocID,list);
end;
end;
class function PBaseProperty.CreateObject(AOwner: Cardinal): PBaseProperty;
begin
Result := PBaseProperty.Create(AOwner);
end;
function PBaseProperty.GetParams(ClilocID: Cardinal): TList<String>;
var
ergebnis : TList<String>;
begin
if(Contains(ClilocID))then
begin
ergebnis := m_Entries[ClilocID];
end;
if(ergebnis = nil)then
begin
ergebnis := TList<String>.Create;
end;
Result := ergebnis;
end;
end.