Changeset 84 for Generics


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.
Location:
Generics/TemplateGenerics
Files:
6 added
26 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Demo/Demo.lpi

    r83 r84  
    3535      </Item2>
    3636    </RequiredPackages>
    37     <Units Count="78">
     37    <Units Count="92">
    3838      <Unit0>
    3939        <Filename Value="Demo.lpr"/>
     
    4343        <TopLine Value="1"/>
    4444        <CursorPos X="26" Y="8"/>
    45         <UsageCount Value="56"/>
     45        <UsageCount Value="63"/>
    4646        <DefaultSyntaxHighlighter Value="Delphi"/>
    4747      </Unit0>
     
    5454        <EditorIndex Value="0"/>
    5555        <WindowIndex Value="0"/>
    56         <TopLine Value="1"/>
    57         <CursorPos X="1" Y="12"/>
    58         <UsageCount Value="56"/>
     56        <TopLine Value="342"/>
     57        <CursorPos X="51" Y="360"/>
     58        <UsageCount Value="63"/>
    5959        <Loaded Value="True"/>
    6060        <LoadedDesigner Value="True"/>
     
    201201        <Filename Value="../Specialized/ListDouble.pas"/>
    202202        <UnitName Value="ListDouble"/>
    203         <EditorIndex Value="2"/>
    204         <WindowIndex Value="0"/>
    205         <TopLine Value="1"/>
    206         <CursorPos X="19" Y="13"/>
    207         <UsageCount Value="25"/>
    208         <Loaded Value="True"/>
     203        <WindowIndex Value="0"/>
     204        <TopLine Value="1"/>
     205        <CursorPos X="1" Y="11"/>
     206        <UsageCount Value="25"/>
    209207      </Unit19>
    210208      <Unit20>
    211         <Filename Value="../Specialized/ListInteger.pas"/>
    212         <UnitName Value="ListInteger"/>
    213         <WindowIndex Value="0"/>
    214         <TopLine Value="1"/>
    215         <CursorPos X="25" Y="17"/>
     209        <Filename Value="../Specialized/specializedlist.pas"/>
     210        <UnitName Value="SpecializedList"/>
     211        <WindowIndex Value="0"/>
     212        <TopLine Value="3"/>
     213        <CursorPos X="43" Y="13"/>
    216214        <UsageCount Value="25"/>
    217215      </Unit20>
     
    615613        <IsPartOfProject Value="True"/>
    616614        <UnitName Value="ListObject"/>
    617         <EditorIndex Value="4"/>
    618         <WindowIndex Value="0"/>
    619         <TopLine Value="1"/>
    620         <CursorPos X="30" Y="23"/>
    621         <UsageCount Value="22"/>
     615        <EditorIndex Value="15"/>
     616        <WindowIndex Value="0"/>
     617        <TopLine Value="1"/>
     618        <CursorPos X="15" Y="12"/>
     619        <UsageCount Value="29"/>
    622620        <Loaded Value="True"/>
    623621        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    665663        <Filename Value="../Specialized/StackDouble.pas"/>
    666664        <UnitName Value="StackDouble"/>
    667         <EditorIndex Value="3"/>
    668665        <WindowIndex Value="0"/>
    669666        <TopLine Value="1"/>
    670667        <CursorPos X="1" Y="1"/>
    671         <UsageCount Value="10"/>
    672         <Loaded Value="True"/>
     668        <UsageCount Value="11"/>
    673669      </Unit76>
    674670      <Unit77>
    675671        <Filename Value="../Specialized/DictionaryStringString.pas"/>
    676672        <UnitName Value="DictionaryStringString"/>
     673        <WindowIndex Value="0"/>
     674        <TopLine Value="1"/>
     675        <CursorPos X="2" Y="5"/>
     676        <UsageCount Value="11"/>
     677      </Unit77>
     678      <Unit78>
     679        <Filename Value="../Generic/GenericList.inc"/>
     680        <EditorIndex Value="14"/>
     681        <WindowIndex Value="0"/>
     682        <TopLine Value="43"/>
     683        <CursorPos X="32" Y="65"/>
     684        <UsageCount Value="13"/>
     685        <Loaded Value="True"/>
     686        <DefaultSyntaxHighlighter Value="Delphi"/>
     687      </Unit78>
     688      <Unit79>
     689        <Filename Value="../Specialized/SpecializedList.pas"/>
     690        <UnitName Value="SpecializedList"/>
     691        <EditorIndex Value="1"/>
     692        <WindowIndex Value="0"/>
     693        <TopLine Value="1"/>
     694        <CursorPos X="1" Y="11"/>
     695        <UsageCount Value="13"/>
     696        <Loaded Value="True"/>
     697      </Unit79>
     698      <Unit80>
     699        <Filename Value="../Generic/GenericDictionary.inc"/>
     700        <EditorIndex Value="2"/>
     701        <WindowIndex Value="0"/>
     702        <TopLine Value="1"/>
     703        <CursorPos X="1" Y="10"/>
     704        <UsageCount Value="13"/>
     705        <Loaded Value="True"/>
     706        <DefaultSyntaxHighlighter Value="Delphi"/>
     707      </Unit80>
     708      <Unit81>
     709        <Filename Value="../Generic/GenericObjectList.inc"/>
     710        <EditorIndex Value="4"/>
     711        <WindowIndex Value="0"/>
     712        <TopLine Value="34"/>
     713        <CursorPos X="8" Y="56"/>
     714        <UsageCount Value="13"/>
     715        <Loaded Value="True"/>
     716        <DefaultSyntaxHighlighter Value="Delphi"/>
     717      </Unit81>
     718      <Unit82>
     719        <Filename Value="../Generic/GenericQueue.inc"/>
     720        <EditorIndex Value="7"/>
     721        <WindowIndex Value="0"/>
     722        <TopLine Value="1"/>
     723        <CursorPos X="1" Y="3"/>
     724        <UsageCount Value="13"/>
     725        <Loaded Value="True"/>
     726        <DefaultSyntaxHighlighter Value="Delphi"/>
     727      </Unit82>
     728      <Unit83>
     729        <Filename Value="../Generic/GenericSet.inc"/>
     730        <EditorIndex Value="12"/>
     731        <WindowIndex Value="0"/>
     732        <TopLine Value="1"/>
     733        <CursorPos X="42" Y="11"/>
     734        <UsageCount Value="13"/>
     735        <Loaded Value="True"/>
     736        <DefaultSyntaxHighlighter Value="Delphi"/>
     737      </Unit83>
     738      <Unit84>
     739        <Filename Value="../Generic/GenericStack.inc"/>
     740        <EditorIndex Value="11"/>
     741        <WindowIndex Value="0"/>
     742        <TopLine Value="1"/>
     743        <CursorPos X="1" Y="3"/>
     744        <UsageCount Value="13"/>
     745        <Loaded Value="True"/>
     746        <DefaultSyntaxHighlighter Value="Delphi"/>
     747      </Unit84>
     748      <Unit85>
     749        <Filename Value="../Generic/GenericTree.inc"/>
     750        <EditorIndex Value="13"/>
     751        <WindowIndex Value="0"/>
     752        <TopLine Value="1"/>
     753        <CursorPos X="22" Y="30"/>
     754        <UsageCount Value="13"/>
     755        <Loaded Value="True"/>
     756        <DefaultSyntaxHighlighter Value="Delphi"/>
     757      </Unit85>
     758      <Unit86>
     759        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     760        <UnitName Value="SpecializedDictionary"/>
     761        <EditorIndex Value="9"/>
     762        <WindowIndex Value="0"/>
     763        <TopLine Value="1"/>
     764        <CursorPos X="1" Y="13"/>
     765        <UsageCount Value="12"/>
     766        <Loaded Value="True"/>
     767      </Unit86>
     768      <Unit87>
     769        <Filename Value="../Specialized/SpecializedStack.pas"/>
     770        <UnitName Value="SpecializedStack"/>
     771        <EditorIndex Value="10"/>
     772        <WindowIndex Value="0"/>
     773        <TopLine Value="1"/>
     774        <CursorPos X="1" Y="13"/>
     775        <UsageCount Value="11"/>
     776        <Loaded Value="True"/>
     777      </Unit87>
     778      <Unit88>
     779        <Filename Value="../Specialized/SpecializedTree.pas"/>
     780        <UnitName Value="SpecializedTree"/>
    677781        <IsVisibleTab Value="True"/>
    678         <EditorIndex Value="1"/>
    679         <WindowIndex Value="0"/>
    680         <TopLine Value="1"/>
    681         <CursorPos X="23" Y="26"/>
    682         <UsageCount Value="10"/>
    683         <Loaded Value="True"/>
    684       </Unit77>
     782        <EditorIndex Value="3"/>
     783        <WindowIndex Value="0"/>
     784        <TopLine Value="1"/>
     785        <CursorPos X="1" Y="11"/>
     786        <UsageCount Value="11"/>
     787        <Loaded Value="True"/>
     788      </Unit88>
     789      <Unit89>
     790        <Filename Value="../Generic/GenericRange.inc"/>
     791        <EditorIndex Value="8"/>
     792        <WindowIndex Value="0"/>
     793        <TopLine Value="1"/>
     794        <CursorPos X="1" Y="44"/>
     795        <UsageCount Value="11"/>
     796        <Loaded Value="True"/>
     797        <DefaultSyntaxHighlighter Value="Delphi"/>
     798      </Unit89>
     799      <Unit90>
     800        <Filename Value="../Specialized/SpecializedQueue.pas"/>
     801        <UnitName Value="SpecializedQueue"/>
     802        <EditorIndex Value="5"/>
     803        <WindowIndex Value="0"/>
     804        <TopLine Value="1"/>
     805        <CursorPos X="1" Y="13"/>
     806        <UsageCount Value="11"/>
     807        <Loaded Value="True"/>
     808      </Unit90>
     809      <Unit91>
     810        <Filename Value="../Specialized/SpecializedSet.pas"/>
     811        <UnitName Value="SpecializedSet"/>
     812        <EditorIndex Value="6"/>
     813        <WindowIndex Value="0"/>
     814        <TopLine Value="1"/>
     815        <CursorPos X="1" Y="13"/>
     816        <UsageCount Value="11"/>
     817        <Loaded Value="True"/>
     818      </Unit91>
    685819    </Units>
    686     <JumpHistory Count="25" HistoryIndex="24">
     820    <JumpHistory Count="30" HistoryIndex="29">
    687821      <Position1>
    688         <Filename Value="UMainForm.pas"/>
    689         <Caret Line="367" Column="1" TopLine="341"/>
     822        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     823        <Caret Line="22" Column="23" TopLine="1"/>
    690824      </Position1>
    691825      <Position2>
    692         <Filename Value="UMainForm.pas"/>
    693         <Caret Line="368" Column="1" TopLine="341"/>
     826        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     827        <Caret Line="19" Column="42" TopLine="1"/>
    694828      </Position2>
    695829      <Position3>
    696         <Filename Value="UMainForm.pas"/>
    697         <Caret Line="364" Column="18" TopLine="348"/>
     830        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     831        <Caret Line="18" Column="24" TopLine="1"/>
    698832      </Position3>
    699833      <Position4>
    700         <Filename Value="UMainForm.pas"/>
    701         <Caret Line="345" Column="5" TopLine="329"/>
     834        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     835        <Caret Line="19" Column="43" TopLine="1"/>
    702836      </Position4>
    703837      <Position5>
    704         <Filename Value="UMainForm.pas"/>
    705         <Caret Line="346" Column="14" TopLine="329"/>
     838        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     839        <Caret Line="39" Column="5" TopLine="3"/>
    706840      </Position5>
    707841      <Position6>
    708         <Filename Value="UMainForm.pas"/>
    709         <Caret Line="411" Column="23" TopLine="383"/>
     842        <Filename Value="../Specialized/SpecializedStack.pas"/>
     843        <Caret Line="19" Column="36" TopLine="1"/>
    710844      </Position6>
    711845      <Position7>
    712         <Filename Value="UMainForm.pas"/>
    713         <Caret Line="407" Column="21" TopLine="383"/>
     846        <Filename Value="../Specialized/SpecializedStack.pas"/>
     847        <Caret Line="5" Column="1" TopLine="1"/>
    714848      </Position7>
    715849      <Position8>
    716         <Filename Value="UMainForm.pas"/>
    717         <Caret Line="376" Column="19" TopLine="349"/>
     850        <Filename Value="../Generic/GenericStack.inc"/>
     851        <Caret Line="28" Column="34" TopLine="13"/>
    718852      </Position8>
    719853      <Position9>
    720854        <Filename Value="UMainForm.pas"/>
    721         <Caret Line="373" Column="8" TopLine="349"/>
     855        <Caret Line="9" Column="7" TopLine="1"/>
    722856      </Position9>
    723857      <Position10>
    724858        <Filename Value="UMainForm.pas"/>
    725         <Caret Line="412" Column="1" TopLine="383"/>
     859        <Caret Line="10" Column="20" TopLine="1"/>
    726860      </Position10>
    727861      <Position11>
    728862        <Filename Value="UMainForm.pas"/>
    729         <Caret Line="427" Column="24" TopLine="399"/>
     863        <Caret Line="20" Column="49" TopLine="1"/>
    730864      </Position11>
    731865      <Position12>
    732         <Filename Value="UMainForm.pas"/>
    733         <Caret Line="427" Column="58" TopLine="399"/>
     866        <Filename Value="ListObject.pas"/>
     867        <Caret Line="23" Column="30" TopLine="1"/>
    734868      </Position12>
    735869      <Position13>
    736870        <Filename Value="UMainForm.pas"/>
    737         <Caret Line="367" Column="12" TopLine="350"/>
     871        <Caret Line="22" Column="35" TopLine="1"/>
    738872      </Position13>
    739873      <Position14>
    740874        <Filename Value="UMainForm.pas"/>
    741         <Caret Line="428" Column="7" TopLine="411"/>
     875        <Caret Line="110" Column="12" TopLine="81"/>
    742876      </Position14>
    743877      <Position15>
    744878        <Filename Value="UMainForm.pas"/>
    745         <Caret Line="349" Column="3" TopLine="332"/>
     879        <Caret Line="133" Column="9" TopLine="103"/>
    746880      </Position15>
    747881      <Position16>
    748882        <Filename Value="UMainForm.pas"/>
    749         <Caret Line="428" Column="35" TopLine="411"/>
     883        <Caret Line="162" Column="7" TopLine="136"/>
    750884      </Position16>
    751885      <Position17>
    752886        <Filename Value="UMainForm.pas"/>
    753         <Caret Line="432" Column="47" TopLine="411"/>
     887        <Caret Line="171" Column="1" TopLine="152"/>
    754888      </Position17>
    755889      <Position18>
    756890        <Filename Value="UMainForm.pas"/>
    757         <Caret Line="10" Column="25" TopLine="1"/>
     891        <Caret Line="190" Column="7" TopLine="165"/>
    758892      </Position18>
    759893      <Position19>
    760         <Filename Value="ListObject.pas"/>
    761         <Caret Line="27" Column="1" TopLine="1"/>
     894        <Filename Value="UMainForm.pas"/>
     895        <Caret Line="188" Column="5" TopLine="168"/>
    762896      </Position19>
    763897      <Position20>
    764         <Filename Value="ListObject.pas"/>
    765         <Caret Line="19" Column="29" TopLine="1"/>
     898        <Filename Value="UMainForm.pas"/>
     899        <Caret Line="393" Column="5" TopLine="364"/>
    766900      </Position20>
    767901      <Position21>
    768         <Filename Value="ListObject.pas"/>
    769         <Caret Line="24" Column="6" TopLine="1"/>
     902        <Filename Value="../Specialized/SpecializedQueue.pas"/>
     903        <Caret Line="33" Column="32" TopLine="1"/>
    770904      </Position21>
    771905      <Position22>
    772         <Filename Value="ListObject.pas"/>
    773         <Caret Line="13" Column="24" TopLine="1"/>
     906        <Filename Value="../Specialized/SpecializedQueue.pas"/>
     907        <Caret Line="20" Column="34" TopLine="1"/>
    774908      </Position22>
    775909      <Position23>
    776         <Filename Value="ListObject.pas"/>
    777         <Caret Line="4" Column="1" TopLine="1"/>
     910        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     911        <Caret Line="22" Column="36" TopLine="1"/>
    778912      </Position23>
    779913      <Position24>
    780         <Filename Value="../Specialized/ListDouble.pas"/>
    781         <Caret Line="21" Column="12" TopLine="1"/>
     914        <Filename Value="UMainForm.pas"/>
     915        <Caret Line="469" Column="3" TopLine="439"/>
    782916      </Position24>
    783917      <Position25>
    784         <Filename Value="../Specialized/DictionaryStringString.pas"/>
    785         <Caret Line="1" Column="1" TopLine="1"/>
     918        <Filename Value="ListObject.pas"/>
     919        <Caret Line="33" Column="39" TopLine="1"/>
    786920      </Position25>
     921      <Position26>
     922        <Filename Value="../Generic/GenericObjectList.inc"/>
     923        <Caret Line="14" Column="55" TopLine="1"/>
     924      </Position26>
     925      <Position27>
     926        <Filename Value="UMainForm.pas"/>
     927        <Caret Line="89" Column="20" TopLine="70"/>
     928      </Position27>
     929      <Position28>
     930        <Filename Value="../Specialized/SpecializedDictionary.pas"/>
     931        <Caret Line="22" Column="36" TopLine="1"/>
     932      </Position28>
     933      <Position29>
     934        <Filename Value="../Generic/GenericTree.inc"/>
     935        <Caret Line="33" Column="25" TopLine="12"/>
     936      </Position29>
     937      <Position30>
     938        <Filename Value="../Specialized/SpecializedTree.pas"/>
     939        <Caret Line="82" Column="5" TopLine="47"/>
     940      </Position30>
    787941    </JumpHistory>
    788942  </ProjectOptions>
  • 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.
  • Generics/TemplateGenerics/Demo/UMainForm.pas

    r80 r84  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, ListInteger, ListString, DictionaryStringString, QueueInteger, ListChar,
    10   ListPointer, DateUtils, ListObject;
     9  ComCtrls, SpecializedList, SpecializedDictionary, SpecializedQueue,
     10  DateUtils, ListObject;
    1111
    1212type
  • Generics/TemplateGenerics/Generic/GenericDictionary.inc

    r83 r84  
    44
    55  TGPair = record
    6     Key: TDictionaryKey;
    7     Value: TDictionaryValue;
     6    Key: TGPairKey;
     7    Value: TGPairValue;
    88  end;
    99
    10   TListIndex = TDictionaryIndex;
    11   TListItem = TGPair;
    12   {$DEFINE INTERFACE}
    13   {$INCLUDE 'GenericList.inc'}
     10{$DEFINE TGListIndex := TGDictionaryIndex}
     11{$DEFINE TGListItem := TGPair}
     12{$DEFINE TGList := TGDictionaryList}
     13{$DEFINE TGListSortCompare := TDictionarySortCompare}
     14{$DEFINE TGListStringConverter := TDictionaryStringConverter}
     15{$DEFINE INTERFACE}
     16{$INCLUDE 'GenericList.inc'}
    1417
    15   // TGDictionary<TDictionaryIndex, TDictionaryKey, TDictionaryValue> = class(TGList)
     18  // TGDictionary<TGDictionaryIndex, TGPair<TGPairKey, TGPairValue>> = class(TGList)
    1619  TGDictionary = class(TGList)
    1720  private
    18     function GetKey(Index: TDictionaryIndex): TDictionaryKey;
    19     function GetValue(Key: TDictionaryKey): TDictionaryValue;
    20     procedure PutKey(Index: TDictionaryIndex; const AValue: TDictionaryKey);
    21     procedure PutValue(Key: TDictionaryKey; const AValue: TDictionaryValue);
     21    function GetKey(Index: TGDictionaryIndex): TGPairKey;
     22    function GetValue(Key: TGPairKey): TGPairValue;
     23    procedure PutKey(Index: TGDictionaryIndex; const AValue: TGPairKey);
     24    procedure PutValue(Key: TGPairKey; const AValue: TGPairValue);
    2225  public
    23     function SearchKey(Key: TDictionaryKey): TDictionaryIndex;
    24     procedure Add(Key: TDictionaryKey; Value: TDictionaryValue);
    25     property Values[Index: TDictionaryKey]: TDictionaryValue
     26    function SearchKey(Key: TGPairKey): TGDictionaryIndex;
     27    procedure Add(Key: TGPairKey; Value: TGPairValue);
     28    property Values[Index: TGPairKey]: TGPairValue
    2629      read GetValue write PutValue;
    27     property Keys[Index: TDictionaryIndex]: TDictionaryKey
     30    property Keys[Index: TGDictionaryIndex]: TGPairKey
    2831      read GetKey write PutKey;
    2932  end;
     
    3437{$IFDEF IMPLEMENTATION}
    3538
     39{$UNDEF IMPLEMENTATION}
     40{$DEFINE IMPLEMENTATION_USES}
     41{$INCLUDE '..\Generic\GenericList.inc'}
    3642
     43{$DEFINE TGListIndex := TGDictionaryIndex}
     44{$DEFINE TGListItem := TGPair}
     45{$DEFINE TGList := TGDictionaryList}
     46{$DEFINE TGListSortCompare := TDictionarySortCompare}
     47{$DEFINE TGListStringConverter := TDictionaryStringConverter}
    3748{$DEFINE IMPLEMENTATION}
    3849{$INCLUDE 'GenericList.inc'}
    3950
    40 function TGDictionary.GetKey(Index: TDictionaryIndex): TDictionaryKey;
     51function TGDictionary.GetKey(Index: TGDictionaryIndex): TGPairKey;
    4152begin
    4253  Result := Items[Index].Key;
    4354end;
    4455
    45 function TGDictionary.GetValue(Key: TDictionaryKey): TDictionaryValue;
     56function TGDictionary.GetValue(Key: TGPairKey): TGPairValue;
    4657begin
    4758  Result := Items[SearchKey(Key)].Value;
    4859end;
    4960
    50 procedure TGDictionary.PutKey(Index: TDictionaryIndex;
    51   const AValue: TDictionaryKey);
     61procedure TGDictionary.PutKey(Index: TGDictionaryIndex;
     62  const AValue: TGPairKey);
    5263var
    5364  Item: TGPair;
     
    5970end;
    6071
    61 procedure TGDictionary.PutValue(Key: TDictionaryKey;
    62   const AValue: TDictionaryValue);
     72procedure TGDictionary.PutValue(Key: TGPairKey;
     73  const AValue: TGPairValue);
    6374var
    6475  Item: TGPair;
    65   Index: TDictionaryIndex;
     76  Index: TGDictionaryIndex;
    6677begin
    6778  //Items[SearchKey(Index)].Value := AValue;
     
    7283end;
    7384
    74 function TGDictionary.SearchKey(Key: TDictionaryKey): TDictionaryIndex;
     85function TGDictionary.SearchKey(Key: TGPairKey): TGDictionaryIndex;
    7586begin
    7687  Result := 0;
     
    8394end;
    8495
    85 procedure TGDictionary.Add(Key: TDictionaryKey; Value: TDictionaryValue);
     96procedure TGDictionary.Add(Key: TGPairKey; Value: TGPairValue);
    8697var
    8798  NewPair: TGPair;
     
    92103end;
    93104
     105{$UNDEF IMPLEMENTATION}
    94106{$ENDIF}
  • Generics/TemplateGenerics/Generic/GenericList.inc

    r83 r84  
    11{$IFDEF INTERFACE}
    22
    3   PGListItem = ^TListItem;
    43  TGList = class;
    54
    6   TGListSortCompare = function(const Item1, Item2: TListItem): Integer of object;
    7   TGListStringConverter = function(Item: TListItem): string;
    8   TGListOperation = procedure(List: TGList; Item: PGListItem);
     5  TGListSortCompare = function(const Item1, Item2: TGListItem): Integer of object;
     6  TGListStringConverter = function(Item: TGListItem): string;
    97  //TGListNotification = (lnAdded, lnExtracted, lnDeleted);
    108
    11   // TGList<TListIndex, TListItem> = class
     9  // TGList<TGListIndex, TGListItem> = class
    1210  TGList = class
    1311  private
    14     FItems: array of TListItem;
    15     FCount: TListIndex;
    16     function Get(Index: TListIndex): TListItem;
    17     function GetCapacity: TListIndex;
    18     procedure SetCapacity(const AValue: TListIndex);
    19     procedure Put(Index: TListIndex; const AValue: TListItem); virtual;
    20     procedure SetCount(const AValue: TListIndex);
    21     procedure QuickSort(L, R : TListIndex; Compare: TGListSortCompare);
     12    FItems: array of TGListItem;
     13    FCount: TGListIndex;
     14    function Get(Index: TGListIndex): TGListItem;
     15    function GetCapacity: TGListIndex;
     16    procedure SetCapacity(const AValue: TGListIndex);
     17    procedure Put(Index: TGListIndex; const AValue: TGListItem); virtual;
     18    procedure SetCount(const AValue: TGListIndex);
     19    procedure QuickSort(L, R : TGListIndex; Compare: TGListSortCompare);
    2220  public
    2321    // All items
     
    2826    procedure Sort(Compare: TGListSortCompare);
    2927    function Implode(Separator: string; Converter: TGListStringConverter): string;
    30     procedure Perform(Operation: TGListOperation);
    3128    // Many items
    32     procedure MoveItems(CurIndex, NewIndex, Count: TListIndex);
    33     procedure DeleteItems(Index, Count: TListIndex);
    34     procedure Fill(Start, Count: TListIndex; Value: TListItem);
     29    procedure MoveItems(CurIndex, NewIndex, Count: TGListIndex);
     30    procedure DeleteItems(Index, Count: TGListIndex);
     31    procedure Fill(Start, Count: TGListIndex; Value: TGListItem);
    3532    // One item
    36     function Add(Item: TListItem): TListIndex;
    37     procedure Delete(Index: TListIndex); virtual;
    38     function Extract(Item: TListItem): TListItem;
    39     procedure Exchange(Index1, Index2: TListIndex);
    40     function First: TListItem;
    41     function IndexOf(Item: TListItem; Start: TListIndex = 0): TListIndex;
    42     procedure Insert(Index: TListIndex; Item: TListItem);
    43     function Last: TListItem;
    44     procedure Move(CurIndex, NewIndex: TListIndex);
    45     function Remove(Item: TListItem): TListIndex;
    46     property Items[Index: TListIndex]: TListItem read Get write Put; default;
     33    function Add(Item: TGListItem): TGListIndex;
     34    procedure Delete(Index: TGListIndex); virtual;
     35    function Extract(Item: TGListItem): TGListItem;
     36    procedure Exchange(Index1, Index2: TGListIndex);
     37    function First: TGListItem;
     38    function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex;
     39    procedure Insert(Index: TGListIndex; Item: TGListItem);
     40    function Last: TGListItem;
     41    procedure Move(CurIndex, NewIndex: TGListIndex);
     42    function Remove(Item: TGListItem): TGListIndex;
     43    property Items[Index: TGListIndex]: TGListItem read Get write Put; default;
    4744    // List
    4845    procedure AddList(List: TGList);
    4946    procedure Assign(List: TGList);
    5047    function Equals(List: TGList): Boolean;
    51     procedure InsertList(Index: TListIndex; List: TGList);
    52     function IndexOfList(List: TGList; Start: TListIndex = 0): TListIndex;
     48    procedure InsertList(Index: TGListIndex; List: TGList);
     49    function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex;
    5350    // Other
    54     property Count: TListIndex read FCount write SetCount;
    55     property Capacity: TListIndex read GetCapacity write SetCapacity;
     51    property Count: TGListIndex read FCount write SetCount;
     52    property Capacity: TGListIndex read GetCapacity write SetCapacity;
    5653    // Array
    57     procedure AddArray(Values: array of TListItem);
    58     procedure SetArray(Values: array of TListItem);
    59     procedure InsertArray(Index: TListIndex; Values: array of TListItem);
     54    procedure AddArray(Values: array of TGListItem);
     55    procedure SetArray(Values: array of TGListItem);
     56    procedure InsertArray(Index: TGListIndex; Values: array of TGListItem);
    6057  end;
    6158 
     
    6360{$ENDIF}
    6461
    65 {$IFDEF IMPLEMENTATION}
     62{$IFDEF IMPLEMENTATION_USES}
    6663
    6764uses
    6865  RtlConsts;
    6966
     67{$UNDEF IMPLEMENTATION_USES}
     68{$ENDIF}
     69
     70{$IFDEF IMPLEMENTATION}
     71
    7072{ TGList }
    7173
    72 function TGList.GetCapacity: TListIndex;
     74function TGList.GetCapacity: TGListIndex;
    7375begin
    7476  Result := Length(FItems);
    7577end;
    7678
    77 procedure TGList.SetCapacity(const AValue: TListIndex);
     79procedure TGList.SetCapacity(const AValue: TGListIndex);
    7880begin
    7981  SetLength(FItems, AValue);
    8082end;
    8183
    82 function TGList.Get(Index: TListIndex): TListItem;
     84function TGList.Get(Index: TGListIndex): TGListItem;
    8385begin
    8486  Result := FItems[Index];
    8587end;
    8688
    87 procedure TGList.Put(Index: TListIndex; const AValue: TListItem);
     89procedure TGList.Put(Index: TGListIndex; const AValue: TGListItem);
    8890begin
    8991  FItems[Index] := AValue;
    9092end;
    9193
    92 procedure TGList.SetCount(const AValue: TListIndex);
     94procedure TGList.SetCount(const AValue: TGListIndex);
    9395begin
    9496  SetLength(FItems, AValue);
     
    9698end;
    9799
    98 procedure TGList.QuickSort(L, R: TListIndex; Compare: TGListSortCompare);
    99 var
    100   I, J: TListIndex;
    101   P, Q: TListItem;
     100procedure TGList.QuickSort(L, R: TGListIndex; Compare: TGListSortCompare);
     101var
     102  I, J: TGListIndex;
     103  P, Q: TGListItem;
    102104begin
    103105 repeat
     
    139141procedure TGList.Expand;
    140142var
    141   IncSize: TListIndex;
     143  IncSize: TGListIndex;
    142144begin
    143145  if FCount = Capacity then begin
     
    158160end;
    159161
    160 function TGList.Extract(Item: TListItem): TListItem;
    161 var
    162   I: TListIndex;
     162function TGList.Extract(Item: TGListItem): TGListItem;
     163var
     164  I: TGListIndex;
    163165begin
    164166  I := IndexOf(Item);
     
    170172end;
    171173
    172 function TGList.First: TListItem;
     174function TGList.First: TGListItem;
    173175begin
    174176  if FCount = 0 then
     
    178180end;
    179181
    180 function TGList.IndexOf(Item: TListItem; Start: TListIndex): TListIndex;
     182function TGList.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex;
    181183begin
    182184  Result := Start;
    183185  while (Result < FCount) and
    184   not CompareMem(Addr(FItems[Result]), Addr(Item), SizeOf(TListItem)) do
     186  not CompareMem(Addr(FItems[Result]), Addr(Item), SizeOf(TGListItem)) do
    185187    Result := Result + 1;
    186188  if Result = FCount then Result := -1;
    187189end;
    188190
    189 procedure TGList.Insert(Index: TListIndex; Item: TListItem);
     191procedure TGList.Insert(Index: TGListIndex; Item: TGListItem);
    190192begin
    191193  if (Index < 0) or (Index > FCount ) then
     
    193195  if FCount = Capacity then Expand;
    194196  if Index < FCount then
    195     System.Move(FItems[Index], FItems[Index + 1], (FCount - Index) * SizeOf(TListItem));
     197    System.Move(FItems[Index], FItems[Index + 1], (FCount - Index) * SizeOf(TGListItem));
    196198  FItems[Index] := Item;
    197199  FCount := FCount + 1;
    198200end;
    199201
    200 procedure TGList.InsertList(Index: TListIndex; List: TGList);
    201 var
    202   I: TListIndex;
     202procedure TGList.InsertList(Index: TGListIndex; List: TGList);
     203var
     204  I: TGListIndex;
    203205begin
    204206  I := 0;
     
    209211end;
    210212
    211 function TGList.IndexOfList(List: TGList; Start: TListIndex): TListIndex;
    212 var
    213   I: TListIndex;
     213function TGList.IndexOfList(List: TGList; Start: TGListIndex): TGListIndex;
     214var
     215  I: TGListIndex;
    214216begin
    215217  if List.Count > 0 then begin
     
    218220      I := 1;
    219221      while I < List.Count do begin
    220         if not CompareMem(Addr(FItems[Result + I]), Addr(List.FItems[I]), SizeOf(TListItem)) then begin
     222        if not CompareMem(Addr(FItems[Result + I]), Addr(List.FItems[I]), SizeOf(TGListItem)) then begin
    221223          Result := -1;
    222224          Break;
     
    228230end;
    229231
    230 function TGList.Last: TListItem;
     232function TGList.Last: TGListItem;
    231233begin
    232234  if FCount = 0 then
     
    236238end;
    237239
    238 procedure TGList.Move(CurIndex, NewIndex: TListIndex);
    239 var
    240   Temp: TListItem;
     240procedure TGList.Move(CurIndex, NewIndex: TGListIndex);
     241var
     242  Temp: TGListItem;
    241243begin
    242244  if ((CurIndex < 0) or (CurIndex > Count - 1)) then
     
    246248  Temp := FItems[CurIndex];
    247249  if NewIndex > CurIndex then begin
    248     System.Move(FItems[CurIndex + 1], FItems[CurIndex], (NewIndex - CurIndex) * SizeOf(TListItem));
     250    System.Move(FItems[CurIndex + 1], FItems[CurIndex], (NewIndex - CurIndex) * SizeOf(TGListItem));
    249251  end else
    250252  if NewIndex < CurIndex then begin
    251     System.Move(FItems[NewIndex], FItems[NewIndex + 1], (CurIndex - NewIndex) * SizeOf(TListItem));
     253    System.Move(FItems[NewIndex], FItems[NewIndex + 1], (CurIndex - NewIndex) * SizeOf(TGListItem));
    252254  end;
    253255  FItems[NewIndex] := Temp;
     
    256258end;
    257259
    258 procedure TGList.MoveItems(CurIndex, NewIndex, Count: TListIndex);
     260procedure TGList.MoveItems(CurIndex, NewIndex, Count: TGListIndex);
    259261var
    260262  S: Integer;
     
    281283end;
    282284
    283 function TGList.Remove(Item: TListItem): TListIndex;
     285function TGList.Remove(Item: TGListItem): TGListIndex;
    284286begin
    285287  Result := IndexOf(Item);
     
    290292function TGList.Equals(List: TGList): Boolean;
    291293var
    292   I: TListIndex;
     294  I: TGListIndex;
    293295begin
    294296  Result := Count = List.Count;
     
    296298    I := 0;
    297299    while I < Count do begin
    298       if not CompareMem(Addr(FItems[I]), Addr(List.FItems[I]), SizeOf(TListItem)) then begin
     300      if not CompareMem(Addr(FItems[I]), Addr(List.FItems[I]), SizeOf(TGListItem)) then begin
    299301        Result := False;
    300302        Break;
     
    307309procedure TGList.Reverse;
    308310var
    309   I: TListIndex;
     311  I: TGListIndex;
    310312begin
    311313  I := 0;
     
    322324end;
    323325
    324 procedure TGList.AddArray(Values: array of TListItem);
    325 var
    326   I: TListIndex;
     326procedure TGList.AddArray(Values: array of TGListItem);
     327var
     328  I: TGListIndex;
    327329begin
    328330  I := 0;
     
    333335end;
    334336
    335 procedure TGList.SetArray(Values: array of TListItem);
    336 var
    337   I: TListIndex;
     337procedure TGList.SetArray(Values: array of TGListItem);
     338var
     339  I: TGListIndex;
    338340begin
    339341  Clear;
     
    345347end;
    346348
    347 procedure TGList.InsertArray(Index: TListIndex; Values: array of TListItem);
    348 var
    349   I: TListIndex;
     349procedure TGList.InsertArray(Index: TGListIndex; Values: array of TGListItem);
     350var
     351  I: TGListIndex;
    350352begin
    351353  I := 0;
     
    358360function TGList.Implode(Separator: string; Converter: TGListStringConverter): string;
    359361var
    360   I: TListIndex;
     362  I: TGListIndex;
    361363begin
    362364  Result := '';
     
    370372end;
    371373
    372 procedure TGList.Perform(Operation: TGListOperation);
    373 var
    374   I: TListIndex;
    375 begin
    376   I := 0;
    377   while I < Count do begin
    378     Operation(Self, @FItems[I]);
    379     I := I + 1;
    380   end;
    381 end;
    382 
    383 function TGList.Add(Item: TListItem): TListIndex;
     374function TGList.Add(Item: TGListItem): TGListIndex;
    384375begin
    385376  if FCount = Capacity then
     
    392383procedure TGList.AddList(List: TGList);
    393384var
    394   I: TListIndex;
     385  I: TGListIndex;
    395386begin
    396387  I := 0;
     
    407398end;
    408399
    409 procedure TGList.Delete(Index: TListIndex);
     400procedure TGList.Delete(Index: TGListIndex);
    410401begin
    411402  if (Index < 0) or (Index >= FCount) then
    412403    raise EListError.CreateFmt(SListIndexError, [Index]);
    413404  FCount := FCount - 1;
    414   System.Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TListItem));
     405  System.Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TGListItem));
    415406  Contract;
    416407end;
    417408
    418 procedure TGList.DeleteItems(Index, Count: TListIndex);
    419 var
    420   I: TListIndex;
     409procedure TGList.DeleteItems(Index, Count: TGListIndex);
     410var
     411  I: TGListIndex;
    421412begin
    422413  I := Index;
     
    427418end;
    428419
    429 procedure TGList.Fill(Start, Count: TListIndex; Value: TListItem);
     420procedure TGList.Fill(Start, Count: TGListIndex; Value: TGListItem);
    430421begin
    431422  while Count > 0 do begin
     
    436427end;
    437428
    438 procedure TGList.Exchange(Index1, Index2: TListIndex);
    439 var
    440   Temp: TListItem;
     429procedure TGList.Exchange(Index1, Index2: TGListIndex);
     430var
     431  Temp: TGListItem;
    441432begin
    442433  if ((Index1 >= FCount) or (Index1 < 0)) then
  • 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}
  • Generics/TemplateGenerics/Generic/GenericQueue.inc

    r83 r84  
    11{$IFDEF INTERFACE}
    22
    3   TListIndex = TQueueIndex;
    4   TListItem = TQueueItem;
    5   {$DEFINE INTERFACE}
    6   {$INCLUDE 'GenericList.inc'}
     3{$DEFINE TGListIndex := TGQueueIndex}
     4{$DEFINE TGListItem := TGQueueItem}
     5{$DEFINE TGList := TGQueueList}
     6{$DEFINE TGListSortCompare := TGQueueSortCompare}
     7{$DEFINE TGListStringConverter := TGQueueStringConverter}
     8{$DEFINE INTERFACE}
     9{$INCLUDE 'GenericList.inc'}
    710
    811  // TGQueue<TSetIndex, TSetItem> = class(TGList)
     
    1114    FList: TGList;
    1215  public
    13     procedure Enqueue(Value: TQueueItem);
    14     function Dequeue: TQueueItem;
    15     function Peek: TQueueItem;
     16    procedure Enqueue(Value: TGQueueItem);
     17    function Dequeue: TGQueueItem;
     18    function Peek: TGQueueItem;
    1619    constructor Create;
    1720    destructor Destroy; override;
     
    2225{$ENDIF}
    2326
     27{$IFDEF IMPLEMENTATION_USES}
     28
     29  {$DEFINE IMPLEMENTATION_USES}
     30  {$INCLUDE '..\Generic\GenericList.inc'}
     31
     32{$UNDEF IMPLEMENTATION_USES}
     33{$ENDIF}
     34
    2435{$IFDEF IMPLEMENTATION}
    2536
     37{$DEFINE TGListIndex := TGQueueIndex}
     38{$DEFINE TGListItem := TGQueueItem}
     39{$DEFINE TGList := TGQueueList}
     40{$DEFINE TGListSortCompare := TGQueueSortCompare}
     41{$DEFINE TGListStringConverter := TGQueueStringConverter}
    2642{$DEFINE IMPLEMENTATION}
    2743{$INCLUDE 'GenericList.inc'}
     
    2945{ TGQueue }
    3046
    31 procedure TGQueue.Enqueue(Value: TQueueItem);
     47procedure TGQueue.Enqueue(Value: TGQueueItem);
    3248begin
    3349  FList.Add(Value);
    3450end;
    3551
    36 function TGQueue.Peek: TQueueItem;
     52function TGQueue.Peek: TGQueueItem;
    3753begin
    3854  Result := FList.First;
     
    5066end;
    5167
    52 function TGQueue.Dequeue: TQueueItem;
     68function TGQueue.Dequeue: TGQueueItem;
    5369begin
    5470  Result := FList.Extract(FList.First);
    5571end;
    5672
     73{$UNDEF IMPLEMENTATION}
    5774{$ENDIF}
  • Generics/TemplateGenerics/Generic/GenericRange.inc

    r83 r84  
    4141end;
    4242
     43{$UNDEF IMPLEMENTATION}
    4344{$ENDIF}
  • 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}
  • 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}
  • Generics/TemplateGenerics/Generic/GenericTree.inc

    r83 r84  
    33  TGTreeNode = class;
    44
    5   TListIndex = TTreeIndex;
    6   TListItem = TGTreeNode;
    7   {$DEFINE INTERFACE}
    8   {$INCLUDE 'GenericList.inc'}
     5{$DEFINE TGListIndex := TGTreeIndex}
     6{$DEFINE TGListItem := TGTreeNode}
     7{$DEFINE TGList := TGTreeNodeList}
     8{$DEFINE TGListSortCompare := TGTreeSortCompare}
     9{$DEFINE TGListStringConverter := TGTreeStringConverter}
     10{$DEFINE INTERFACE}
     11{$INCLUDE 'GenericList.inc'}
    912
    10   TTreeNodeList = class(TGList)
    11   end;
    12 
    13   // TGTreeNode<TTreeIndex, TTreeItem> = class
     13  // TGTreeNode<TGTreeIndex, TGTreeItem> = class
    1414  TGTreeNode = class
    15     Childs: TTreeNodeList;
    16     Value: TTreeItem;
     15    Childs: TGTreeNodeList;
     16    Value: TGTreeItem;
    1717    procedure Clear;
    1818  end;
    1919
    20   // TGTree<TTreeIndex, TTreeItem> = class
     20  // TGTree<TGTreeIndex, TGTreeItem> = class
    2121  TGTree = class
    2222    TopItem: TGTreeNode;
     
    2727{$ENDIF}
    2828
     29{$IFDEF IMPLEMENTATION_USES}
     30
     31  {$DEFINE IMPLEMENTATION_USES}
     32  {$INCLUDE 'GenericList.inc'}
     33
     34{$UNDEF INTERFACE_USES}
     35{$ENDIF}
     36
     37
    2938{$IFDEF IMPLEMENTATION}
     39{$UNDEF IMPLEMENTATION}
    3040
     41{$DEFINE TGListIndex := TGTreeIndex}
     42{$DEFINE TGListItem := TGTreeNode}
     43{$DEFINE TGList := TGTreeNodeList}
     44{$DEFINE TGListSortCompare := TGTreeSortCompare}
     45{$DEFINE TGListStringConverter := TGTreeStringConverter}
    3146{$DEFINE IMPLEMENTATION}
    3247{$INCLUDE 'GenericList.inc'}
     
    4661end;
    4762
     63{$UNDEF IMPLEMENTATION}
    4864{$ENDIF}
  • Generics/TemplateGenerics/TemplateGenerics.lpk

    r83 r84  
    1717    </CompilerOptions>
    1818    <Version Minor="1"/>
    19     <Files Count="35">
     19    <Files Count="15">
    2020      <Item1>
    21         <Filename Value="Specialized\ListDouble.pas"/>
    22         <UnitName Value="ListDouble"/>
     21        <Filename Value="ReadMe.txt"/>
     22        <Type Value="Text"/>
    2323      </Item1>
    2424      <Item2>
    25         <Filename Value="Specialized\ListInteger.pas"/>
    26         <UnitName Value="ListInteger"/>
     25        <Filename Value="Generic\GenericDictionary.inc"/>
     26        <Type Value="Include"/>
    2727      </Item2>
    2828      <Item3>
    29         <Filename Value="Specialized\ListPointer.pas"/>
    30         <UnitName Value="ListPointer"/>
     29        <Filename Value="Generic\GenericList.inc"/>
     30        <Type Value="Include"/>
    3131      </Item3>
    3232      <Item4>
    33         <Filename Value="Specialized\ListString.pas"/>
    34         <UnitName Value="ListString"/>
     33        <Filename Value="Generic\GenericObjectList.inc"/>
     34        <Type Value="Include"/>
    3535      </Item4>
    3636      <Item5>
    37         <Filename Value="Specialized\TreeInteger.pas"/>
    38         <UnitName Value="TreeInteger"/>
     37        <Filename Value="Generic\GenericQueue.inc"/>
     38        <Type Value="Include"/>
    3939      </Item5>
    4040      <Item6>
    41         <Filename Value="Specialized\TreeObject.pas"/>
    42         <UnitName Value="TreeObject"/>
     41        <Filename Value="Generic\GenericRange.inc"/>
     42        <Type Value="Include"/>
    4343      </Item6>
    4444      <Item7>
    45         <Filename Value="Specialized\TreePointer.pas"/>
    46         <UnitName Value="TreePointer"/>
     45        <Filename Value="Generic\GenericSet.inc"/>
     46        <Type Value="Include"/>
    4747      </Item7>
    4848      <Item8>
    49         <Filename Value="Specialized\TreeString.pas"/>
    50         <UnitName Value="TreeString"/>
     49        <Filename Value="Generic\GenericStack.inc"/>
     50        <Type Value="Include"/>
    5151      </Item8>
    5252      <Item9>
    53         <Filename Value="Specialized\DictionaryStringString.pas"/>
    54         <UnitName Value="DictionaryStringString"/>
     53        <Filename Value="Generic\GenericTree.inc"/>
     54        <Type Value="Include"/>
    5555      </Item9>
    5656      <Item10>
    57         <Filename Value="Specialized\StackDouble.pas"/>
    58         <UnitName Value="StackDouble"/>
     57        <Filename Value="Specialized\SpecializedList.pas"/>
     58        <UnitName Value="SpecializedList"/>
    5959      </Item10>
    6060      <Item11>
    61         <Filename Value="Specialized\StackInteger.pas"/>
    62         <UnitName Value="StackInteger"/>
     61        <Filename Value="Specialized\SpecializedDictionary.pas"/>
     62        <UnitName Value="SpecializedDictionary"/>
    6363      </Item11>
    6464      <Item12>
    65         <Filename Value="Specialized\StackObject.pas"/>
    66         <UnitName Value="StackObject"/>
     65        <Filename Value="Specialized\SpecializedStack.pas"/>
     66        <UnitName Value="SpecializedStack"/>
    6767      </Item12>
    6868      <Item13>
    69         <Filename Value="Specialized\StackPointer.pas"/>
    70         <UnitName Value="StackPointer"/>
     69        <Filename Value="Specialized\SpecializedTree.pas"/>
     70        <UnitName Value="SpecializedTree"/>
    7171      </Item13>
    7272      <Item14>
    73         <Filename Value="Specialized\StackString.pas"/>
    74         <UnitName Value="StackString"/>
     73        <Filename Value="Specialized\SpecializedQueue.pas"/>
     74        <UnitName Value="SpecializedQueue"/>
    7575      </Item14>
    7676      <Item15>
    77         <Filename Value="Specialized\QueueDouble.pas"/>
    78         <UnitName Value="QueueDouble"/>
     77        <Filename Value="Specialized\SpecializedSet.pas"/>
     78        <UnitName Value="SpecializedSet"/>
    7979      </Item15>
    80       <Item16>
    81         <Filename Value="Specialized\QueueInteger.pas"/>
    82         <UnitName Value="QueueInteger"/>
    83       </Item16>
    84       <Item17>
    85         <Filename Value="Specialized\QueueObject.pas"/>
    86         <UnitName Value="QueueObject"/>
    87       </Item17>
    88       <Item18>
    89         <Filename Value="Specialized\QueuePointer.pas"/>
    90         <UnitName Value="QueuePointer"/>
    91       </Item18>
    92       <Item19>
    93         <Filename Value="Specialized\QueueString.pas"/>
    94         <UnitName Value="QueueString"/>
    95       </Item19>
    96       <Item20>
    97         <Filename Value="Specialized\ListChar.pas"/>
    98         <UnitName Value="ListChar"/>
    99       </Item20>
    100       <Item21>
    101         <Filename Value="ReadMe.txt"/>
    102         <Type Value="Text"/>
    103       </Item21>
    104       <Item22>
    105         <Filename Value="Specialized\ListVariant.pas"/>
    106         <UnitName Value="ListVariant"/>
    107       </Item22>
    108       <Item23>
    109         <Filename Value="Specialized\SetInteger.pas"/>
    110         <UnitName Value="SetInteger"/>
    111       </Item23>
    112       <Item24>
    113         <Filename Value="Specialized\SetString.pas"/>
    114         <UnitName Value="SetString"/>
    115       </Item24>
    116       <Item25>
    117         <Filename Value="Specialized\SetChar.pas"/>
    118         <UnitName Value="SetChar"/>
    119       </Item25>
    120       <Item26>
    121         <Filename Value="Specialized\RangeDateTime.pas"/>
    122         <UnitName Value="RangeDateTime"/>
    123       </Item26>
    124       <Item27>
    125         <Filename Value="Specialized\ListByte.pas"/>
    126         <UnitName Value="ListByte"/>
    127       </Item27>
    128       <Item28>
    129         <Filename Value="Generic\GenericDictionary.inc"/>
    130         <Type Value="Include"/>
    131       </Item28>
    132       <Item29>
    133         <Filename Value="Generic\GenericList.inc"/>
    134         <Type Value="Include"/>
    135       </Item29>
    136       <Item30>
    137         <Filename Value="Generic\GenericObjectList.inc"/>
    138         <Type Value="Include"/>
    139       </Item30>
    140       <Item31>
    141         <Filename Value="Generic\GenericQueue.inc"/>
    142         <Type Value="Include"/>
    143       </Item31>
    144       <Item32>
    145         <Filename Value="Generic\GenericRange.inc"/>
    146         <Type Value="Include"/>
    147       </Item32>
    148       <Item33>
    149         <Filename Value="Generic\GenericSet.inc"/>
    150         <Type Value="Include"/>
    151       </Item33>
    152       <Item34>
    153         <Filename Value="Generic\GenericStack.inc"/>
    154         <Type Value="Include"/>
    155       </Item34>
    156       <Item35>
    157         <Filename Value="Generic\GenericTree.inc"/>
    158         <Type Value="Include"/>
    159       </Item35>
    16080    </Files>
    16181    <Type Value="RunAndDesignTime"/>
  • Generics/TemplateGenerics/TemplateGenerics.pas

    r82 r84  
    88
    99uses
    10     ListDouble, ListInteger, ListPointer, ListString, TreeInteger, TreeObject,
    11   TreePointer, TreeString, DictionaryStringString, StackDouble, StackInteger,
    12   StackObject, StackPointer, StackString, QueueDouble, QueueInteger,
    13   QueueObject, QueuePointer, QueueString, ListChar, ListVariant, SetInteger,
    14   SetString, SetChar, RangeDateTime, ListByte, LazarusPackageIntf;
     10    SpecializedList, SpecializedDictionary, SpecializedStack, SpecializedTree,
     11  SpecializedQueue, SpecializedSet, LazarusPackageIntf;
    1512
    1613implementation
Note: See TracChangeset for help on using the changeset viewer.