mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 19:06:13 +02:00
* Fix bug ID #36837: add ToObjectArray, ToStTringArray and SetStrings
git-svn-id: trunk@44632 -
This commit is contained in:
parent
b599574a16
commit
0ff254e00f
@ -694,6 +694,10 @@ type
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
function ToObjectArray(aStart,aEnd : Integer) : TObjectDynArray; overload;
|
||||
function ToObjectArray: TObjectDynArray; overload;
|
||||
function ToStringArray(aStart,aEnd : Integer) : TStringDynArray; overload;
|
||||
function ToStringArray: TStringDynArray; overload;
|
||||
function Add(const S: string): Integer; virtual; overload;
|
||||
function AddObject(const S: string; AObject: TObject): Integer; virtual; overload;
|
||||
function Add(const Fmt : string; const Args : Array of const): Integer; overload;
|
||||
@ -704,6 +708,8 @@ type
|
||||
procedure AddStrings(TheStrings: TStrings; ClearFirst : Boolean); overload;
|
||||
procedure AddStrings(const TheStrings: array of string); overload; virtual;
|
||||
procedure AddStrings(const TheStrings: array of string; ClearFirst : Boolean); overload;
|
||||
procedure SetStrings(TheStrings: TStrings); overload; virtual;
|
||||
procedure SetStrings(TheStrings: array of string); overload; virtual;
|
||||
Procedure AddText(Const S : String); virtual;
|
||||
procedure AddCommaText(const S: String);
|
||||
procedure AddDelimitedText(const S: String; ADelimiter: char; AStrictDelimiter: Boolean); overload;
|
||||
|
@ -689,6 +689,7 @@ begin
|
||||
Exclude(FOptions,soUseLocale);
|
||||
end;
|
||||
|
||||
|
||||
procedure TStrings.SetWriteBOM(AValue: Boolean);
|
||||
begin
|
||||
if AValue then
|
||||
@ -1018,6 +1019,43 @@ begin
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
function TStrings.ToObjectArray: TObjectDynArray;
|
||||
|
||||
begin
|
||||
Result:=ToObjectArray(0,Count-1);
|
||||
end;
|
||||
|
||||
function TStrings.ToObjectArray(aStart,aEnd : Integer): TObjectDynArray;
|
||||
Var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
Result:=Nil;
|
||||
if aStart>aEnd then exit;
|
||||
SetLength(Result,aEnd-aStart+1);
|
||||
For I:=0 to Count-1 do
|
||||
Result[i]:=Objects[i];
|
||||
end;
|
||||
|
||||
function TStrings.ToStringArray: TStringDynArray;
|
||||
|
||||
begin
|
||||
Result:=ToStringArray(0,Count-1);
|
||||
end;
|
||||
|
||||
function TStrings.ToStringArray(aStart,aEnd : Integer): TStringDynArray;
|
||||
|
||||
Var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
Result:=Nil;
|
||||
if aStart>aEnd then exit;
|
||||
SetLength(Result,aEnd-aStart+1);
|
||||
For I:=0 to Count-1 do
|
||||
Result[i]:=Strings[i];
|
||||
end;
|
||||
|
||||
|
||||
constructor TStrings.Create;
|
||||
begin
|
||||
@ -1120,6 +1158,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TStrings.SetStrings(TheStrings: TStrings);
|
||||
|
||||
begin
|
||||
AddStrings(TheStrings,True);
|
||||
end;
|
||||
|
||||
procedure TStrings.SetStrings(TheStrings: array of string);
|
||||
|
||||
begin
|
||||
AddStrings(TheStrings,True);
|
||||
end;
|
||||
|
||||
Procedure TStrings.Assign(Source: TPersistent);
|
||||
|
||||
Var
|
||||
|
@ -64,6 +64,7 @@ type
|
||||
TShortIntDynArray = array of ShortInt;
|
||||
TSmallIntDynArray = array of SmallInt;
|
||||
TStringDynArray = array of AnsiString;
|
||||
TObjectDynArray = array of TObject;
|
||||
TWideStringDynArray = array of WideString;
|
||||
TWordDynArray = array of Word;
|
||||
TCurrencyArray = Array of currency;
|
||||
|
Loading…
Reference in New Issue
Block a user