From db219396ae0a3b3dfa5d92ee62b1c00d9164ba82 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 5 Apr 2019 11:42:16 +0000 Subject: [PATCH] IDEIntf: added TLazCompilationToolOptions.Parsers git-svn-id: trunk@60844 - --- components/ideintf/compoptsintf.pas | 46 ++++++++++++++++++++++ ide/compileroptions.pp | 59 ----------------------------- 2 files changed, 46 insertions(+), 59 deletions(-) diff --git a/components/ideintf/compoptsintf.pas b/components/ideintf/compoptsintf.pas index 757e2f6b3d..936ab46bf1 100644 --- a/components/ideintf/compoptsintf.pas +++ b/components/ideintf/compoptsintf.pas @@ -125,17 +125,24 @@ type FOwner: TLazCompilerOptions; FCommand: string; protected + FParsers: TStrings; FCompileReasons: TCompileReasons; + function GetHasParser(aParserName: string): boolean; virtual; + procedure SetHasParser(aParserName: string; const AValue: boolean); virtual; + procedure SetParsers(const AValue: TStrings); virtual; procedure SetCommand(AValue: string); virtual; procedure SetCompileReasons(const {%H-}AValue: TCompileReasons); virtual; public constructor Create(TheOwner: TLazCompilerOptions); virtual; + destructor Destroy; override; procedure Clear; virtual; procedure Assign(Src: TLazCompilationToolOptions); virtual; public property Owner: TLazCompilerOptions read FOwner; property Command: string read FCommand write SetCommand; property CompileReasons: TCompileReasons read FCompileReasons write SetCompileReasons; + property Parsers: TStrings read FParsers write SetParsers; + property HasParser[aParserName: string]: boolean read GetHasParser write SetHasParser; end; TLazCompilationToolClass = class of TLazCompilationToolOptions; @@ -472,12 +479,20 @@ constructor TLazCompilationToolOptions.Create(TheOwner: TLazCompilerOptions); begin FOwner:=TheOwner; FCompileReasons:=crAll; // This default can be used in some comparisons. + FParsers:=TStringList.Create; +end; + +destructor TLazCompilationToolOptions.Destroy; +begin + FreeAndNil(FParsers); + inherited Destroy; end; procedure TLazCompilationToolOptions.Clear; begin Command:=''; FCompileReasons := crAll; + FParsers.Clear; end; procedure TLazCompilationToolOptions.Assign(Src: TLazCompilationToolOptions); @@ -486,6 +501,37 @@ begin FCompileReasons := Src.CompileReasons; end; +function TLazCompilationToolOptions.GetHasParser(aParserName: string): boolean; +begin + Result:=FParsers.IndexOf(aParserName)>=0; +end; + +procedure TLazCompilationToolOptions.SetHasParser(aParserName: string; + const AValue: boolean); +var + i: Integer; +begin + i:=FParsers.IndexOf(aParserName); + if i>=0 then begin + if AValue then exit; + FParsers.Delete(i); + end else begin + if not AValue then exit; + FParsers.Add(aParserName); + end; + Owner.IncreaseChangeStamp; +end; + +procedure TLazCompilationToolOptions.SetParsers(const AValue: TStrings); +begin + if FParsers.Equals(AValue) then Exit; + {$IFDEF VerboseIDEModified} + debugln(['TCompilationToolOptions.SetParsers ',AValue.Text]); + {$ENDIF} + FParsers.Assign(AValue); + Owner.IncreaseChangeStamp; +end; + procedure TLazCompilationToolOptions.SetCommand(AValue: string); begin if FCommand=AValue then exit; diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 4e80771d19..c0736cf73a 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -335,19 +335,12 @@ type TCompilationToolOptions = class(TLazCompilationToolOptions) private - FParsers: TStrings; FParsedCommandStamp: integer; FParsedCommand: string; - function GetHasParser(aParserName: string): boolean; - procedure SetHasParser(aParserName: string; const AValue: boolean); - procedure SetParsers(const AValue: TStrings); protected procedure SetCommand(AValue: string); override; procedure SubstituteMacros(var s: string); virtual; public - constructor Create(TheOwner: TLazCompilerOptions); override; - destructor Destroy; override; - procedure Clear; override; function CreateDiff(CompOpts: TCompilationToolOptions; Tool: TCompilerDiffTool = nil): boolean; virtual; procedure Assign(Src: TLazCompilationToolOptions); override; @@ -359,9 +352,6 @@ type function CreateExtTool(const WorkingDir, ToolTitle, CompileHint: string): TAbstractExternalTool; function GetParsedCommand: string; // resolved macros function HasCommands: boolean; // true if there is something to execute - public - property Parsers: TStrings read FParsers write SetParsers; - property HasParser[aParserName: string]: boolean read GetHasParser write SetHasParser; end; TCompilerMsgIdFlag = record @@ -4206,37 +4196,6 @@ end; { TCompilationToolOptions } -function TCompilationToolOptions.GetHasParser(aParserName: string): boolean; -begin - Result:=FParsers.IndexOf(aParserName)>=0; -end; - -procedure TCompilationToolOptions.SetHasParser(aParserName: string; - const AValue: boolean); -var - i: Integer; -begin - i:=FParsers.IndexOf(aParserName); - if i>=0 then begin - if AValue then exit; - FParsers.Delete(i); - end else begin - if not AValue then exit; - FParsers.Add(aParserName); - end; - Owner.IncreaseChangeStamp; -end; - -procedure TCompilationToolOptions.SetParsers(const AValue: TStrings); -begin - if FParsers.Equals(AValue) then Exit; - {$IFDEF VerboseIDEModified} - debugln(['TCompilationToolOptions.SetParsers ',AValue.Text]); - {$ENDIF} - FParsers.Assign(AValue); - Owner.IncreaseChangeStamp; -end; - procedure TCompilationToolOptions.SetCommand(AValue: string); begin inherited SetCommand(AValue); @@ -4248,24 +4207,6 @@ begin IDEMacros.SubstituteMacros(s); end; -constructor TCompilationToolOptions.Create(TheOwner: TLazCompilerOptions); -begin - inherited Create(TheOwner); - FParsers:=TStringList.Create; -end; - -destructor TCompilationToolOptions.Destroy; -begin - FreeAndNil(FParsers); - inherited Destroy; -end; - -procedure TCompilationToolOptions.Clear; -begin - inherited Clear; - Parsers.Clear; -end; - procedure TCompilationToolOptions.Assign(Src: TLazCompilationToolOptions); begin inherited Assign(Src);