-
Notifications
You must be signed in to change notification settings - Fork 0
/
uStringsStringList.pas
60 lines (48 loc) · 1.31 KB
/
uStringsStringList.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
54
55
56
57
58
59
60
unit uStringsStringList;
interface
uses Classes, SysUtils;
type
TStringsStringList = class(TStringList)
private
function GetStringList(Index: Integer): TStringList;
procedure SetStringList(Index: Integer; const Value: TStringList);
//---
public
destructor Destroy; override;
//---
function AddStringList(const S:AnsiString):TStringList;
function Add(const S: string): Integer; override;
//---
property Objects[Index: Integer]: TStringList read GetStringList write SetStringList;
end;
implementation
{ TStringsStringList }
function TStringsStringList.Add(const S: string): Integer;
begin
Result := AddObject(S, TStringList.Create);
end;
function TStringsStringList.AddStringList(const S: AnsiString): TStringList;
begin
Result := TStringList.Create;
AddObject(S, Result);
end;
destructor TStringsStringList.Destroy;
var j: Integer;
begin
for j:=0 to Count-1 do
begin
Objects[j].Free;
inherited Objects[j] := nil;
end;
inherited;
end;
function TStringsStringList.GetStringList(Index: Integer): TStringList;
begin
Result := inherited Objects[index] as TStringList
end;
procedure TStringsStringList.SetStringList(Index: Integer;
const Value: TStringList);
begin
inherited Objects[index] := Value
end;
end.