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/Demo/ListObject.pas

    r82 r84  
    22
    33{$mode delphi}
     4{$MACRO ON}
    45
    56interface
     
    910
    1011type
    11   TObjectListIndex = Integer;
    12   TObjectListItem = TObject;
    13 {$INCLUDE '..\Generic\ObjectListInterface.tpl'}
     12// TListObject<Integer, TObject>
     13{$DEFINE TGObjectListIndex := Integer}
     14{$DEFINE TGObjectListItem := TObject}
     15{$DEFINE TGObjectListList := TObjectListList}
     16{$DEFINE TGObjectList := TListObject}
     17{$DEFINE TGObjectListSortCompare := TObjectListSortCompareInteger}
     18{$DEFINE TGObjectListStringConverter := TObjectListStringConverterInteger}
     19{$DEFINE INTERFACE}
     20{$INCLUDE '..\Generic\GenericObjectList.inc'}
    1421
    15 type
    16 
    17   { TListObject }
    18 
    19   TListObject = class(TGObjectList)
    20   end;
    2122
    2223implementation
    2324
    24 {$INCLUDE '..\Generic\ObjectListImplementation.tpl'}
     25// TListObject<Integer, TObject>
     26{$DEFINE TGObjectListIndex := Integer}
     27{$DEFINE TGObjectListItem := TObject}
     28{$DEFINE TGObjectListList := TObjectListList}
     29{$DEFINE TGObjectList := TListObject}
     30{$DEFINE TGObjectListSortCompare := TObjectListSortCompareInteger}
     31{$DEFINE TGObjectListStringConverter := TObjectListStringConverterInteger}
     32{$DEFINE IMPLEMENTATION}
     33{$INCLUDE '..\Generic\GenericObjectList.inc'}
    2534
    2635end.
Note: See TracChangeset for help on using the changeset viewer.