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/GenericObjectList.inc

    r83 r84  
    11{$IFDEF INTERFACE}
    22
    3   TListIndex = TObjectListIndex;
    4   TListItem = TObjectListItem;
    5   {$DEFINE INTERFACE}
    6   {$INCLUDE 'GenericList.inc'}
     3{$DEFINE TGListIndex := TGObjectListIndex}
     4{$DEFINE TGListItem := TGObjectListItem}
     5{$DEFINE TGList := TGObjectListList}
     6{$DEFINE TGListSortCompare := TGObjectListSortCompare}
     7{$DEFINE TGListStringConverter := TObjectListStringConverter}
     8{$DEFINE INTERFACE}
     9{$INCLUDE 'GenericList.inc'}
    710
    811  // TGObjectList<TObjectListIndex, TObjectListItem> = class(TGList)
    912  TGObjectList = class(TGList)
    1013  private
    11     procedure Put(Index: TListIndex; const AValue: TListItem); override;
     14    procedure Put(Index: TGListIndex; const AValue: TGListItem); override;
    1215  public
    1316    OwnsObjects: Boolean;
    14     procedure Delete(Index: TListIndex); override;
     17    procedure Delete(Index: TGObjectListIndex); override;
    1518    procedure Clear; override;
    1619    constructor Create;
     
    2326{$IFDEF IMPLEMENTATION}
    2427
     28{$UNDEF IMPLEMENTATION}
     29{$DEFINE IMPLEMENTATION_USES}
     30{$INCLUDE '..\Generic\GenericList.inc'}
     31
     32{$DEFINE TGListIndex := TGObjectListIndex}
     33{$DEFINE TGListItem := TGObjectListItem}
     34{$DEFINE TGList := TGObjectListList}
     35{$DEFINE TGListSortCompare := TGObjectListSortCompare}
     36{$DEFINE TGListStringConverter := TObjectListStringConverter}
    2537{$DEFINE IMPLEMENTATION}
    2638{$INCLUDE 'GenericList.inc'}
     
    2840{ TGObjectList }
    2941
    30 procedure TGObjectList.Put(Index: TObjectListIndex; const AValue: TObjectListItem);
     42procedure TGObjectList.Put(Index: TGListIndex; const AValue: TGListItem);
    3143begin
    3244  if OwnsObjects then FItems[Index].Free;
     
    3446end;
    3547
    36 procedure TGObjectList.Delete(Index: TObjectListIndex);
     48procedure TGObjectList.Delete(Index: TGObjectListIndex);
    3749begin
    3850  if OwnsObjects then FItems[Index].Free;
     
    4254procedure TGObjectList.Clear;
    4355var
    44   I: TObjectListIndex;
     56  I: TGObjectListIndex;
    4557begin
    4658  if OwnsObjects then begin
     
    6678end;
    6779
     80{$UNDEF IMPLEMENTATION}
    6881{$ENDIF}
Note: See TracChangeset for help on using the changeset viewer.