LazUtils: Add a new unit IntegerList.

git-svn-id: trunk@56388 -
This commit is contained in:
juha 2017-11-13 17:33:23 +00:00
parent 98be7f19c0
commit 04a49cc7ee
4 changed files with 54 additions and 2 deletions

1
.gitattributes vendored
View File

@ -3143,6 +3143,7 @@ components/lazutils/fileutil.pas svneol=native#text/pascal
components/lazutils/fpcadds.pas svneol=native#text/pascal
components/lazutils/fpmake.pp svneol=native#text/plain
components/lazutils/html2textrender.pas svneol=native#text/pascal
components/lazutils/integerlist.pas svneol=native#text/pascal
components/lazutils/languages/lazutilsstrconsts.cs.po svneol=native#text/plain
components/lazutils/languages/lazutilsstrconsts.de.po svneol=native#text/plain
components/lazutils/languages/lazutilsstrconsts.es.po svneol=native#text/plain

View File

@ -0,0 +1,47 @@
{
*****************************************************************************
This file is part of LazUtils.
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
}
// A list of integers implemented using generics.
// Supports the same methods and properties as TStringList does for strings, except
// for "Sorted" property. Thus integers cannot be added to a sorted list correctly.
unit IntegerList;
{$mode objfpc}{$H+}
interface
uses
fgl;
function CompareInt(const Item1, Item2: Integer): Integer;
type
TIntegerList = class(specialize TFPGList<Integer>)
public
procedure Sort; overload;
end;
implementation
function CompareInt(const Item1, Item2: Integer): Integer;
begin
Result := Item1 - Item2;
end;
{ TIntegerList }
procedure TIntegerList.Sort;
begin
inherited Sort(@CompareInt);
end;
end.

View File

@ -16,7 +16,7 @@
<Description Value="Useful units for Lazarus packages."/>
<License Value="Modified LGPL-2"/>
<Version Major="1"/>
<Files Count="95">
<Files Count="96">
<Item1>
<Filename Value="LazLoggerImpl.inc"/>
<Type Value="Include"/>
@ -397,6 +397,10 @@
<Filename Value="lazpasreadutil.pas"/>
<UnitName Value="lazpasreadutil"/>
</Item95>
<Item96>
<Filename Value="integerlist.pas"/>
<UnitName Value="integerlist"/>
</Item96>
</Files>
<LazDoc Paths="../../docs/xml/lazutils"/>
<i18n>

View File

@ -21,7 +21,7 @@ uses
StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug,
TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile,
TTRASTER, TTTables, TTTypes, UTF8Process, HTML2TextRender, Laz_AVL_Tree,
CompWriterPas, LazPasReadUtil, LazarusPackageIntf;
CompWriterPas, LazPasReadUtil, IntegerList, LazarusPackageIntf;
implementation