mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-06 13:56:26 +02:00
* insertlistbefore added
This commit is contained in:
parent
ef7ae0eab1
commit
ec720a5800
@ -143,6 +143,8 @@ type
|
|||||||
function GetLast:TLinkedListItem;
|
function GetLast:TLinkedListItem;
|
||||||
{ inserts another List at the begin and make this List empty }
|
{ inserts another List at the begin and make this List empty }
|
||||||
procedure insertList(p : TLinkedList);
|
procedure insertList(p : TLinkedList);
|
||||||
|
{ inserts another List before the provided item and make this List empty }
|
||||||
|
procedure insertListBefore(Item:TLinkedListItem;p : TLinkedList);
|
||||||
{ inserts another List after the provided item and make this List empty }
|
{ inserts another List after the provided item and make this List empty }
|
||||||
procedure insertListAfter(Item:TLinkedListItem;p : TLinkedList);
|
procedure insertListAfter(Item:TLinkedListItem;p : TLinkedList);
|
||||||
{ concats another List at the end and make this List empty }
|
{ concats another List at the end and make this List empty }
|
||||||
@ -966,6 +968,35 @@ end;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TLinkedList.insertListBefore(Item:TLinkedListItem;p : TLinkedList);
|
||||||
|
begin
|
||||||
|
{ empty List ? }
|
||||||
|
if (p.FFirst=nil) then
|
||||||
|
exit;
|
||||||
|
if (Item=nil) then
|
||||||
|
begin
|
||||||
|
{ Insert at begin }
|
||||||
|
InsertList(p);
|
||||||
|
exit;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
p.FLast.Next:=Item;
|
||||||
|
p.FFirst.Previous:=Item.Previous;
|
||||||
|
if assigned(Item.Previous) then
|
||||||
|
Item.Previous.Next:=p.FFirst
|
||||||
|
else
|
||||||
|
FFirst:=p.FFirst;
|
||||||
|
Item.Previous:=p.FLast;
|
||||||
|
inc(FCount,p.FCount);
|
||||||
|
end;
|
||||||
|
{ p becomes empty }
|
||||||
|
p.FFirst:=nil;
|
||||||
|
p.Flast:=nil;
|
||||||
|
p.FCount:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TLinkedList.insertListAfter(Item:TLinkedListItem;p : TLinkedList);
|
procedure TLinkedList.insertListAfter(Item:TLinkedListItem;p : TLinkedList);
|
||||||
begin
|
begin
|
||||||
{ empty List ? }
|
{ empty List ? }
|
||||||
@ -2325,7 +2356,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.36 2004-09-13 20:26:26 peter
|
Revision 1.37 2004-10-04 20:43:28 peter
|
||||||
|
* insertlistbefore added
|
||||||
|
|
||||||
|
Revision 1.36 2004/09/13 20:26:26 peter
|
||||||
* stringlist.find case insensitive
|
* stringlist.find case insensitive
|
||||||
|
|
||||||
Revision 1.35 2004/06/20 08:55:28 florian
|
Revision 1.35 2004/06/20 08:55:28 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user