mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-15 22:03:11 +02:00
jcf: reduce amount of hints
git-svn-id: trunk@17917 -
This commit is contained in:
parent
a1f5d77faa
commit
2c018868d2
@ -213,8 +213,8 @@ var
|
|||||||
|
|
||||||
function IsBreakToken(const pcToken: TSourceToken): Boolean;
|
function IsBreakToken(const pcToken: TSourceToken): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (lcToken.TokenType in leBreakTokens) or
|
Result := (pcToken.TokenType in leBreakTokens) or
|
||||||
((lcToken.TokenType = ttComment) and (lcToken.CommentStyle = eCompilerDirective));
|
((pcToken.TokenType = ttComment) and (pcToken.CommentStyle = eCompilerDirective));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -48,8 +48,8 @@ type
|
|||||||
procedure SetSection(const ps: string);
|
procedure SetSection(const ps: string);
|
||||||
|
|
||||||
public
|
public
|
||||||
procedure WriteToStream(const pcStream: TSettingsOutput); virtual;
|
procedure WriteToStream(const pcStream: TSettingsOutput); virtual; abstract;
|
||||||
procedure ReadFromStream(const pcStream: TSettingsInput); virtual;
|
procedure ReadFromStream(const pcStream: TSettingsInput); virtual; abstract;
|
||||||
|
|
||||||
property Section: string Read fsSection;
|
property Section: string Read fsSection;
|
||||||
end;
|
end;
|
||||||
@ -61,18 +61,4 @@ begin
|
|||||||
fsSection := ps;
|
fsSection := ps;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSetBase.WriteToStream(const pcStream: TSettingsOutput);
|
|
||||||
begin
|
|
||||||
// do nothing - here for override
|
|
||||||
Assert(False, 'Class ' + ClassName + ' must override TSetBase.WriteToStream');
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSetBase.ReadFromStream(const pcStream: TSettingsInput);
|
|
||||||
begin
|
|
||||||
// do nothing - here for override
|
|
||||||
Assert(False, 'Class ' + ClassName + ' must override TSetBase.ReadFromStream');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -64,6 +64,8 @@ type
|
|||||||
procedure Write(const psTagName: string; const pcValue: TStrings); override;
|
procedure Write(const psTagName: string; const pcValue: TStrings); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TSettingsInputRegistry }
|
||||||
|
|
||||||
TSettingsInputRegistry = class(TSettingsInput)
|
TSettingsInputRegistry = class(TSettingsInput)
|
||||||
private
|
private
|
||||||
fReg: TRegIniFile;
|
fReg: TRegIniFile;
|
||||||
@ -83,6 +85,7 @@ type
|
|||||||
function Read(const psTag: string): string; override;
|
function Read(const psTag: string): string; override;
|
||||||
function Read(const psTag, psDefault: string): string; override;
|
function Read(const psTag, psDefault: string): string; override;
|
||||||
function Read(const psTag: string; const piDefault: integer): integer; override;
|
function Read(const psTag: string; const piDefault: integer): integer; override;
|
||||||
|
function Read(const psTag: string; const pfDefault: double): double; override;
|
||||||
function Read(const psTag: string; const pbDefault: boolean): boolean; override;
|
function Read(const psTag: string; const pbDefault: boolean): boolean; override;
|
||||||
function Read(const psTag: string; const pcStrings: TStrings): boolean; override;
|
function Read(const psTag: string; const pcStrings: TStrings): boolean; override;
|
||||||
end;
|
end;
|
||||||
@ -242,6 +245,13 @@ begin
|
|||||||
Result := fReg.ReadInteger(fsSection, psTag, piDefault)
|
Result := fReg.ReadInteger(fsSection, psTag, piDefault)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSettingsInputRegistry.Read(const psTag: string;
|
||||||
|
const pfDefault: double): double;
|
||||||
|
begin
|
||||||
|
Assert(fReg <> nil);
|
||||||
|
Result := Str2Float(fReg.ReadString(fsSection, psTag, Float2Str(pfDefault)));
|
||||||
|
end;
|
||||||
|
|
||||||
function TSettingsInputRegistry.Read(const psTag: string;
|
function TSettingsInputRegistry.Read(const psTag: string;
|
||||||
const pbDefault: boolean): boolean;
|
const pbDefault: boolean): boolean;
|
||||||
begin
|
begin
|
||||||
|
@ -45,16 +45,16 @@ type
|
|||||||
TSettingsOutput = class(TObject)
|
TSettingsOutput = class(TObject)
|
||||||
private
|
private
|
||||||
public
|
public
|
||||||
procedure WriteXMLHeader; virtual;
|
procedure WriteXMLHeader; virtual; abstract;
|
||||||
|
|
||||||
procedure OpenSection(const psName: string); virtual;
|
procedure OpenSection(const psName: string); virtual; abstract;
|
||||||
procedure CloseSection(const psName: string); virtual;
|
procedure CloseSection(const psName: string); virtual; abstract;
|
||||||
|
|
||||||
procedure Write(const psTagName, psValue: string); overload; virtual;
|
procedure Write(const psTagName, psValue: string); overload; virtual; abstract;
|
||||||
procedure Write(const psTagName: string; const piValue: integer); overload; virtual;
|
procedure Write(const psTagName: string; const piValue: integer); overload; virtual; abstract;
|
||||||
procedure Write(const psTagName: string; const pbValue: boolean); overload; virtual;
|
procedure Write(const psTagName: string; const pbValue: boolean); overload; virtual; abstract;
|
||||||
procedure Write(const psTagName: string; const pdValue: double); overload; virtual;
|
procedure Write(const psTagName: string; const pdValue: double); overload; virtual; abstract;
|
||||||
procedure Write(const psTagName: string; const pcValue: TStrings); overload; virtual;
|
procedure Write(const psTagName: string; const pcValue: TStrings); overload; virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -89,20 +89,16 @@ type
|
|||||||
{ settings reading interface }
|
{ settings reading interface }
|
||||||
TSettingsInput = class(TObject)
|
TSettingsInput = class(TObject)
|
||||||
public
|
public
|
||||||
function ExtractSection(const psSection: string): TSettingsInput; virtual;
|
function ExtractSection(const psSection: string): TSettingsInput; virtual; abstract;
|
||||||
|
|
||||||
function HasTag(const psTag: string): boolean; virtual;
|
function HasTag(const psTag: string): boolean; virtual; abstract;
|
||||||
|
|
||||||
function Read(const psTag: string): string; overload; virtual;
|
function Read(const psTag: string): string; overload; virtual; abstract;
|
||||||
function Read(const psTag, psDefault: string): string; overload; virtual;
|
function Read(const psTag, psDefault: string): string; overload; virtual; abstract;
|
||||||
function Read(const psTag: string; const piDefault: integer): integer;
|
function Read(const psTag: string; const piDefault: integer): integer; overload; virtual; abstract;
|
||||||
overload; virtual;
|
function Read(const psTag: string; const pfDefault: double): double; overload; virtual; abstract;
|
||||||
function Read(const psTag: string; const pfDefault: double): double;
|
function Read(const psTag: string; const pbDefault: boolean): boolean; overload; virtual; abstract;
|
||||||
overload; virtual;
|
function Read(const psTag: string; const pcStrings: TStrings): boolean; overload; virtual; abstract;
|
||||||
function Read(const psTag: string; const pbDefault: boolean): boolean;
|
|
||||||
overload; virtual;
|
|
||||||
function Read(const psTag: string; const pcStrings: TStrings): boolean;
|
|
||||||
overload; virtual;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -138,14 +134,19 @@ type
|
|||||||
|
|
||||||
|
|
||||||
{ dummy impl that always returns the default }
|
{ dummy impl that always returns the default }
|
||||||
|
|
||||||
|
{ TSettingsInputDummy }
|
||||||
|
|
||||||
TSettingsInputDummy = class(TSettingsInput)
|
TSettingsInputDummy = class(TSettingsInput)
|
||||||
private
|
private
|
||||||
public
|
public
|
||||||
function ExtractSection(const psSection: string): TSettingsInput; override;
|
function ExtractSection(const psSection: string): TSettingsInput; override;
|
||||||
function HasTag(const psTag: string): boolean; override;
|
function HasTag(const psTag: string): boolean; override;
|
||||||
|
|
||||||
|
function Read(const psTag: string): string; override;
|
||||||
function Read(const psTag, psDefault: string): string; override;
|
function Read(const psTag, psDefault: string): string; override;
|
||||||
function Read(const psTag: string; const piDefault: integer): integer; override;
|
function Read(const psTag: string; const piDefault: integer): integer; override;
|
||||||
|
function Read(const psTag: string; const pfDefault: double): double; override;
|
||||||
function Read(const psTag: string; const pbDefault: boolean): boolean; override;
|
function Read(const psTag: string; const pbDefault: boolean): boolean; override;
|
||||||
function Read(const psTag: string; const pcStrings: TStrings): boolean; override;
|
function Read(const psTag: string; const pcStrings: TStrings): boolean; override;
|
||||||
end;
|
end;
|
||||||
@ -161,52 +162,6 @@ uses
|
|||||||
const
|
const
|
||||||
XML_HEADER = '<?xml version="1.0" ?>' + NativeLineBreak;
|
XML_HEADER = '<?xml version="1.0" ?>' + NativeLineBreak;
|
||||||
|
|
||||||
procedure TSettingsOutput.WriteXMLHeader;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.WriteXMLHeader must be overridden in class ' + ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TSettingsOutput.OpenSection(const psName: string);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.OpenSection must be overridden in class ' + ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSettingsOutput.CloseSection(const psName: string);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.CloseSection must be overridden in class ' + ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSettingsOutput.Write(const psTagName, psValue: string);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.Write (string) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSettingsOutput.Write(const psTagName: string; const piValue: integer);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.Write (int) must be overridden in class ' + ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSettingsOutput.Write(const psTagName: string; const pbValue: boolean);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.Write (boolean) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSettingsOutput.Write(const psTagName: string; const pdValue: double);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.Write (double) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSettingsOutput.Write(const psTagName: string; const pcValue: TStrings);
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsOutput.Write (TStrings) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{--------------------}
|
|
||||||
constructor TSettingsStreamOutput.Create(const psFileName: string);
|
constructor TSettingsStreamOutput.Create(const psFileName: string);
|
||||||
begin
|
begin
|
||||||
inherited Create();
|
inherited Create();
|
||||||
@ -297,64 +252,6 @@ begin
|
|||||||
Write(psTagName, pcValue.CommaText);
|
Write(psTagName, pcValue.CommaText);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
|
||||||
SettingsInput}
|
|
||||||
|
|
||||||
function TSettingsInput.ExtractSection(const psSection: string): TSettingsInput;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.ExtractSection must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.HasTag(const psTag: string): boolean;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.HasTag must be overridden in class ' + ClassName);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.Read(const psTag: string): string;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.GetValue(string) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := '';
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.Read(const psTag, psDefault: string): string;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.GetValue(string) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := '';
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.Read(const psTag: string; const piDefault: integer): integer;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.GetValue(integer) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.Read(const psTag: string; const pfDefault: double): double;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.GetValue(double) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := 0.0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.Read(const psTag: string; const pbDefault: boolean): boolean;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.GetValue(boolean) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSettingsInput.Read(const psTag: string; const pcStrings: TStrings): boolean;
|
|
||||||
begin
|
|
||||||
Assert(False, 'TSettingsInput.GetValue(TStrings) must be overridden in class ' +
|
|
||||||
ClassName);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
{-----------------------------------------------------------------------------
|
||||||
SettingsInputString }
|
SettingsInputString }
|
||||||
@ -539,6 +436,12 @@ begin
|
|||||||
Result := piDefault;
|
Result := piDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSettingsInputDummy.Read(const psTag: string;
|
||||||
|
const pfDefault: double): double;
|
||||||
|
begin
|
||||||
|
Result := pfDefault;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSettingsInputDummy.Read(const psTag, psDefault: string): string;
|
function TSettingsInputDummy.Read(const psTag, psDefault: string): string;
|
||||||
begin
|
begin
|
||||||
Result := psDefault;
|
Result := psDefault;
|
||||||
@ -554,6 +457,11 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSettingsInputDummy.Read(const psTag: string): string;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
|
|
||||||
function TSettingsInputDummy.Read(const psTag: string;
|
function TSettingsInputDummy.Read(const psTag: string;
|
||||||
const pbDefault: boolean): boolean;
|
const pbDefault: boolean): boolean;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user