mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 03:39:28 +02:00
* patch from Ondrej, mantis #33118, some constructor overloaded to ease initializing encoding
git-svn-id: trunk@38103 -
This commit is contained in:
parent
4015709d6b
commit
97ceb89ca8
@ -228,6 +228,8 @@ type
|
||||
constructor Create(const AFileName: string; AOptions : TIniFileoptions = []); overload; override;
|
||||
constructor Create(AStream: TStream; AOptions : TIniFileoptions = []); overload;
|
||||
constructor Create(AStream: TStream; AEscapeLineFeeds : Boolean); overload; deprecated 'Use Options argument instead';
|
||||
constructor Create(AStream: TStream; ADefaultEncoding: TEncoding; AOptions : TIniFileOptions = []);
|
||||
constructor Create(AStream: TStream; ADefaultEncoding: TEncoding; AOwnsEncoding: Boolean; AOptions : TIniFileOptions = []);
|
||||
destructor Destroy; override;
|
||||
function ReadString(const Section, Ident, Default: string): string; override;
|
||||
procedure WriteString(const Section, Ident, Value: String); override;
|
||||
@ -948,6 +950,23 @@ begin
|
||||
Create(AStream,[]);
|
||||
end;
|
||||
|
||||
constructor TIniFile.Create(AStream: TStream; ADefaultEncoding: TEncoding;
|
||||
AOwnsEncoding: Boolean; AOptions: TIniFileOptions);
|
||||
begin
|
||||
FEncoding := ADefaultEncoding;
|
||||
FOwnsEncoding := not TEncoding.IsStandardEncoding(FEncoding);
|
||||
Create(AStream, AOptions);
|
||||
end;
|
||||
|
||||
constructor TIniFile.Create(AStream: TStream; ADefaultEncoding: TEncoding;
|
||||
AOptions: TIniFileOptions);
|
||||
begin
|
||||
FEncoding := ADefaultEncoding;
|
||||
if FEncoding <> nil then
|
||||
FOwnsEncoding := not TEncoding.IsStandardEncoding(FEncoding);
|
||||
Create(AStream, AOptions);
|
||||
end;
|
||||
|
||||
constructor TIniFile.Create(AStream: TStream; AOptions: TIniFileoptions);
|
||||
|
||||
var
|
||||
@ -960,7 +979,7 @@ begin
|
||||
slLines := TStringList.Create;
|
||||
try
|
||||
// read the ini file values
|
||||
slLines.LoadFromStream(FStream);
|
||||
slLines.LoadFromStream(FStream, FEncoding);
|
||||
FillSectionList(slLines);
|
||||
finally
|
||||
slLines.Free;
|
||||
|
Loading…
Reference in New Issue
Block a user