Ignore:
Timestamp:
Feb 8, 2012, 1:04:21 PM (12 years ago)
Author:
chronos
Message:
  • Modified: TListChar in unit SpecializedList replaced by more general TGString in GenericString.
  • Added: TGBitmap example implementation.
  • Modified: TGList splitted to TGAbstractList and TGList as memory implementation.
  • Modified: TGMatrix splitted to TGAbstractMatrix and TGMatrix as memory implementation.
Location:
Generics/NativeGenerics
Files:
2 added
1 deleted
6 edited

Legend:

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

    r323 r324  
    3838      </Item2>
    3939    </RequiredPackages>
    40     <Units Count="59">
     40    <Units Count="69">
    4141      <Unit0>
    4242        <Filename Value="Demo.lpr"/>
    4343        <IsPartOfProject Value="True"/>
    4444        <UnitName Value="Demo"/>
    45         <EditorIndex Value="9"/>
     45        <EditorIndex Value="17"/>
    4646        <WindowIndex Value="0"/>
    4747        <TopLine Value="1"/>
     
    5757        <ResourceBaseClass Value="Form"/>
    5858        <UnitName Value="UMainForm"/>
    59         <IsVisibleTab Value="True"/>
    6059        <EditorIndex Value="0"/>
    6160        <WindowIndex Value="0"/>
    62         <TopLine Value="178"/>
    63         <CursorPos X="15" Y="191"/>
     61        <TopLine Value="166"/>
     62        <CursorPos X="1" Y="179"/>
    6463        <UsageCount Value="233"/>
    6564        <Bookmarks Count="1">
    66           <Item0 X="65" Y="276" ID="2"/>
     65          <Item0 X="65" Y="275" ID="2"/>
    6766        </Bookmarks>
    6867        <Loaded Value="True"/>
     
    440439        <Filename Value="../Units/GenericList.pas"/>
    441440        <UnitName Value="GenericList"/>
    442         <EditorIndex Value="3"/>
    443         <WindowIndex Value="0"/>
    444         <TopLine Value="516"/>
    445         <CursorPos X="1" Y="528"/>
    446         <UsageCount Value="37"/>
     441        <EditorIndex Value="11"/>
     442        <WindowIndex Value="0"/>
     443        <TopLine Value="7"/>
     444        <CursorPos X="3" Y="8"/>
     445        <UsageCount Value="40"/>
    447446        <Loaded Value="True"/>
    448447      </Unit46>
     
    450449        <Filename Value="../Units/GenericMatrix.pas"/>
    451450        <UnitName Value="GenericMatrix"/>
    452         <EditorIndex Value="8"/>
    453         <WindowIndex Value="0"/>
    454         <TopLine Value="77"/>
    455         <CursorPos X="1" Y="85"/>
    456         <UsageCount Value="15"/>
     451        <IsVisibleTab Value="True"/>
     452        <EditorIndex Value="16"/>
     453        <WindowIndex Value="0"/>
     454        <TopLine Value="92"/>
     455        <CursorPos X="5" Y="106"/>
     456        <UsageCount Value="18"/>
    457457        <Loaded Value="True"/>
    458458      </Unit47>
     
    460460        <Filename Value="../Units/GenericStream.pas"/>
    461461        <UnitName Value="GenericStream"/>
    462         <EditorIndex Value="1"/>
    463         <WindowIndex Value="0"/>
    464         <TopLine Value="102"/>
    465         <CursorPos X="20" Y="117"/>
    466         <UsageCount Value="15"/>
     462        <EditorIndex Value="9"/>
     463        <WindowIndex Value="0"/>
     464        <TopLine Value="34"/>
     465        <CursorPos X="18" Y="48"/>
     466        <UsageCount Value="18"/>
    467467        <Loaded Value="True"/>
    468468      </Unit48>
     
    478478        <Filename Value="../Units/GenericDictionary.pas"/>
    479479        <UnitName Value="GenericDictionary"/>
    480         <EditorIndex Value="7"/>
     480        <EditorIndex Value="15"/>
    481481        <WindowIndex Value="0"/>
    482482        <TopLine Value="1"/>
    483483        <CursorPos X="1" Y="1"/>
    484         <UsageCount Value="16"/>
     484        <UsageCount Value="19"/>
    485485        <Loaded Value="True"/>
    486486      </Unit50>
    487487      <Unit51>
    488488        <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/objpas/sysutils/sysunih.inc"/>
    489         <EditorIndex Value="6"/>
     489        <EditorIndex Value="14"/>
    490490        <WindowIndex Value="0"/>
    491491        <TopLine Value="9"/>
    492492        <CursorPos X="10" Y="22"/>
    493         <UsageCount Value="16"/>
     493        <UsageCount Value="19"/>
    494494        <Loaded Value="True"/>
    495495        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    498498        <Filename Value="../Units/SpecializedList.pas"/>
    499499        <UnitName Value="SpecializedList"/>
    500         <EditorIndex Value="10"/>
    501         <WindowIndex Value="0"/>
    502         <TopLine Value="1"/>
    503         <CursorPos X="23" Y="11"/>
    504         <UsageCount Value="16"/>
     500        <EditorIndex Value="18"/>
     501        <WindowIndex Value="0"/>
     502        <TopLine Value="45"/>
     503        <CursorPos X="1" Y="68"/>
     504        <UsageCount Value="19"/>
    505505        <Loaded Value="True"/>
    506506      </Unit52>
    507507      <Unit53>
    508508        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/classesh.inc"/>
    509         <EditorIndex Value="2"/>
     509        <EditorIndex Value="10"/>
    510510        <WindowIndex Value="0"/>
    511511        <TopLine Value="257"/>
    512512        <CursorPos X="3" Y="270"/>
    513         <UsageCount Value="13"/>
     513        <UsageCount Value="16"/>
    514514        <Loaded Value="True"/>
    515515      </Unit53>
     
    533533        <Filename Value="../Units/GenericRange.pas"/>
    534534        <UnitName Value="GenericRange"/>
    535         <EditorIndex Value="4"/>
     535        <EditorIndex Value="12"/>
    536536        <WindowIndex Value="0"/>
    537537        <TopLine Value="4"/>
    538538        <CursorPos X="33" Y="8"/>
    539         <UsageCount Value="16"/>
     539        <UsageCount Value="19"/>
    540540        <Loaded Value="True"/>
    541541      </Unit56>
     
    550550        <Filename Value="../Units/GenericTree.pas"/>
    551551        <UnitName Value="GenericTree"/>
     552        <EditorIndex Value="13"/>
     553        <WindowIndex Value="0"/>
     554        <TopLine Value="1"/>
     555        <CursorPos X="1" Y="1"/>
     556        <UsageCount Value="19"/>
     557        <Loaded Value="True"/>
     558      </Unit58>
     559      <Unit59>
     560        <Filename Value="../Units/GenericString.pas"/>
     561        <UnitName Value="GenericString"/>
     562        <EditorIndex Value="19"/>
     563        <WindowIndex Value="0"/>
     564        <TopLine Value="35"/>
     565        <CursorPos X="23" Y="40"/>
     566        <UsageCount Value="12"/>
     567        <Loaded Value="True"/>
     568      </Unit59>
     569      <Unit60>
     570        <Filename Value="../Units/GenericBitmap.pas"/>
     571        <UnitName Value="GenericBitmap"/>
     572        <EditorIndex Value="20"/>
     573        <WindowIndex Value="0"/>
     574        <TopLine Value="22"/>
     575        <CursorPos X="18" Y="46"/>
     576        <UsageCount Value="11"/>
     577        <Loaded Value="True"/>
     578      </Unit60>
     579      <Unit61>
     580        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/>
     581        <UnitName Value="Graphics"/>
     582        <EditorIndex Value="1"/>
     583        <WindowIndex Value="0"/>
     584        <TopLine Value="1151"/>
     585        <CursorPos X="22" Y="1165"/>
     586        <UsageCount Value="11"/>
     587        <Loaded Value="True"/>
     588      </Unit61>
     589      <Unit62>
     590        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/include/rasterimage.inc"/>
     591        <EditorIndex Value="8"/>
     592        <WindowIndex Value="0"/>
     593        <TopLine Value="310"/>
     594        <CursorPos X="22" Y="314"/>
     595        <UsageCount Value="11"/>
     596        <Loaded Value="True"/>
     597      </Unit62>
     598      <Unit63>
     599        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/include/bitmapcanvas.inc"/>
     600        <EditorIndex Value="7"/>
     601        <WindowIndex Value="0"/>
     602        <TopLine Value="53"/>
     603        <CursorPos X="3" Y="46"/>
     604        <UsageCount Value="11"/>
     605        <Loaded Value="True"/>
     606      </Unit63>
     607      <Unit64>
     608        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/packages/fcl-image/src/fpcanvas.pp"/>
     609        <UnitName Value="FPCanvas"/>
     610        <EditorIndex Value="4"/>
     611        <WindowIndex Value="0"/>
     612        <TopLine Value="347"/>
     613        <CursorPos X="15" Y="360"/>
     614        <UsageCount Value="11"/>
     615        <Loaded Value="True"/>
     616      </Unit64>
     617      <Unit65>
     618        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/packages/fcl-image/src/fpcanvas.inc"/>
     619        <EditorIndex Value="6"/>
     620        <WindowIndex Value="0"/>
     621        <TopLine Value="308"/>
     622        <CursorPos X="3" Y="310"/>
     623        <UsageCount Value="11"/>
     624        <Loaded Value="True"/>
     625      </Unit65>
     626      <Unit66>
     627        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/packages/fcl-image/src/fpcdrawh.inc"/>
    552628        <EditorIndex Value="5"/>
    553629        <WindowIndex Value="0"/>
    554         <TopLine Value="1"/>
    555         <CursorPos X="33" Y="8"/>
    556         <UsageCount Value="16"/>
    557         <Loaded Value="True"/>
    558       </Unit58>
     630        <TopLine Value="54"/>
     631        <CursorPos X="3" Y="63"/>
     632        <UsageCount Value="11"/>
     633        <Loaded Value="True"/>
     634      </Unit66>
     635      <Unit67>
     636        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/include/canvas.inc"/>
     637        <EditorIndex Value="2"/>
     638        <WindowIndex Value="0"/>
     639        <TopLine Value="147"/>
     640        <CursorPos X="3" Y="152"/>
     641        <UsageCount Value="11"/>
     642        <Loaded Value="True"/>
     643      </Unit67>
     644      <Unit68>
     645        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/interfacebase.pp"/>
     646        <UnitName Value="InterfaceBase"/>
     647        <EditorIndex Value="3"/>
     648        <WindowIndex Value="0"/>
     649        <TopLine Value="153"/>
     650        <CursorPos X="15" Y="166"/>
     651        <UsageCount Value="11"/>
     652        <Loaded Value="True"/>
     653      </Unit68>
    559654    </Units>
    560655    <JumpHistory Count="30" HistoryIndex="29">
    561656      <Position1>
    562         <Filename Value="UMainForm.pas"/>
    563         <Caret Line="443" Column="1" TopLine="429"/>
     657        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/>
     658        <Caret Line="2342" Column="15" TopLine="2329"/>
    564659      </Position1>
    565660      <Position2>
    566         <Filename Value="UMainForm.pas"/>
    567         <Caret Line="442" Column="3" TopLine="429"/>
     661        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/>
     662        <Caret Line="1008" Column="3" TopLine="995"/>
    568663      </Position2>
    569664      <Position3>
    570         <Filename Value="UMainForm.pas"/>
    571         <Caret Line="656" Column="20" TopLine="643"/>
     665        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/>
     666        <Caret Line="1182" Column="17" TopLine="1169"/>
    572667      </Position3>
    573668      <Position4>
    574         <Filename Value="UMainForm.pas"/>
    575         <Caret Line="189" Column="3" TopLine="182"/>
     669        <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/lcl/graphics.pp"/>
     670        <Caret Line="1176" Column="67" TopLine="1169"/>
    576671      </Position4>
    577672      <Position5>
    578         <Filename Value="../Units/GenericStream.pas"/>
    579         <Caret Line="43" Column="15" TopLine="30"/>
     673        <Filename Value="../Units/GenericMatrix.pas"/>
     674        <Caret Line="35" Column="14" TopLine="73"/>
    580675      </Position5>
    581676      <Position6>
    582         <Filename Value="UMainForm.pas"/>
    583         <Caret Line="191" Column="1" TopLine="182"/>
     677        <Filename Value="../Units/GenericMatrix.pas"/>
     678        <Caret Line="28" Column="51" TopLine="17"/>
    584679      </Position6>
    585680      <Position7>
    586         <Filename Value="UMainForm.pas"/>
    587         <Caret Line="192" Column="1" TopLine="182"/>
     681        <Filename Value="../Units/GenericMatrix.pas"/>
     682        <Caret Line="13" Column="6" TopLine="18"/>
    588683      </Position7>
    589684      <Position8>
    590         <Filename Value="UMainForm.pas"/>
    591         <Caret Line="193" Column="1" TopLine="182"/>
     685        <Filename Value="../Units/GenericMatrix.pas"/>
     686        <Caret Line="30" Column="43" TopLine="9"/>
    592687      </Position8>
    593688      <Position9>
    594         <Filename Value="UMainForm.pas"/>
    595         <Caret Line="194" Column="1" TopLine="182"/>
     689        <Filename Value="../Units/GenericMatrix.pas"/>
     690        <Caret Line="34" Column="36" TopLine="21"/>
    596691      </Position9>
    597692      <Position10>
    598         <Filename Value="UMainForm.pas"/>
    599         <Caret Line="195" Column="1" TopLine="182"/>
     693        <Filename Value="../Units/GenericMatrix.pas"/>
     694        <Caret Line="30" Column="45" TopLine="22"/>
    600695      </Position10>
    601696      <Position11>
    602697        <Filename Value="UMainForm.pas"/>
    603         <Caret Line="196" Column="1" TopLine="182"/>
     698        <Caret Line="47" Column="1" TopLine="34"/>
    604699      </Position11>
    605700      <Position12>
    606         <Filename Value="UMainForm.pas"/>
    607         <Caret Line="197" Column="1" TopLine="182"/>
     701        <Filename Value="../Units/GenericMatrix.pas"/>
     702        <Caret Line="57" Column="21" TopLine="44"/>
    608703      </Position12>
    609704      <Position13>
    610         <Filename Value="UMainForm.pas"/>
    611         <Caret Line="198" Column="1" TopLine="182"/>
     705        <Filename Value="../Units/GenericMatrix.pas"/>
     706        <Caret Line="81" Column="1" TopLine="78"/>
    612707      </Position13>
    613708      <Position14>
    614         <Filename Value="UMainForm.pas"/>
    615         <Caret Line="199" Column="1" TopLine="182"/>
     709        <Filename Value="../Units/GenericMatrix.pas"/>
     710        <Caret Line="55" Column="56" TopLine="30"/>
    616711      </Position14>
    617712      <Position15>
    618         <Filename Value="UMainForm.pas"/>
    619         <Caret Line="200" Column="1" TopLine="182"/>
     713        <Filename Value="../Units/GenericMatrix.pas"/>
     714        <Caret Line="98" Column="1" TopLine="75"/>
    620715      </Position15>
    621716      <Position16>
    622         <Filename Value="UMainForm.pas"/>
    623         <Caret Line="201" Column="1" TopLine="182"/>
     717        <Filename Value="../Units/GenericMatrix.pas"/>
     718        <Caret Line="59" Column="40" TopLine="36"/>
    624719      </Position16>
    625720      <Position17>
    626         <Filename Value="UMainForm.pas"/>
    627         <Caret Line="202" Column="1" TopLine="191"/>
     721        <Filename Value="../Units/GenericMatrix.pas"/>
     722        <Caret Line="48" Column="39" TopLine="35"/>
    628723      </Position17>
    629724      <Position18>
    630         <Filename Value="UMainForm.pas"/>
    631         <Caret Line="203" Column="1" TopLine="191"/>
     725        <Filename Value="../Units/GenericMatrix.pas"/>
     726        <Caret Line="67" Column="1" TopLine="46"/>
    632727      </Position18>
    633728      <Position19>
    634         <Filename Value="UMainForm.pas"/>
    635         <Caret Line="204" Column="1" TopLine="191"/>
     729        <Filename Value="../Units/GenericMatrix.pas"/>
     730        <Caret Line="104" Column="53" TopLine="91"/>
    636731      </Position19>
    637732      <Position20>
    638         <Filename Value="UMainForm.pas"/>
    639         <Caret Line="205" Column="1" TopLine="191"/>
     733        <Filename Value="../Units/GenericMatrix.pas"/>
     734        <Caret Line="181" Column="26" TopLine="168"/>
    640735      </Position20>
    641736      <Position21>
    642         <Filename Value="../Units/GenericStream.pas"/>
    643         <Caret Line="11" Column="19" TopLine="1"/>
     737        <Filename Value="../Units/GenericMatrix.pas"/>
     738        <Caret Line="53" Column="80" TopLine="40"/>
    644739      </Position21>
    645740      <Position22>
    646         <Filename Value="../Units/GenericStream.pas"/>
    647         <Caret Line="23" Column="32" TopLine="10"/>
     741        <Filename Value="../Units/GenericMatrix.pas"/>
     742        <Caret Line="57" Column="14" TopLine="44"/>
    648743      </Position22>
    649744      <Position23>
    650         <Filename Value="../Units/GenericStream.pas"/>
    651         <Caret Line="38" Column="43" TopLine="25"/>
     745        <Filename Value="../Units/GenericMatrix.pas"/>
     746        <Caret Line="50" Column="39" TopLine="37"/>
    652747      </Position23>
    653748      <Position24>
    654         <Filename Value="../Units/GenericStream.pas"/>
    655         <Caret Line="43" Column="40" TopLine="30"/>
     749        <Filename Value="../Units/GenericMatrix.pas"/>
     750        <Caret Line="57" Column="14" TopLine="44"/>
    656751      </Position24>
    657752      <Position25>
    658         <Filename Value="../Units/GenericStream.pas"/>
    659         <Caret Line="64" Column="52" TopLine="51"/>
     753        <Filename Value="../Units/GenericMatrix.pas"/>
     754        <Caret Line="49" Column="3" TopLine="37"/>
    660755      </Position25>
    661756      <Position26>
    662         <Filename Value="../Units/GenericStream.pas"/>
    663         <Caret Line="105" Column="23" TopLine="90"/>
     757        <Filename Value="../Units/GenericMatrix.pas"/>
     758        <Caret Line="54" Column="35" TopLine="41"/>
    664759      </Position26>
    665760      <Position27>
    666         <Filename Value="../Units/GenericStream.pas"/>
    667         <Caret Line="38" Column="11" TopLine="25"/>
     761        <Filename Value="../Units/GenericMatrix.pas"/>
     762        <Caret Line="49" Column="1" TopLine="41"/>
    668763      </Position27>
    669764      <Position28>
    670         <Filename Value="../Units/GenericStream.pas"/>
    671         <Caret Line="199" Column="15" TopLine="174"/>
     765        <Filename Value="../Units/GenericMatrix.pas"/>
     766        <Caret Line="56" Column="1" TopLine="44"/>
    672767      </Position28>
    673768      <Position29>
    674         <Filename Value="UMainForm.pas"/>
    675         <Caret Line="744" Column="81" TopLine="1"/>
     769        <Filename Value="../Units/GenericMatrix.pas"/>
     770        <Caret Line="639" Column="28" TopLine="628"/>
    676771      </Position29>
    677772      <Position30>
    678         <Filename Value="UMainForm.pas"/>
    679         <Caret Line="184" Column="13" TopLine="171"/>
     773        <Filename Value="../Units/GenericMatrix.pas"/>
     774        <Caret Line="107" Column="18" TopLine="91"/>
    680775      </Position30>
    681776    </JumpHistory>
     
    732827        <WatchKind Value="wpkWrite"/>
    733828        <Source Value="UMainForm.pas"/>
    734         <Line Value="205"/>
     829        <Line Value="204"/>
    735830      </Item1>
    736831    </BreakPoints>
  • Generics/NativeGenerics/Demo/UMainForm.pas

    r323 r324  
    4545  public
    4646    MeasureDuration: TDateTime;
    47     Bitmap: TBitmap;
    4847    procedure UpdateButtonState(Enabled: Boolean);
    4948    procedure WriteOutput(Text1: string = ''; Text2: string = '');
  • Generics/NativeGenerics/NativeGenerics.lpk

    r321 r324  
    2828    <License Value="GNU/GPL"/>
    2929    <Version Minor="1"/>
    30     <Files Count="11">
     30    <Files Count="12">
    3131      <Item1>
    3232        <Filename Value="ReadMe.txt"/>
     
    6666      </Item9>
    6767      <Item10>
    68         <Filename Value="Units\SpecializedList.pas"/>
    69         <UnitName Value="SpecializedList"/>
     68        <Filename Value="Units\GenericMatrix.pas"/>
     69        <UnitName Value="GenericMatrix"/>
    7070      </Item10>
    7171      <Item11>
    72         <Filename Value="Units\GenericMatrix.pas"/>
    73         <UnitName Value="GenericMatrix"/>
     72        <Filename Value="Units\GenericString.pas"/>
     73        <UnitName Value="GenericString"/>
    7474      </Item11>
     75      <Item12>
     76        <Filename Value="Units\GenericBitmap.pas"/>
     77        <UnitName Value="GenericBitmap"/>
     78      </Item12>
    7579    </Files>
    7680    <Type Value="RunAndDesignTime"/>
  • Generics/NativeGenerics/NativeGenerics.pas

    r321 r324  
    99uses
    1010  GenericList, GenericTree, GenericDictionary, GenericQueue, GenericRange,
    11   GenericSet, GenericStack, GenericStream, SpecializedList, GenericMatrix,
    12   LazarusPackageIntf;
     11  GenericSet, GenericStack, GenericStream, GenericMatrix, GenericString,
     12  GenericBitmap, LazarusPackageIntf;
    1313
    1414implementation
  • Generics/NativeGenerics/Units/GenericList.pas

    r322 r324  
    1010type
    1111
    12   { TGList }
    13 
    14   TGList<TItem> = class
     12  { TGAbstractList }
     13
     14  TGAbstractList<TItem> = class
    1515  public
    1616  type
     
    2121    TItemArray = array of TItem;
    2222  private
     23    function GetLast: TItem; virtual; abstract;
     24    procedure SetLast(AValue: TItem); virtual; abstract;
     25    function GetFirst: TItem; virtual; abstract;
     26    procedure SetFirst(AValue: TItem); virtual; abstract;
     27    function GetCount: TIndex; virtual; abstract;
     28    procedure SetCount(const AValue: TIndex); virtual; abstract;
     29    procedure SetCapacity(const AValue: TIndex); virtual; abstract;
     30    function GetCapacity: TIndex; virtual; abstract;
     31    function Get(Index: TIndex): TItem; virtual; abstract;
     32    procedure Put(Index: TIndex; const AValue: TItem); virtual; abstract;
     33  public
     34    constructor Create; virtual;
     35    property Count: TIndex read GetCount write SetCount;
     36    property Capacity: TIndex read GetCapacity write SetCapacity;
     37    property Items[Index: TIndex]: TItem read Get write Put; default;
     38    property First: TItem read GetFirst write SetFirst;
     39    property Last: TItem read GetLast write SetLast;
     40  end;
     41
     42  { TGList }
     43
     44  TGList<TItem> = class(TGAbstractList<TItem>)
     45  private
    2346    FCount: TIndex;
    2447    FItems: array of TItem;
    25     function Get(Index: TIndex): TItem;
    26     function GetCapacity: TIndex;
    27     function GetFirst: TItem;
    28     function GetLast: TItem;
    29     procedure SetCapacity(const AValue: TIndex);
     48    function Get(Index: TIndex): TItem; override;
     49    function GetCapacity: TIndex; override;
     50    function GetFirst: TItem; override;
     51    function GetLast: TItem; override;
     52    function GetCount: TIndex; override;
     53    procedure SetCapacity(const AValue: TIndex); override;
    3054    procedure SetCapacityOptimized(const NewCapacity: TIndex);
    31     procedure SetCount(const AValue: TIndex);
    32     procedure SetFirst(AValue: TItem);
    33     procedure SetLast(AValue: TItem);
    34     procedure Put(Index: TIndex; const AValue: TItem); virtual;
     55    procedure SetCount(const AValue: TIndex); override;
     56    procedure SetFirst(AValue: TItem); override;
     57    procedure SetLast(AValue: TItem); override;
     58    procedure Put(Index: TIndex; const AValue: TItem); override;
    3559    procedure QuickSort(L, R : TIndex; Compare: TSortCompare);
    3660  public
     
    4771    procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1);
    4872    function Extract(Item: TItem): TItem;
    49     property First: TItem read GetFirst write SetFirst;
    5073    procedure Fill(Start, Count: TIndex; Value: TItem);
    5174    function GetArray(Index, ACount: TIndex): TItemArray;
     
    6891    procedure Sort(Compare: TSortCompare);
    6992    procedure SetArray(Values: array of TItem);
    70     property Count: TIndex read FCount write SetCount;
    71     property Capacity: TIndex read GetCapacity write SetCapacity;
    72     property Items[Index: TIndex]: TItem read Get write Put; default;
    73     property Last: TItem read GetLast write SetLast;
    7493  end;
    7594
     
    82101    procedure Clear; override;
    83102    procedure Assign(Source: TGList<TItem>); override;
    84     constructor Create;
     103    constructor Create; override;
    85104    destructor Destroy; override;
    86105  end;
     
    286305end;
    287306
     307function TGList<TItem>.GetCount: TIndex;
     308begin
     309  Result := FCount;
     310end;
     311
    288312procedure TGList<TItem>.SetLast(AValue: TItem);
    289313begin
     
    663687end;
    664688
     689{ TGAbstractList<TItem> }
     690
     691constructor TGAbstractList<TItem>.Create;
     692begin
     693end;
     694
    665695end.
  • Generics/NativeGenerics/Units/GenericMatrix.pas

    r321 r324  
    99
    1010type
    11   TGMatrix<TItem> = class
     11  TGAbstractMatrix<TItem> = class
    1212  public
    1313    type
     
    2424        Y: TIndexY;
    2525      end;
     26  protected
     27    function GetItemXY(X: TIndexX; Y: TIndexY): TItem; virtual; abstract;
     28    procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); virtual; abstract;
     29    function GetItem(Index: TIndex): TItem; virtual; abstract;
     30    function GetCapacity: TIndex; virtual; abstract;
     31    function GetLast: TItem; virtual; abstract;
     32    function GetFirst: TItem; virtual; abstract;
     33    function GetCount: TIndex; virtual; abstract;
     34    procedure SetLast(AValue: TItem); virtual; abstract;
     35    procedure SetFirst(AValue: TItem); virtual; abstract;
     36    procedure PutItem(Index: TIndex; const AValue: TItem);  virtual; abstract;
     37    procedure SetCount(const AValue: TIndex); virtual; abstract;
     38  public
     39    property Count: TIndex read GetCount write SetCount;
     40    property ItemsXY[X: TIndexX; Y: TIndexY]: TItem
     41      read GetItemXY write PutItemXY; default;
     42    property Items[Index: TIndex]: TItem
     43      read GetItem write PutItem;
     44    property Last: TItem read GetLast write SetLast;
     45  end;
     46
     47  TGMatrix<TItem> = class(TGAbstractMatrix<TItem>)
     48  public
     49    type
     50      TIndex = TGAbstractMatrix<TItem>.TIndex;
     51  protected
     52    function GetItemXY(X: TIndexX; Y: TIndexY): TItem; override;
     53    procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); override;
     54    function GetItem(Index: TIndex): TItem; override;
     55    function GetLast: TItem; override;
     56    function GetFirst: TItem; override;
     57    function GetCount: TIndex; override;
     58    procedure SetLast(AValue: TItem); override;
     59    procedure SetFirst(AValue: TItem); override;
     60    procedure PutItem(Index: TIndex; const AValue: TItem);  override;
     61    procedure SetCount(const AValue: TIndex); override;
    2662  private
    2763    FItems: array of array of TItem;
    2864    FCount: TIndex;
    29     function GetItemXY(X: TIndexX; Y: TIndexY): TItem;
    30     function GetItem(Index: TIndex): TItem;
    31     function GetCapacity: TIndex;
    32     function GetLast: TItem;
    33     function GetFirst: TItem;
     65    function GetCapacity: TIndex; override;
    3466    procedure SetCapacity(const AValue: TIndex);
    35     procedure SetLast(AValue: TItem);
    36     procedure SetFirst(AValue: TItem);
    37     procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); virtual;
    38     procedure PutItem(Index: TIndex; const AValue: TItem); virtual;
    39     procedure SetCount(const AValue: TIndex);
    4067  public
    4168    function Add(Item: TItem): TIndex;
     
    7299    procedure Sort(Compare: TSortCompare);
    73100    procedure SetArray(Values: array of TItem);
    74     property Count: TIndex read FCount write SetCount;
    75101    property Capacity: TIndex read GetCapacity write SetCapacity;
    76     property ItemsXY[X: TIndexX; Y: TIndexY]: TItem
    77       read GetItemXY write PutItemXY; default;
    78     property Items[Index: TIndex]: TItem
    79       read GetItem write PutItem;
    80     property Last: TItem read GetLast write SetLast;
     102  end;
     103
     104  TGRawMatrix<TItem> = class(TGAbstractMatrix<TItem>)
     105  public
     106    type
     107      TIndex = TGAbstractMatrix<TItem>.TIndex;
     108  private
     109    FData: Pointer;
     110    FCount: TIndex;
    81111  end;
    82112
     
    620650end;
    621651
     652function TGMatrix<TItem>.GetCount: TIndex;
     653begin
     654  Result := FCount;
     655end;
     656
     657
    622658end.
Note: See TracChangeset for help on using the changeset viewer.