Преглед на файлове

* Overloaded AddStrings

git-svn-id: trunk@20691 -
michael преди 13 години
родител
ревизия
ab0a7d096c
променени са 2 файла, в които са добавени 16 реда и са изтрити 1 реда
  1. 2 1
      rtl/objpas/classes/classesh.inc
  2. 14 0
      rtl/objpas/classes/stringl.inc

+ 2 - 1
rtl/objpas/classes/classesh.inc

@@ -606,7 +606,8 @@ type
     function Add(const S: string): Integer; virtual;
     function AddObject(const S: string; AObject: TObject): Integer; virtual;
     procedure Append(const S: string);
-    procedure AddStrings(TheStrings: TStrings); virtual;
+    procedure AddStrings(TheStrings: TStrings); overload; virtual;
+    procedure AddStrings(const TheStrings: array of string); overload; virtual;
     procedure Assign(Source: TPersistent); override;
     procedure BeginUpdate;
     procedure Clear; virtual; abstract;

+ 14 - 0
rtl/objpas/classes/stringl.inc

@@ -603,7 +603,21 @@ begin
   end;
 end;
 
+Procedure TStrings.AddStrings(const TheStrings: array of string);
 
+Var Runner : longint;
+
+begin
+  try
+    beginupdate;
+    if Count + High(TheStrings)+1 > Capacity then
+      Capacity := Count + High(TheStrings)+1;
+    For Runner:=Low(TheStrings) to High(TheStrings) do
+      self.Add(Thestrings[Runner]);
+  finally
+    EndUpdate;
+  end;
+end;
 
 Procedure TStrings.Assign(Source: TPersistent);