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

Last change on this file was 18, checked in by chronos, 12 years ago
  • Used external packages are now stored in uncompressed form rather in zipped files. This allow better package version synchronisation.
File size: 1.5 KB
Line 
1{$IFDEF INTERFACE}
2
3{$DEFINE TGListIndex := TGSetIndex}
4{$DEFINE TGListItem := TGSetItem}
5{$DEFINE TGList := TGSetList}
6{$DEFINE TGListSortCompare := TGSetSortCompare}
7{$DEFINE TGListToStringConverter := TGSetToStringConverter}
8{$DEFINE TGListFromStringConverter := TGSetFromStringConverter}
9{$DEFINE TGListItemArray := TGSetItemArray}
10{$DEFINE INTERFACE}
11{$I 'GenericList.inc'}
12
13 // TGSet<TGSetIndex, TGSetItem> = class
14 TGSet = class
15 private
16 FList: TGList;
17 public
18 function IsIn(Item: TGSetItem): Boolean;
19 constructor Create;
20 destructor Destroy; override;
21 property List: TGList read FList;
22 end;
23
24{$UNDEF INTERFACE}
25{$ENDIF}
26
27{$IFDEF IMPLEMENTATION_USES}
28
29 {$DEFINE IMPLEMENTATION_USES}
30 {$I 'GenericList.inc'}
31
32{$UNDEF IMPLEMENTATION_USES}
33{$ENDIF}
34
35{$IFDEF IMPLEMENTATION}
36
37{$DEFINE TGListIndex := TGSetIndex}
38{$DEFINE TGListItem := TGSetItem}
39{$DEFINE TGList := TGSetList}
40{$DEFINE TGListSortCompare := TGSetSortCompare}
41{$DEFINE TGListToStringConverter := TGSetToStringConverter}
42{$DEFINE TGListFromStringConverter := TGSetFromStringConverter}
43{$DEFINE TGListItemArray := TGSetItemArray}
44{$DEFINE IMPLEMENTATION}
45{$I 'GenericList.inc'}
46
47{ TGSet }
48
49function TGSet.IsIn(Item: TGSetItem): Boolean;
50begin
51 Result := FList.IndexOf(Item) <> -1;
52end;
53
54constructor TGSet.Create;
55begin
56 FList := TGList.Create;
57end;
58
59destructor TGSet.Destroy;
60begin
61 FList.Free;
62 inherited Destroy;
63end;
64
65{$UNDEF IMPLEMENTATION}
66{$ENDIF}
Note: See TracBrowser for help on using the repository browser.