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

    r83 r84  
    11{$IFDEF INTERFACE}
    22
    3   TListIndex = TStackIndex;
    4   TListItem = TStackItem;
    5   {$DEFINE INTERFACE}
    6   {$INCLUDE 'GenericList.inc'}
     3{$DEFINE TGListIndex := TGStackIndex}
     4{$DEFINE TGListItem := TGStackItem}
     5{$DEFINE TGList := TGStackList}
     6{$DEFINE TGListSortCompare := TGStackSortCompare}
     7{$DEFINE TGListStringConverter := TGStackStringConverter}
     8{$DEFINE INTERFACE}
     9{$INCLUDE 'GenericList.inc'}
    710
    811  // TGStack<TStackIndex, TStackItem> = class(TGList)
     
    1114    FList: TGList;
    1215  public
    13     procedure Push(Value: TStackItem);
    14     function Pop: TStackItem;
     16    procedure Push(Value: TGStackItem);
     17    function Pop: TGStackItem;
    1518    constructor Create;
    1619    destructor Destroy; override;
     
    2124{$ENDIF}
    2225
     26{$IFDEF IMPLEMENTATION_USES}
     27
     28  {$DEFINE IMPLEMENTATION_USES}
     29  {$INCLUDE '..\Generic\GenericList.inc'}
     30
     31{$UNDEF IMPLEMENTATION_USES}
     32{$ENDIF}
     33
    2334{$IFDEF IMPLEMENTATION}
    2435
     36{$DEFINE TGListIndex := TGStackIndex}
     37{$DEFINE TGListItem := TGStackItem}
     38{$DEFINE TGList := TGStackList}
     39{$DEFINE TGListSortCompare := TGStackSortCompare}
     40{$DEFINE TGListStringConverter := TGStackStringConverter}
    2541{$DEFINE IMPLEMENTATION}
    2642{$INCLUDE 'GenericList.inc'}
     
    2844{ TGStack }
    2945
    30 procedure TGStack.Push(Value: TStackItem);
     46procedure TGStack.Push(Value: TGStackItem);
    3147begin
    3248  FList.Add(Value);
    3349end;
    3450
    35 function TGStack.Pop: TStackItem;
     51function TGStack.Pop: TGStackItem;
    3652begin
    3753  Result := FList.Extract(FList.Last);
     
    4965end;
    5066
     67{$UNDEF IMPLEMENTATION}
    5168{$ENDIF}
Note: See TracChangeset for help on using the changeset viewer.