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

Last change on this file was 1, checked in by chronos, 8 years ago
  • Imported initial version.
File size: 1.1 KB
Line 
1{$IFDEF INTERFACE}
2
3{$DEFINE TGListIndex := TGSetIndex}
4{$DEFINE TGListItem := TGSetItem}
5{$DEFINE TGList := TGSetList}
6{$DEFINE INTERFACE}
7{$I 'GenericList.inc'}
8
9 // TGSet<TGSetIndex, TGSetItem> = class
10 TGSet = class
11 private
12 FList: TGList;
13 public
14 function IsIn(Item: TGSetItem): Boolean;
15 constructor Create;
16 destructor Destroy; override;
17 property List: TGList read FList;
18 end;
19
20{$UNDEF INTERFACE}
21{$ENDIF}
22
23{$IFDEF IMPLEMENTATION_USES}
24
25 {$DEFINE IMPLEMENTATION_USES}
26 {$I 'GenericList.inc'}
27
28{$UNDEF IMPLEMENTATION_USES}
29{$ENDIF}
30
31{$IFDEF IMPLEMENTATION}
32
33{$DEFINE TGListIndex := TGSetIndex}
34{$DEFINE TGListItem := TGSetItem}
35{$DEFINE TGList := TGSetList}
36{$DEFINE IMPLEMENTATION}
37{$I 'GenericList.inc'}
38
39{ TGSet }
40
41function TGSet.IsIn(Item: TGSetItem): Boolean;
42begin
43 Result := FList.IndexOf(Item) <> -1;
44end;
45
46constructor TGSet.Create;
47begin
48 FList := TGList.Create;
49end;
50
51destructor TGSet.Destroy;
52begin
53 FList.Free;
54 inherited Destroy;
55end;
56
57{$UNDEF IMPLEMENTATION}
58{$ENDIF}
Note: See TracBrowser for help on using the repository browser.