Ignore:
Timestamp:
Oct 31, 2010, 3:14:23 PM (14 years ago)
Author:
george
Message:
  • Modified: Thanks to compiler directives and simple macros specialized types was moved to one unit per base generic class. Directive $DEFINE is used to specify generic class template parameters which will be included to code. This approach enable to define more specialized types per unit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Generic/GenericSet.inc

    r83 r84  
    11{$IFDEF INTERFACE}
    22
    3   TListIndex = TSetIndex;
    4   TListItem = TSetItem;
    5   {$DEFINE INTERFACE}
    6   {$INCLUDE 'GenericList.inc'}
     3{$DEFINE TGListIndex := TGSetIndex}
     4{$DEFINE TGListItem := TGSetItem}
     5{$DEFINE TGList := TGSetList}
     6{$DEFINE TGListSortCompare := TGSetSortCompare}
     7{$DEFINE TGListStringConverter := TGSetStringConverter}
     8{$DEFINE INTERFACE}
     9{$INCLUDE 'GenericList.inc'}
    710
    8   // TGSet<TSetIndex, TSetItem> = class(TGSet)
     11  // TGSet<TGSetIndex, TGSetItem> = class
    912  TGSet = class
    1013  private
    1114    FList: TGList;
    1215  public
    13     function IsIn(Item: TSetItem): Boolean;
     16    function IsIn(Item: TGSetItem): Boolean;
    1417    constructor Create;
    1518    destructor Destroy; override;
     
    2023{$ENDIF}
    2124
     25{$IFDEF IMPLEMENTATION_USES}
     26
     27  {$DEFINE IMPLEMENTATION_USES}
     28  {$INCLUDE '..\Generic\GenericList.inc'}
     29
     30{$UNDEF IMPLEMENTATION_USES}
     31{$ENDIF}
     32
    2233{$IFDEF IMPLEMENTATION}
    2334
     35{$DEFINE TGListIndex := TGSetIndex}
     36{$DEFINE TGListItem := TGSetItem}
     37{$DEFINE TGList := TGSetList}
     38{$DEFINE TGListSortCompare := TGSetSortCompare}
     39{$DEFINE TGListStringConverter := TGSetStringConverter}
    2440{$DEFINE IMPLEMENTATION}
    2541{$INCLUDE 'GenericList.inc'}
     
    2743{ TGSet }
    2844
    29 function TGSet.IsIn(Item: TSetItem): Boolean;
     45function TGSet.IsIn(Item: TGSetItem): Boolean;
    3046begin
    3147  Result := FList.IndexOf(Item) <> -1;
     
    4359end;
    4460
     61{$UNDEF IMPLEMENTATION}
    4562{$ENDIF}
Note: See TracChangeset for help on using the changeset viewer.