Changeset 379 for Generics


Ignore:
Timestamp:
Jun 21, 2012, 10:39:13 AM (12 years ago)
Author:
chronos
Message:
Location:
Generics
Files:
5 edited

Legend:

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

    r327 r379  
    5353        <IsPartOfProject Value="True"/>
    5454        <ComponentName Value="MainForm"/>
     55        <HasResources Value="True"/>
    5556        <ResourceBaseClass Value="Form"/>
    5657        <UnitName Value="UMainForm"/>
    57         <IsVisibleTab Value="True"/>
    5858        <EditorIndex Value="0"/>
    5959        <WindowIndex Value="0"/>
    60         <TopLine Value="760"/>
    61         <CursorPos X="5" Y="766"/>
     60        <TopLine Value="18"/>
     61        <CursorPos X="36" Y="10"/>
    6262        <UsageCount Value="233"/>
    6363        <Bookmarks Count="1">
     
    348348        <EditorIndex Value="1"/>
    349349        <WindowIndex Value="0"/>
    350         <TopLine Value="31"/>
    351         <CursorPos X="58" Y="35"/>
     350        <TopLine Value="12"/>
     351        <CursorPos X="74" Y="43"/>
    352352        <UsageCount Value="60"/>
    353353        <Loaded Value="True"/>
     
    356356        <Filename Value="../Units/GenericMatrix.pas"/>
    357357        <UnitName Value="GenericMatrix"/>
     358        <IsVisibleTab Value="True"/>
    358359        <EditorIndex Value="5"/>
    359360        <WindowIndex Value="0"/>
    360         <TopLine Value="37"/>
    361         <CursorPos X="34" Y="48"/>
     361        <TopLine Value="103"/>
     362        <CursorPos X="5" Y="116"/>
    362363        <UsageCount Value="38"/>
    363364        <Loaded Value="True"/>
     
    400401        <Filename Value="../Units/SpecializedList.pas"/>
    401402        <UnitName Value="SpecializedList"/>
    402         <EditorIndex Value="6"/>
    403403        <WindowIndex Value="0"/>
    404404        <TopLine Value="45"/>
    405405        <CursorPos X="1" Y="68"/>
    406406        <UsageCount Value="39"/>
    407         <Loaded Value="True"/>
    408407      </Unit41>
    409408      <Unit42>
     
    460459        <Filename Value="../Units/GenericString.pas"/>
    461460        <UnitName Value="GenericString"/>
    462         <EditorIndex Value="7"/>
     461        <EditorIndex Value="6"/>
    463462        <WindowIndex Value="0"/>
    464463        <TopLine Value="35"/>
     
    470469        <Filename Value="../Units/GenericBitmap.pas"/>
    471470        <UnitName Value="GenericBitmap"/>
    472         <EditorIndex Value="8"/>
    473         <WindowIndex Value="0"/>
    474         <TopLine Value="22"/>
    475         <CursorPos X="18" Y="46"/>
     471        <EditorIndex Value="7"/>
     472        <WindowIndex Value="0"/>
     473        <TopLine Value="1"/>
     474        <CursorPos X="15" Y="14"/>
    476475        <UsageCount Value="31"/>
    477476        <Loaded Value="True"/>
     
    552551      </Unit59>
    553552    </Units>
    554     <JumpHistory Count="30" HistoryIndex="28">
     553    <JumpHistory Count="30" HistoryIndex="29">
    555554      <Position1>
    556         <Filename Value="../Units/GenericTree.pas"/>
    557         <Caret Line="27" Column="57" TopLine="20"/>
     555        <Filename Value="../Units/GenericMatrix.pas"/>
     556        <Caret Line="71" Column="45" TopLine="57"/>
    558557      </Position1>
    559558      <Position2>
    560         <Filename Value="../Units/GenericTree.pas"/>
    561         <Caret Line="51" Column="40" TopLine="44"/>
     559        <Filename Value="../Units/GenericMatrix.pas"/>
     560        <Caret Line="77" Column="43" TopLine="64"/>
    562561      </Position2>
    563562      <Position3>
    564         <Filename Value="../Units/GenericTree.pas"/>
    565         <Caret Line="29" Column="33" TopLine="14"/>
     563        <Filename Value="../Units/GenericMatrix.pas"/>
     564        <Caret Line="87" Column="47" TopLine="74"/>
    566565      </Position3>
    567566      <Position4>
    568         <Filename Value="../Units/GenericTree.pas"/>
    569         <Caret Line="63" Column="49" TopLine="42"/>
     567        <Filename Value="../Units/GenericMatrix.pas"/>
     568        <Caret Line="89" Column="62" TopLine="76"/>
    570569      </Position4>
    571570      <Position5>
    572         <Filename Value="../Units/GenericTree.pas"/>
    573         <Caret Line="34" Column="1" TopLine="18"/>
     571        <Filename Value="../Units/GenericMatrix.pas"/>
     572        <Caret Line="93" Column="59" TopLine="80"/>
    574573      </Position5>
    575574      <Position6>
    576         <Filename Value="../Units/GenericTree.pas"/>
    577         <Caret Line="21" Column="72" TopLine="12"/>
     575        <Filename Value="../Units/GenericMatrix.pas"/>
     576        <Caret Line="94" Column="61" TopLine="81"/>
    578577      </Position6>
    579578      <Position7>
    580         <Filename Value="../Units/GenericTree.pas"/>
    581         <Caret Line="65" Column="54" TopLine="51"/>
     579        <Filename Value="../Units/GenericMatrix.pas"/>
     580        <Caret Line="124" Column="73" TopLine="111"/>
    582581      </Position7>
    583582      <Position8>
    584         <Filename Value="../Units/GenericTree.pas"/>
    585         <Caret Line="101" Column="27" TopLine="94"/>
     583        <Filename Value="../Units/GenericMatrix.pas"/>
     584        <Caret Line="140" Column="71" TopLine="127"/>
    586585      </Position8>
    587586      <Position9>
    588         <Filename Value="../Units/GenericTree.pas"/>
    589         <Caret Line="29" Column="6" TopLine="13"/>
     587        <Filename Value="../Units/GenericMatrix.pas"/>
     588        <Caret Line="223" Column="57" TopLine="210"/>
    590589      </Position9>
    591590      <Position10>
    592         <Filename Value="../Units/GenericTree.pas"/>
    593         <Caret Line="49" Column="14" TopLine="38"/>
     591        <Filename Value="../Units/GenericMatrix.pas"/>
     592        <Caret Line="311" Column="74" TopLine="298"/>
    594593      </Position10>
    595594      <Position11>
    596         <Filename Value="../Units/GenericTree.pas"/>
    597         <Caret Line="22" Column="19" TopLine="25"/>
     595        <Filename Value="../Units/GenericMatrix.pas"/>
     596        <Caret Line="323" Column="59" TopLine="310"/>
    598597      </Position11>
    599598      <Position12>
    600         <Filename Value="../Units/GenericTree.pas"/>
    601         <Caret Line="28" Column="4" TopLine="19"/>
     599        <Filename Value="../Units/GenericMatrix.pas"/>
     600        <Caret Line="431" Column="55" TopLine="418"/>
    602601      </Position12>
    603602      <Position13>
    604         <Filename Value="../Units/GenericTree.pas"/>
    605         <Caret Line="29" Column="7" TopLine="16"/>
     603        <Filename Value="../Units/GenericBitmap.pas"/>
     604        <Caret Line="14" Column="15" TopLine="1"/>
    606605      </Position13>
    607606      <Position14>
    608         <Filename Value="UMainForm.pas"/>
    609         <Caret Line="774" Column="30" TopLine="754"/>
     607        <Filename Value="../Units/GenericMatrix.pas"/>
     608        <Caret Line="114" Column="55" TopLine="91"/>
    610609      </Position14>
    611610      <Position15>
    612         <Filename Value="../Units/GenericTree.pas"/>
    613         <Caret Line="47" Column="5" TopLine="34"/>
     611        <Filename Value="../Units/GenericMatrix.pas"/>
     612        <Caret Line="50" Column="39" TopLine="37"/>
    614613      </Position15>
    615614      <Position16>
    616         <Filename Value="../Units/GenericTree.pas"/>
    617         <Caret Line="71" Column="48" TopLine="53"/>
     615        <Filename Value="../Units/GenericMatrix.pas"/>
     616        <Caret Line="114" Column="24" TopLine="94"/>
    618617      </Position16>
    619618      <Position17>
    620         <Filename Value="../Units/GenericTree.pas"/>
    621         <Caret Line="126" Column="3" TopLine="124"/>
     619        <Filename Value="../Units/GenericMatrix.pas"/>
     620        <Caret Line="50" Column="40" TopLine="25"/>
    622621      </Position17>
    623622      <Position18>
    624         <Filename Value="../Units/GenericTree.pas"/>
    625         <Caret Line="127" Column="1" TopLine="113"/>
     623        <Filename Value="../Units/GenericMatrix.pas"/>
     624        <Caret Line="114" Column="24" TopLine="101"/>
    626625      </Position18>
    627626      <Position19>
    628         <Filename Value="../Units/GenericTree.pas"/>
    629         <Caret Line="126" Column="23" TopLine="113"/>
     627        <Filename Value="../Units/GenericMatrix.pas"/>
     628        <Caret Line="50" Column="39" TopLine="37"/>
    630629      </Position19>
    631630      <Position20>
    632         <Filename Value="UMainForm.pas"/>
    633         <Caret Line="774" Column="30" TopLine="754"/>
     631        <Filename Value="../Units/GenericMatrix.pas"/>
     632        <Caret Line="664" Column="1" TopLine="639"/>
    634633      </Position20>
    635634      <Position21>
    636         <Filename Value="../Units/GenericTree.pas"/>
    637         <Caret Line="7" Column="40" TopLine="1"/>
     635        <Filename Value="../Units/GenericMatrix.pas"/>
     636        <Caret Line="132" Column="3" TopLine="114"/>
    638637      </Position21>
    639638      <Position22>
    640         <Filename Value="../Units/GenericTree.pas"/>
    641         <Caret Line="22" Column="21" TopLine="1"/>
     639        <Filename Value="../Units/GenericMatrix.pas"/>
     640        <Caret Line="114" Column="14" TopLine="106"/>
    642641      </Position22>
    643642      <Position23>
    644         <Filename Value="../Units/GenericTree.pas"/>
    645         <Caret Line="35" Column="54" TopLine="14"/>
     643        <Filename Value="../Units/GenericMatrix.pas"/>
     644        <Caret Line="133" Column="15" TopLine="115"/>
    646645      </Position23>
    647646      <Position24>
    648         <Filename Value="../Units/GenericTree.pas"/>
    649         <Caret Line="64" Column="21" TopLine="43"/>
     647        <Filename Value="../Units/GenericMatrix.pas"/>
     648        <Caret Line="54" Column="65" TopLine="37"/>
    650649      </Position24>
    651650      <Position25>
    652         <Filename Value="../Units/GenericTree.pas"/>
    653         <Caret Line="49" Column="1" TopLine="40"/>
     651        <Filename Value="../Units/GenericMatrix.pas"/>
     652        <Caret Line="50" Column="39" TopLine="37"/>
    654653      </Position25>
    655654      <Position26>
    656         <Filename Value="../Units/GenericTree.pas"/>
    657         <Caret Line="63" Column="7" TopLine="55"/>
     655        <Filename Value="../Units/GenericMatrix.pas"/>
     656        <Caret Line="138" Column="50" TopLine="118"/>
    658657      </Position26>
    659658      <Position27>
    660         <Filename Value="../Units/GenericTree.pas"/>
    661         <Caret Line="92" Column="7" TopLine="76"/>
     659        <Filename Value="../Units/GenericMatrix.pas"/>
     660        <Caret Line="144" Column="49" TopLine="120"/>
    662661      </Position27>
    663662      <Position28>
    664         <Filename Value="../Units/GenericTree.pas"/>
    665         <Caret Line="89" Column="1" TopLine="76"/>
     663        <Filename Value="../Units/GenericMatrix.pas"/>
     664        <Caret Line="134" Column="1" TopLine="122"/>
    666665      </Position28>
    667666      <Position29>
    668         <Filename Value="../Units/GenericTree.pas"/>
    669         <Caret Line="125" Column="26" TopLine="107"/>
     667        <Filename Value="../Units/GenericMatrix.pas"/>
     668        <Caret Line="137" Column="41" TopLine="126"/>
    670669      </Position29>
    671670      <Position30>
    672         <Filename Value="../Units/GenericTree.pas"/>
    673         <Caret Line="70" Column="14" TopLine="57"/>
     671        <Filename Value="../Units/GenericMatrix.pas"/>
     672        <Caret Line="136" Column="29" TopLine="123"/>
    674673      </Position30>
    675674    </JumpHistory>
  • Generics/NativeGenerics/Units/GenericList.pas

    r327 r379  
    195195end;
    196196
    197 procedure TGList<TItem>.GetList(List: TGList; Index, ACount: TIndex);
     197procedure TGList<TItem>.GetList(List: TGList<TItem>; Index, ACount: TIndex);
    198198begin
    199199 List.Clear;
     
    539539end;
    540540
    541 procedure TGList<TItem>.AddListPart(List: TGList; ItemIndex, ItemCount: TIndex);
     541procedure TGList<TItem>.AddListPart(List: TGList<TItem>; ItemIndex, ItemCount: TIndex);
    542542var
    543543  I: TIndex;
  • Generics/NativeGenerics/Units/GenericMatrix.pas

    r324 r379  
    1919      TRow = array of TItem;
    2020      TMerge = function(Item1, Item2: TItem): TItem of object;
     21      PItem = ^TItem;
    2122
    2223      TIndex = record
     
    6869    function Add(Item: TItem): TIndex;
    6970    procedure AddMatrix(Values: array of TRow);
    70     procedure AddList(List: TGMatrix);
    71     procedure Assign(Source: TGMatrix);
     71    procedure AddList(List: TGMatrix<TItem>);
     72    procedure Assign(Source: TGMatrix<TItem>);
    7273    procedure Clear; virtual;
    7374    procedure Contract;
     
    7576    procedure Delete(Index: TIndex); virtual;
    7677    procedure DeleteItems(Index, Count: TIndex);
    77     function EqualTo(List: TGMatrix): Boolean;
     78    function EqualTo(List: TGMatrix<TItem>): Boolean;
    7879    procedure Expand;
    7980    function Extract(Item: TItem): TItem;
     
    8586    procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1);
    8687    function IndexOf(Item: TItem; Start: TIndex = 0): TIndex;
    87     function IndexOfList(List: TGMatrix; Start: TIndex = 0): TIndex;
     88    function IndexOfList(List: TGMatrix<TItem>; Start: TIndex = 0): TIndex;
    8889    procedure Insert(Index: TIndex; Item: TItem);
    89     procedure InsertList(Index: TIndex; List: TGMatrix);
     90    procedure InsertList(Index: TIndex; List: TGMatrix<TItem>);
    9091    procedure InsertArray(Index: TIndex; Values: array of TItem);
    9192    procedure Move(CurIndex, NewIndex: TIndex);
    9293    procedure MoveItems(CurIndex, NewIndex, Count: TIndex);
    93     procedure Merge(Index: TIndex; Source: TGMatrix; Proc: TMerge);
    94     procedure Replace(Index: TIndex; Source: TGMatrix);
     94    procedure Merge(Index: TIndex; Source: TGMatrix<TItem>; Proc: TMerge);
     95    procedure Replace(Index: TIndex; Source: TGMatrix<TItem>);
    9596    function Remove(Item: TItem): TIndex;
    9697    procedure Reverse;
     
    107108      TIndex = TGAbstractMatrix<TItem>.TIndex;
    108109  private
     110    FRowSize: Integer;
     111    FCellSize: Integer;
    109112    FData: Pointer;
    110113    FCount: TIndex;
     114  public
     115    constructor Create;
     116    function GetItemXY(X: TIndexX; Y: TIndexY): TItem; override;
     117    procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); override;
     118    property Data: Pointer read FData;
     119    property Count: TIndex read FCount write SetCount;
    111120  end;
    112121
     
    120129
    121130
     131{ TGRawMatrix }
     132
     133constructor TGRawMatrix<TItem>.Create;
     134begin
     135  FCellSize := SizeOf(TItem);
     136end;
     137
     138function TGRawMatrix<TItem>.GetItemXY(X: TIndexX; Y: TIndexY): TItem;
     139begin
     140  Result := PItem(X * FCellSize + Y * FRowSize)^;
     141end;
     142
     143procedure TGRawMatrix<TItem>.PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem);
     144begin
     145  PItem(X * FCellSize + Y * FRowSize)^ := AValue;
     146end;
     147
    122148{ TGMatrix }
    123149
    124 procedure TGMatrix<TItem>.Replace(Index: TIndex; Source: TGMatrix);
     150procedure TGMatrix<TItem>.Replace(Index: TIndex; Source: TGMatrix<TItem>);
    125151var
    126152  X: TIndexX;
     
    138164end;
    139165
    140 procedure TGMatrix<TItem>.Merge(Index: TIndex; Source: TGMatrix; Proc: TMerge);
     166procedure TGMatrix<TItem>.Merge(Index: TIndex; Source: TGMatrix<TItem>; Proc: TMerge);
    141167var
    142168  X: TIndexX;
     
    221247end;
    222248
    223 procedure TGMatrix<TItem>.Assign(Source: TGMatrix);
     249procedure TGMatrix<TItem>.Assign(Source: TGMatrix<TItem>);
    224250var
    225251  Index: TIndex;
     
    309335end;
    310336
    311 procedure TGMatrix<TItem>.InsertList(Index: TIndex; List: TGMatrix);
     337procedure TGMatrix<TItem>.InsertList(Index: TIndex; List: TGMatrix<TItem>);
    312338var
    313339  I: TIndex;
     
    321347end;
    322348
    323 function TGMatrix<TItem>.IndexOfList(List: TGMatrix; Start: TIndex): TIndex;
     349function TGMatrix<TItem>.IndexOfList(List: TGMatrix<TItem>; Start: TIndex): TIndex;
    324350var
    325351  I: TIndex;
     
    429455end;
    430456
    431 function TGMatrix<TItem>.EqualTo(List: TGMatrix): Boolean;
     457function TGMatrix<TItem>.EqualTo(List: TGMatrix<TItem>): Boolean;
    432458var
    433459  I: TIndex;
     
    575601end;
    576602
    577 procedure TGMatrix<TItem>.AddList(List: TGMatrix);
     603procedure TGMatrix<TItem>.AddList(List: TGMatrix<TItem>);
    578604var
    579605  I: TIndex;
  • Generics/TemplateGenerics/Generic/GenericRectangle.inc

    r360 r379  
    188188  Right := Source.Right;
    189189  Bottom := Source.Bottom;
     190  KeepSize := Source.KeepSize;
    190191end;
    191192
  • Generics/TemplateGenerics/TemplateGenerics.lpk

    r342 r379  
    142142    <RequiredPkgs Count="2">
    143143      <Item1>
    144         <PackageName Value="LCL"/>
     144        <PackageName Value="LCLBase"/>
    145145      </Item1>
    146146      <Item2>
     
    155155      <Version Value="2"/>
    156156    </PublishOptions>
     157    <CustomOptions Items="ExternHelp" Version="2">
     158      <_ExternHelp Items="Count"/>
     159    </CustomOptions>
    157160  </Package>
    158161</CONFIG>
Note: See TracChangeset for help on using the changeset viewer.