Browse Source

* Added AddText as suggested in bug ID #24764

git-svn-id: trunk@25129 -
michael 12 years ago
parent
commit
4afefd6cbe
2 changed files with 15 additions and 2 deletions
  1. 2 0
      rtl/objpas/classes/classesh.inc
  2. 13 2
      rtl/objpas/classes/stringl.inc

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

@@ -627,6 +627,7 @@ type
     procedure SetQuoteChar(c:Char);
     procedure SetNameValueSeparator(c:Char);
     procedure WriteData(Writer: TWriter);
+    procedure DoSetTextStr(const Value: string; DoClear : Boolean);
   protected
     procedure DefineProperties(Filer: TFiler); override;
     procedure Error(const Msg: string; Data: Integer);
@@ -655,6 +656,7 @@ type
     procedure Append(const S: string);
     procedure AddStrings(TheStrings: TStrings); overload; virtual;
     procedure AddStrings(const TheStrings: array of string); overload; virtual;
+    Procedure AddText(Const S : String); virtual;
     procedure Assign(Source: TPersistent); override;
     procedure BeginUpdate;
     procedure Clear; virtual; abstract;

+ 13 - 2
rtl/objpas/classes/stringl.inc

@@ -557,7 +557,7 @@ begin
   Result:=True;
 end;
 
-Procedure TStrings.SetTextStr(const Value: string);
+Procedure TStrings.DoSetTextStr(const Value: string; DoClear : Boolean);
 
 Var
   S : String;
@@ -566,7 +566,8 @@ Var
 begin
   Try
     beginUpdate;
-    Clear;
+    if DoClear then
+      Clear;
     P:=1;
     While GetNextLine (Value,S,P) do
       Add(S);
@@ -575,7 +576,17 @@ begin
   end;
 end;
 
+Procedure TStrings.SetTextStr(const Value: string);
 
+begin
+  DoSetTextStr(Value,True);
+end;
+
+Procedure TStrings.AddText(const S: string);
+
+begin
+  DoSetTextStr(S,False);
+end;
 
 Procedure TStrings.SetUpdateState(Updating: Boolean);