source: trunk/Packages/TemplateGenerics/Generic/GenericListString.inc

Last change on this file was 13, checked in by chronos, 10 years ago
  • Added: Basic parsing of "Depends on" expressions.
File size: 1.8 KB
Line 
1{$IFDEF INTERFACE}
2
3{$DEFINE TGListIndex := TGListStringIndex}
4{$DEFINE TGListItem := TGListStringItem}
5{$DEFINE TGList := TGListStringList}
6{$DEFINE INTERFACE}
7{$I 'GenericList.inc'}
8
9 // TGListString<TListStringIndex, TListStringItem> = class(TGList)
10 TGListString = class(TGList)
11 private
12 public
13 procedure Delete(Index: TGListStringIndex); override;
14 procedure Clear; override;
15 procedure Assign(Source: TGList); override;
16 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; override;
17 constructor Create; override;
18 destructor Destroy; override;
19 end;
20
21{$UNDEF INTERFACE}
22{$ENDIF}
23
24{$IFDEF IMPLEMENTATION_USES}
25
26 {$DEFINE IMPLEMENTATION_USES}
27 {$I 'GenericList.inc'}
28
29{$UNDEF IMPLEMENTATION_USES}
30{$ENDIF}
31
32{$IFDEF IMPLEMENTATION}
33
34{$DEFINE TGListIndex := TGListStringIndex}
35{$DEFINE TGListItem := TGListStringItem}
36{$DEFINE TGList := TGListStringList}
37{$DEFINE IMPLEMENTATION}
38{$I 'GenericList.inc'}
39
40{ TGListString }
41
42procedure TGListString.Assign(Source: TGList);
43begin
44 Clear;
45 inherited;
46end;
47
48procedure TGListString.Delete(Index: TGListStringIndex);
49begin
50 FItems[Index] := '';
51 inherited Delete(Index);
52end;
53
54procedure TGListString.Clear;
55var
56 I: TGListStringIndex;
57begin
58 I := 0;
59 while I < Count do begin
60 FItems[I] := '';
61 I := I + 1;
62 end;
63 inherited Clear;
64end;
65
66function TGListString.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex;
67begin
68 Result := Start;
69 while (Result < Count) and
70 (CompareStr(FItems[Result], Item) <> 0) do
71 Result := Result + 1;
72 if Result = FCount then Result := -1;
73end;
74
75constructor TGListString.Create;
76begin
77 inherited;
78end;
79
80destructor TGListString.Destroy;
81begin
82 Clear;
83 inherited Destroy;
84end;
85
86{$UNDEF IMPLEMENTATION}
87{$ENDIF}
Note: See TracBrowser for help on using the repository browser.