View Issue Details

IDProjectCategoryView StatusLast Update
0032447FPCRTLpublic2017-09-20 16:24
ReporterMichael FuchsAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0032447: Add an AddList method to TFPGObjectList
DescriptionThe TFPGObjectList has only the Assign method for adding another list. But the assign removes all existing entries.
With an AddList method to list can be merged without the data loss.
TagsNo tags attached.
Fixed in Revision37268
FPCOldBugId
FPCTarget
Attached Files
  • addlist.patch (988 bytes)
    Index: rtl/objpas/fgl.pp
    ===================================================================
    --- rtl/objpas/fgl.pp	(Revision 37264)
    +++ rtl/objpas/fgl.pp	(Arbeitskopie)
    @@ -181,6 +181,7 @@
         procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
         property Last: T read GetLast write SetLast;
     {$ifndef VER2_4}
    +    procedure AddList(Source: TFPGObjectList);
         procedure Assign(Source: TFPGObjectList);
     {$endif VER2_4}
         function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
    @@ -1043,14 +1044,19 @@
     end;
     
     {$ifndef VER2_4}
    -procedure TFPGObjectList.Assign(Source: TFPGObjectList);
    +procedure TFPGObjectList.AddList(Source: TFPGObjectList);
     var
       i: Integer;
     begin
    -  Clear;
       for I := 0 to Source.Count - 1 do
         Add(Source[i]);
     end;
    +
    +procedure TFPGObjectList.Assign(Source: TFPGObjectList);
    +begin
    +  Clear;
    +  AddList(Source);
    +end;
     {$endif VER2_4}
     
     function TFPGObjectList.Remove(const Item: T): Integer;
    
    addlist.patch (988 bytes)

Activities

Michael Fuchs

2017-09-20 12:31

reporter  

addlist.patch (988 bytes)
Index: rtl/objpas/fgl.pp
===================================================================
--- rtl/objpas/fgl.pp	(Revision 37264)
+++ rtl/objpas/fgl.pp	(Arbeitskopie)
@@ -181,6 +181,7 @@
     procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
     property Last: T read GetLast write SetLast;
 {$ifndef VER2_4}
+    procedure AddList(Source: TFPGObjectList);
     procedure Assign(Source: TFPGObjectList);
 {$endif VER2_4}
     function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
@@ -1043,14 +1044,19 @@
 end;
 
 {$ifndef VER2_4}
-procedure TFPGObjectList.Assign(Source: TFPGObjectList);
+procedure TFPGObjectList.AddList(Source: TFPGObjectList);
 var
   i: Integer;
 begin
-  Clear;
   for I := 0 to Source.Count - 1 do
     Add(Source[i]);
 end;
+
+procedure TFPGObjectList.Assign(Source: TFPGObjectList);
+begin
+  Clear;
+  AddList(Source);
+end;
 {$endif VER2_4}
 
 function TFPGObjectList.Remove(const Item: T): Integer;
addlist.patch (988 bytes)

Michael Fuchs

2017-09-20 12:31

reporter   ~0102939

Patch added.

Michael Van Canneyt

2017-09-20 16:24

administrator   ~0102945

Applied and expanded the patch, so all generic list objects have AddList, not just the object version.

Thanks for the patch!

Issue History

Date Modified Username Field Change
2017-09-20 12:30 Michael Fuchs New Issue
2017-09-20 12:31 Michael Fuchs File Added: addlist.patch
2017-09-20 12:31 Michael Fuchs Note Added: 0102939
2017-09-20 16:24 Michael Van Canneyt Fixed in Revision => 37268
2017-09-20 16:24 Michael Van Canneyt Note Added: 0102945
2017-09-20 16:24 Michael Van Canneyt Status new => resolved
2017-09-20 16:24 Michael Van Canneyt Fixed in Version => 3.1.1
2017-09-20 16:24 Michael Van Canneyt Resolution open => fixed
2017-09-20 16:24 Michael Van Canneyt Assigned To => Michael Van Canneyt
2017-09-20 16:24 Michael Van Canneyt Target Version => 3.2.0