mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:26:15 +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(const AFileName: string; AOptions : TIniFileoptions = []); overload; override;
|
||||||
constructor Create(AStream: TStream; AOptions : TIniFileoptions = []); overload;
|
constructor Create(AStream: TStream; AOptions : TIniFileoptions = []); overload;
|
||||||
constructor Create(AStream: TStream; AEscapeLineFeeds : Boolean); overload; deprecated 'Use Options argument instead';
|
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;
|
destructor Destroy; override;
|
||||||
function ReadString(const Section, Ident, Default: string): string; override;
|
function ReadString(const Section, Ident, Default: string): string; override;
|
||||||
procedure WriteString(const Section, Ident, Value: String); override;
|
procedure WriteString(const Section, Ident, Value: String); override;
|
||||||
@ -948,6 +950,23 @@ begin
|
|||||||
Create(AStream,[]);
|
Create(AStream,[]);
|
||||||
end;
|
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);
|
constructor TIniFile.Create(AStream: TStream; AOptions: TIniFileoptions);
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -960,7 +979,7 @@ begin
|
|||||||
slLines := TStringList.Create;
|
slLines := TStringList.Create;
|
||||||
try
|
try
|
||||||
// read the ini file values
|
// read the ini file values
|
||||||
slLines.LoadFromStream(FStream);
|
slLines.LoadFromStream(FStream, FEncoding);
|
||||||
FillSectionList(slLines);
|
FillSectionList(slLines);
|
||||||
finally
|
finally
|
||||||
slLines.Free;
|
slLines.Free;
|
||||||
|
Loading…
Reference in New Issue
Block a user