Ignore:
Timestamp:
Nov 28, 2012, 7:50:19 AM (11 years ago)
Author:
chronos
Message:
  • Modified: TListFile enhancements.
Location:
Generics/NativeGenerics
Files:
4 edited

Legend:

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

    r425 r458  
    3333      <Item1>
    3434        <PackageName Value="NativeGenerics"/>
     35        <DefaultFilename Value="../NativeGenerics.lpk" Prefer="True"/>
    3536      </Item1>
    3637      <Item2>
     
    3839      </Item2>
    3940    </RequiredPackages>
    40     <Units Count="75">
     41    <Units Count="77">
    4142      <Unit0>
    4243        <Filename Value="Demo.lpr"/>
     
    5657        <ResourceBaseClass Value="Form"/>
    5758        <UnitName Value="UMainForm"/>
    58         <EditorIndex Value="1"/>
    59         <WindowIndex Value="0"/>
    60         <TopLine Value="652"/>
    61         <CursorPos X="11" Y="657"/>
     59        <EditorIndex Value="2"/>
     60        <WindowIndex Value="0"/>
     61        <TopLine Value="653"/>
     62        <CursorPos X="1" Y="657"/>
    6263        <UsageCount Value="233"/>
    6364        <Bookmarks Count="1">
     
    346347        <UnitName Value="GenericList"/>
    347348        <IsVisibleTab Value="True"/>
    348         <EditorIndex Value="5"/>
    349         <WindowIndex Value="0"/>
    350         <TopLine Value="31"/>
    351         <CursorPos X="28" Y="44"/>
    352         <UsageCount Value="64"/>
     349        <EditorIndex Value="6"/>
     350        <WindowIndex Value="0"/>
     351        <TopLine Value="82"/>
     352        <CursorPos X="46" Y="93"/>
     353        <UsageCount Value="65"/>
    353354        <Loaded Value="True"/>
    354355      </Unit35>
     
    358359        <EditorIndex Value="0"/>
    359360        <WindowIndex Value="0"/>
    360         <TopLine Value="127"/>
    361         <CursorPos X="51" Y="143"/>
    362         <UsageCount Value="40"/>
     361        <TopLine Value="42"/>
     362        <CursorPos X="53" Y="55"/>
     363        <UsageCount Value="41"/>
    363364        <Loaded Value="True"/>
    364365      </Unit36>
     
    409410        <CursorPos X="3" Y="270"/>
    410411        <UsageCount Value="34"/>
     412        <DefaultSyntaxHighlighter Value="Delphi"/>
    411413      </Unit42>
    412414      <Unit43>
     
    440442        <CursorPos X="11" Y="971"/>
    441443        <UsageCount Value="8"/>
     444        <DefaultSyntaxHighlighter Value="Delphi"/>
    442445      </Unit46>
    443446      <Unit47>
     
    460463        <Filename Value="../Units/GenericBitmap.pas"/>
    461464        <UnitName Value="GenericBitmap"/>
    462         <WindowIndex Value="0"/>
    463         <TopLine Value="1"/>
    464         <CursorPos X="15" Y="14"/>
     465        <EditorIndex Value="7"/>
     466        <WindowIndex Value="0"/>
     467        <TopLine Value="6"/>
     468        <CursorPos X="14" Y="19"/>
    465469        <UsageCount Value="32"/>
     470        <Loaded Value="True"/>
    466471      </Unit49>
    467472      <Unit50>
     
    472477        <CursorPos X="22" Y="1165"/>
    473478        <UsageCount Value="28"/>
     479        <DefaultSyntaxHighlighter Value="Delphi"/>
    474480      </Unit50>
    475481      <Unit51>
     
    479485        <CursorPos X="22" Y="314"/>
    480486        <UsageCount Value="28"/>
     487        <DefaultSyntaxHighlighter Value="Delphi"/>
    481488      </Unit51>
    482489      <Unit52>
     
    486493        <CursorPos X="3" Y="46"/>
    487494        <UsageCount Value="28"/>
     495        <DefaultSyntaxHighlighter Value="Delphi"/>
    488496      </Unit52>
    489497      <Unit53>
     
    494502        <CursorPos X="15" Y="360"/>
    495503        <UsageCount Value="28"/>
     504        <DefaultSyntaxHighlighter Value="Delphi"/>
    496505      </Unit53>
    497506      <Unit54>
     
    501510        <CursorPos X="3" Y="310"/>
    502511        <UsageCount Value="28"/>
     512        <DefaultSyntaxHighlighter Value="Delphi"/>
    503513      </Unit54>
    504514      <Unit55>
     
    508518        <CursorPos X="3" Y="63"/>
    509519        <UsageCount Value="28"/>
     520        <DefaultSyntaxHighlighter Value="Delphi"/>
    510521      </Unit55>
    511522      <Unit56>
     
    515526        <CursorPos X="3" Y="152"/>
    516527        <UsageCount Value="28"/>
     528        <DefaultSyntaxHighlighter Value="Delphi"/>
    517529      </Unit56>
    518530      <Unit57>
     
    523535        <CursorPos X="15" Y="166"/>
    524536        <UsageCount Value="28"/>
     537        <DefaultSyntaxHighlighter Value="Delphi"/>
    525538      </Unit57>
    526539      <Unit58>
     
    531544        <CursorPos X="3" Y="2975"/>
    532545        <UsageCount Value="27"/>
     546        <DefaultSyntaxHighlighter Value="Delphi"/>
    533547      </Unit58>
    534548      <Unit59>
     
    538552        <CursorPos X="3" Y="5243"/>
    539553        <UsageCount Value="27"/>
     554        <DefaultSyntaxHighlighter Value="Delphi"/>
    540555      </Unit59>
    541556      <Unit60>
     
    548563      <Unit61>
    549564        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/inc/systemh.inc"/>
    550         <EditorIndex Value="8"/>
     565        <EditorIndex Value="11"/>
    551566        <WindowIndex Value="0"/>
    552567        <TopLine Value="582"/>
    553568        <CursorPos X="11" Y="595"/>
    554         <UsageCount Value="12"/>
     569        <UsageCount Value="13"/>
    555570        <Loaded Value="True"/>
    556571      </Unit61>
     
    600615      <Unit68>
    601616        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/sysutils/sysstrh.inc"/>
    602         <EditorIndex Value="6"/>
     617        <EditorIndex Value="9"/>
    603618        <WindowIndex Value="0"/>
    604619        <TopLine Value="72"/>
    605620        <CursorPos X="10" Y="84"/>
    606         <UsageCount Value="11"/>
     621        <UsageCount Value="12"/>
    607622        <Loaded Value="True"/>
    608623      </Unit68>
    609624      <Unit69>
    610625        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/classesh.inc"/>
    611         <EditorIndex Value="2"/>
    612         <WindowIndex Value="0"/>
    613         <TopLine Value="257"/>
     626        <EditorIndex Value="3"/>
     627        <WindowIndex Value="0"/>
     628        <TopLine Value="258"/>
    614629        <CursorPos X="14" Y="270"/>
    615         <UsageCount Value="11"/>
     630        <UsageCount Value="12"/>
    616631        <Loaded Value="True"/>
    617632      </Unit69>
    618633      <Unit70>
    619634        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/stringl.inc"/>
    620         <EditorIndex Value="4"/>
     635        <EditorIndex Value="5"/>
    621636        <WindowIndex Value="0"/>
    622637        <TopLine Value="736"/>
    623638        <CursorPos X="3" Y="738"/>
    624         <UsageCount Value="11"/>
     639        <UsageCount Value="12"/>
    625640        <Loaded Value="True"/>
    626641      </Unit70>
    627642      <Unit71>
    628643        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/lists.inc"/>
    629         <EditorIndex Value="3"/>
     644        <EditorIndex Value="4"/>
    630645        <WindowIndex Value="0"/>
    631646        <TopLine Value="199"/>
    632         <CursorPos X="3" Y="205"/>
    633         <UsageCount Value="11"/>
     647        <CursorPos X="31" Y="207"/>
     648        <UsageCount Value="12"/>
    634649        <Loaded Value="True"/>
    635650      </Unit71>
    636651      <Unit72>
    637652        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/sysutils/sysstr.inc"/>
    638         <EditorIndex Value="7"/>
     653        <EditorIndex Value="10"/>
    639654        <WindowIndex Value="0"/>
    640655        <TopLine Value="181"/>
    641656        <CursorPos X="3" Y="187"/>
    642         <UsageCount Value="11"/>
     657        <UsageCount Value="12"/>
    643658        <Loaded Value="True"/>
    644659      </Unit72>
    645660      <Unit73>
    646661        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/i386/i386.inc"/>
    647         <EditorIndex Value="10"/>
     662        <EditorIndex Value="13"/>
    648663        <WindowIndex Value="0"/>
    649664        <TopLine Value="503"/>
    650665        <CursorPos X="9" Y="503"/>
    651         <UsageCount Value="11"/>
     666        <UsageCount Value="12"/>
    652667        <Loaded Value="True"/>
    653668      </Unit73>
    654669      <Unit74>
    655670        <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/inc/system.inc"/>
    656         <EditorIndex Value="9"/>
     671        <EditorIndex Value="12"/>
    657672        <WindowIndex Value="0"/>
    658673        <TopLine Value="277"/>
    659674        <CursorPos X="14" Y="285"/>
     675        <UsageCount Value="12"/>
     676        <Loaded Value="True"/>
     677      </Unit74>
     678      <Unit75>
     679        <Filename Value="../ReadMe.txt"/>
     680        <EditorIndex Value="8"/>
     681        <WindowIndex Value="0"/>
     682        <TopLine Value="1"/>
     683        <CursorPos X="27" Y="9"/>
    660684        <UsageCount Value="11"/>
    661685        <Loaded Value="True"/>
    662       </Unit74>
     686        <DefaultSyntaxHighlighter Value="None"/>
     687      </Unit75>
     688      <Unit76>
     689        <Filename Value="../Units/GenericPoint.pas"/>
     690        <UnitName Value="GenericPoint"/>
     691        <EditorIndex Value="1"/>
     692        <WindowIndex Value="0"/>
     693        <TopLine Value="2"/>
     694        <CursorPos X="19" Y="20"/>
     695        <UsageCount Value="10"/>
     696        <Loaded Value="True"/>
     697      </Unit76>
    663698    </Units>
    664     <JumpHistory Count="30" HistoryIndex="29">
     699    <JumpHistory Count="30" HistoryIndex="28">
    665700      <Position1>
    666         <Filename Value="UMainForm.pas"/>
    667         <Caret Line="657" Column="1" TopLine="652"/>
     701        <Filename Value="../Units/GenericList.pas"/>
     702        <Caret Line="221" Column="1" TopLine="200"/>
    668703      </Position1>
    669704      <Position2>
    670705        <Filename Value="../Units/GenericList.pas"/>
    671         <Caret Line="237" Column="1" TopLine="229"/>
     706        <Caret Line="216" Column="1" TopLine="200"/>
    672707      </Position2>
    673708      <Position3>
    674709        <Filename Value="../Units/GenericList.pas"/>
    675         <Caret Line="239" Column="1" TopLine="229"/>
     710        <Caret Line="308" Column="1" TopLine="295"/>
    676711      </Position3>
    677712      <Position4>
    678         <Filename Value="UMainForm.pas"/>
    679         <Caret Line="658" Column="1" TopLine="652"/>
     713        <Filename Value="../Units/GenericList.pas"/>
     714        <Caret Line="309" Column="1" TopLine="295"/>
    680715      </Position4>
    681716      <Position5>
    682         <Filename Value="UMainForm.pas"/>
    683         <Caret Line="657" Column="1" TopLine="652"/>
     717        <Filename Value="../Units/GenericList.pas"/>
     718        <Caret Line="313" Column="1" TopLine="295"/>
    684719      </Position5>
    685720      <Position6>
    686721        <Filename Value="../Units/GenericList.pas"/>
    687         <Caret Line="238" Column="1" TopLine="229"/>
     722        <Caret Line="314" Column="1" TopLine="295"/>
    688723      </Position6>
    689724      <Position7>
    690725        <Filename Value="../Units/GenericList.pas"/>
    691         <Caret Line="239" Column="1" TopLine="229"/>
     726        <Caret Line="213" Column="1" TopLine="200"/>
    692727      </Position7>
    693728      <Position8>
    694729        <Filename Value="../Units/GenericList.pas"/>
    695         <Caret Line="521" Column="1" TopLine="508"/>
     730        <Caret Line="313" Column="1" TopLine="300"/>
    696731      </Position8>
    697732      <Position9>
    698733        <Filename Value="../Units/GenericList.pas"/>
    699         <Caret Line="522" Column="1" TopLine="508"/>
     734        <Caret Line="314" Column="1" TopLine="300"/>
    700735      </Position9>
    701736      <Position10>
    702737        <Filename Value="../Units/GenericList.pas"/>
    703         <Caret Line="238" Column="1" TopLine="225"/>
     738        <Caret Line="215" Column="1" TopLine="202"/>
    704739      </Position10>
    705740      <Position11>
    706741        <Filename Value="../Units/GenericList.pas"/>
    707         <Caret Line="239" Column="1" TopLine="225"/>
     742        <Caret Line="220" Column="1" TopLine="202"/>
    708743      </Position11>
    709744      <Position12>
    710745        <Filename Value="../Units/GenericList.pas"/>
    711         <Caret Line="187" Column="1" TopLine="174"/>
     746        <Caret Line="221" Column="1" TopLine="202"/>
    712747      </Position12>
    713748      <Position13>
    714749        <Filename Value="../Units/GenericList.pas"/>
    715         <Caret Line="238" Column="1" TopLine="225"/>
     750        <Caret Line="216" Column="1" TopLine="202"/>
    716751      </Position13>
    717752      <Position14>
    718753        <Filename Value="../Units/GenericList.pas"/>
    719         <Caret Line="239" Column="1" TopLine="225"/>
     754        <Caret Line="308" Column="1" TopLine="295"/>
    720755      </Position14>
    721756      <Position15>
    722757        <Filename Value="../Units/GenericList.pas"/>
    723         <Caret Line="189" Column="1" TopLine="176"/>
     758        <Caret Line="303" Column="13" TopLine="296"/>
    724759      </Position15>
    725760      <Position16>
    726761        <Filename Value="../Units/GenericList.pas"/>
    727         <Caret Line="190" Column="1" TopLine="176"/>
     762        <Caret Line="626" Column="1" TopLine="613"/>
    728763      </Position16>
    729764      <Position17>
    730         <Filename Value="../Units/GenericList.pas"/>
    731         <Caret Line="233" Column="1" TopLine="220"/>
     765        <Filename Value="UMainForm.pas"/>
     766        <Caret Line="657" Column="1" TopLine="653"/>
    732767      </Position17>
    733768      <Position18>
    734         <Filename Value="../Units/GenericList.pas"/>
    735         <Caret Line="234" Column="1" TopLine="220"/>
     769        <Filename Value="../Units/GenericMatrix.pas"/>
     770        <Caret Line="137" Column="19" TopLine="127"/>
    736771      </Position18>
    737772      <Position19>
    738         <Filename Value="../Units/GenericList.pas"/>
    739         <Caret Line="238" Column="1" TopLine="220"/>
     773        <Filename Value="../Units/GenericMatrix.pas"/>
     774        <Caret Line="116" Column="17" TopLine="99"/>
    740775      </Position19>
    741776      <Position20>
    742         <Filename Value="../Units/GenericList.pas"/>
    743         <Caret Line="239" Column="1" TopLine="220"/>
     777        <Filename Value="../Units/GenericMatrix.pas"/>
     778        <Caret Line="51" Column="39" TopLine="36"/>
    744779      </Position20>
    745780      <Position21>
    746         <Filename Value="../Units/GenericList.pas"/>
    747         <Caret Line="187" Column="1" TopLine="174"/>
     781        <Filename Value="../Units/GenericMatrix.pas"/>
     782        <Caret Line="66" Column="13" TopLine="56"/>
    748783      </Position21>
    749784      <Position22>
    750         <Filename Value="../Units/GenericList.pas"/>
    751         <Caret Line="238" Column="1" TopLine="225"/>
     785        <Filename Value="../Units/GenericMatrix.pas"/>
     786        <Caret Line="50" Column="3" TopLine="37"/>
    752787      </Position22>
    753788      <Position23>
    754         <Filename Value="../Units/GenericList.pas"/>
    755         <Caret Line="239" Column="1" TopLine="225"/>
     789        <Filename Value="../Units/GenericMatrix.pas"/>
     790        <Caret Line="55" Column="22" TopLine="42"/>
    756791      </Position23>
    757792      <Position24>
    758         <Filename Value="../Units/GenericList.pas"/>
    759         <Caret Line="189" Column="1" TopLine="176"/>
     793        <Filename Value="../Units/GenericMatrix.pas"/>
     794        <Caret Line="51" Column="25" TopLine="38"/>
    760795      </Position24>
    761796      <Position25>
    762         <Filename Value="../Units/GenericList.pas"/>
    763         <Caret Line="190" Column="1" TopLine="176"/>
     797        <Filename Value="../Units/GenericMatrix.pas"/>
     798        <Caret Line="53" Column="39" TopLine="38"/>
    764799      </Position25>
    765800      <Position26>
    766         <Filename Value="../Units/GenericList.pas"/>
    767         <Caret Line="233" Column="1" TopLine="220"/>
     801        <Filename Value="../Units/GenericMatrix.pas"/>
     802        <Caret Line="51" Column="39" TopLine="38"/>
    768803      </Position26>
    769804      <Position27>
    770         <Filename Value="../Units/GenericList.pas"/>
    771         <Caret Line="234" Column="1" TopLine="220"/>
     805        <Filename Value="../Units/GenericMatrix.pas"/>
     806        <Caret Line="52" Column="7" TopLine="38"/>
    772807      </Position27>
    773808      <Position28>
    774         <Filename Value="../Units/GenericList.pas"/>
    775         <Caret Line="238" Column="1" TopLine="220"/>
     809        <Filename Value="../Units/GenericMatrix.pas"/>
     810        <Caret Line="55" Column="52" TopLine="42"/>
    776811      </Position28>
    777812      <Position29>
    778813        <Filename Value="../Units/GenericList.pas"/>
    779         <Caret Line="239" Column="1" TopLine="220"/>
     814        <Caret Line="93" Column="25" TopLine="82"/>
    780815      </Position29>
    781816      <Position30>
    782         <Filename Value="UMainForm.pas"/>
    783         <Caret Line="657" Column="11" TopLine="652"/>
     817        <Filename Value="../Units/GenericList.pas"/>
     818        <Caret Line="1077" Column="4" TopLine="1052"/>
    784819      </Position30>
    785820    </JumpHistory>
  • Generics/NativeGenerics/NativeGenerics.lpk

    r425 r458  
    2727    <Description Value="Native generics library.
    2828Require FPC 2.7.1"/>
    29     <License Value="GNU/GPL"/>
     29    <License Value="GNU/GPLv3"/>
    3030    <Version Minor="2"/>
    3131    <Files Count="15">
  • Generics/NativeGenerics/ReadMe.txt

    r132 r458  
    1 Native generics
    2 =================
     1Native generics library
     2=======================
    33
    44Tutorial and basic information:
    55  http://wiki.freepascal.org/Generics
    66
    7 Version: 0.1
    8 Release date: 2011-01-20
     7Version: 0.2
     8Release date: 2012-09-25
    99Author: Chronos
    1010Email: robie@centrum.cz
     
    1515
    1616
    17 Require FPC version 2.5.1 and newer
     17Require FPC version 2.7.1 and newer
    1818
  • Generics/NativeGenerics/Units/GenericList.pas

    r425 r458  
    9595    function Get(Index: TIndex): TItem; override;
    9696    function GetInternal(Index: TIndex): TItem; override;
     97    function GetCount: TIndex; override;
    9798    function GetCapacity: TIndex;
    98     function GetCount: TIndex; override;
     99    procedure SetCount(const AValue: TIndex); override;
    99100    procedure SetCapacity(const AValue: TIndex);
    100101    procedure SetCapacityOptimized(const NewCapacity: TIndex);
    101     procedure SetCount(const AValue: TIndex); override;
    102102    procedure Put(Index: TIndex; const AValue: TItem); override;
    103103    procedure PutInternal(Index: TIndex; const AValue: TItem); override;
     
    141141  TGFileList<TItem> = class(TGList<TItem>)
    142142  private
     143    FFileName: string;
    143144    FHandle: THandle;
     145    FMode: Word;
     146    function GetOpenned: Boolean;
     147    procedure SetFileName(AValue: string);
     148    procedure SetMode(AValue: Word);
    144149  protected
    145150    function GetCount: TIndex; override;
     
    150155    procedure Put(Index: TIndex; const AValue: TItem); override;
    151156  public
    152     procedure Open(FileName: string; Mode: Integer);
     157    procedure Open;
    153158    procedure Close;
    154159    constructor Create;
    155160    destructor Destroy; override;
     161    property FileName: string read FFileName write SetFileName;
     162    property Mode: Word read FMode write SetMode;
     163    property Openned: Boolean read GetOpenned;
    156164  end;
    157165
     
    865873{ TGFileList<TItem> }
    866874
     875procedure TGFileList<TItem>.SetFileName(AValue: string);
     876begin
     877  if FFileName = AValue then Exit;
     878  FFileName := AValue;
     879  if Openned then begin
     880    Close;
     881    Open;
     882  end;
     883end;
     884
     885function TGFileList<TItem>.GetOpenned: Boolean;
     886begin
     887  Result := FHandle <> feInvalidHandle;
     888end;
     889
     890procedure TGFileList<TItem>.SetMode(AValue: Word);
     891begin
     892  if FMode = AValue then Exit;
     893  FMode := AValue;
     894  if Openned then begin
     895    Close;
     896    Open;
     897  end;
     898end;
     899
    867900function TGFileList<TItem>.GetCount: TIndex;
    868901var
     
    901934end;
    902935
    903 procedure TGFileList<TItem>.Open(FileName: string; Mode: Integer);
     936procedure TGFileList<TItem>.Open;
    904937begin
    905938  Close;
Note: See TracChangeset for help on using the changeset viewer.