Browse Source

* Merging revisions r43353 from trunk:
------------------------------------------------------------------------
r43353 | michael | 2019-11-02 11:25:42 +0100 (Sat, 02 Nov 2019) | 1 line

* Fix bug ID #0036246, delphi compatibility property
------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@43731 -

michael 5 years ago
parent
commit
00f800b0dd
2 changed files with 15 additions and 0 deletions
  1. 4 0
      rtl/objpas/classes/classesh.inc
  2. 11 0
      rtl/objpas/classes/stringl.inc

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

@@ -624,6 +624,7 @@ type
     function GetCommaText: string;
     function GetMissingNameValueSeparatorAction: TMissingNameValueSeparatorAction;
     function GetName(Index: Integer): string;
+    function GetTrailingLineBreak: Boolean;
     function GetValue(const Name: string): string;
     Function GetLBS : TTextLineBreakStyle;
     procedure SetDefaultEncoding(const ADefaultEncoding: TEncoding);
@@ -633,6 +634,7 @@ type
     procedure SetCommaText(const Value: string);
     procedure SetMissingNameValueSeparatorAction(AValue: TMissingNameValueSeparatorAction);
     procedure SetStringsAdapter(const Value: IStringsAdapter);
+    procedure SetTrailingLineBreak(AValue: Boolean);
     procedure SetValue(const Name, Value: string);
     procedure SetDelimiter(c:Char);
     procedure SetQuoteChar(c:Char);
@@ -732,6 +734,8 @@ type
     property Objects[Index: Integer]: TObject read GetObject write PutObject;
     property QuoteChar: Char read GetQuoteChar write SetQuoteChar;
     Property SkipLastLineBreak : Boolean Read GetSkipLastLineBreak Write SetSkipLastLineBreak;
+    // Same as SkipLastLineBreak but for Delphi compatibility. Note it has opposite meaning.
+    Property TrailingLineBreak : Boolean Read GetTrailingLineBreak Write SetTrailingLineBreak;
     Property StrictDelimiter : Boolean Read FStrictDelimiter Write FStrictDelimiter;
     property Strings[Index: Integer]: string read Get write Put; default;
     property StringsAdapter: IStringsAdapter read FAdapter write SetStringsAdapter;

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

@@ -163,6 +163,7 @@ begin
 end;
 
 
+
 Function TStrings.GetNameValueSeparator :Char;
 begin
   CheckSpecialChars;
@@ -292,6 +293,11 @@ begin
   GetNameValue(Index,Result,V);
 end;
 
+function TStrings.GetTrailingLineBreak: Boolean;
+begin
+  Result:=Not SkipLastLineBreak;
+end;
+
 Function TStrings.GetValue(const Name: string): string;
 
 Var
@@ -476,6 +482,11 @@ Procedure TStrings.SetStringsAdapter(const Value: IStringsAdapter);
 begin
 end;
 
+procedure TStrings.SetTrailingLineBreak(AValue: Boolean);
+begin
+  SkipLastLineBreak:=Not aValue;
+end;
+
 
 
 Procedure TStrings.SetDefaultEncoding(const ADefaultEncoding: TEncoding);