codetools: renamed TStandardCodeTool.AddIncludeDirective

git-svn-id: trunk@32121 -
This commit is contained in:
mattias 2011-08-30 16:37:31 +00:00
parent 6608134915
commit caa300bdcf
3 changed files with 22 additions and 6 deletions

View File

@ -350,6 +350,8 @@ type
out NewCode: TCodeBuffer; out NewX, NewY, NewTopLine: integer;
const Filename: string = ''; SearchInCleanSrc: boolean = true): boolean;
function AddIncludeDirective(Code: TCodeBuffer; const Filename: string;
const NewSrc: string = ''): boolean; deprecated;
function AddIncludeDirectiveForInit(Code: TCodeBuffer; const Filename: string;
const NewSrc: string = ''): boolean;
function RemoveDirective(Code: TCodeBuffer; NewX, NewY: integer;
RemoveEmptyIFs: boolean): boolean;
@ -3051,16 +3053,21 @@ begin
end;
function TCodeToolManager.AddIncludeDirective(Code: TCodeBuffer;
const Filename: string; const NewSrc: string
): boolean;
const Filename: string; const NewSrc: string): boolean;
begin
Result:=AddIncludeDirectiveForInit(Code,Filename,NewSrc);
end;
function TCodeToolManager.AddIncludeDirectiveForInit(Code: TCodeBuffer;
const Filename: string; const NewSrc: string): boolean;
begin
Result:=false;
{$IFDEF CTDEBUG}
DebugLn('TCodeToolManager.AddIncludeDirective A ',Code.Filename,' Filename=',Filename);
DebugLn('TCodeToolManager.AddIncludeDirectiveForInit A ',Code.Filename,' Filename=',Filename);
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.AddIncludeDirective(Filename,SourceChangeCache,NewSrc);
Result:=FCurCodeTool.AddIncludeDirectiveForInit(Filename,SourceChangeCache,NewSrc);
except
on e: Exception do Result:=HandleException(e);
end;

View File

@ -253,6 +253,9 @@ type
out NewPos: TCodeXYPosition; out NewTopLine: integer;
const Filename: string = ''): boolean;
function AddIncludeDirective(const Filename: string;
SourceChangeCache: TSourceChangeCache; const NewSrc: string = ''
): boolean; deprecated;
function AddIncludeDirectiveForInit(const Filename: string;
SourceChangeCache: TSourceChangeCache; const NewSrc: string = ''
): boolean;
function FixIncludeFilenames(Code: TCodeBuffer;
@ -6181,6 +6184,12 @@ end;
function TStandardCodeTool.AddIncludeDirective(const Filename: string;
SourceChangeCache: TSourceChangeCache; const NewSrc: string): boolean;
begin
Result:=AddIncludeDirectiveForInit(Filename,SourceChangeCache,NewSrc);
end;
function TStandardCodeTool.AddIncludeDirectiveForInit(const Filename: string;
SourceChangeCache: TSourceChangeCache; const NewSrc: string): boolean;
var
ANode: TCodeTreeNode;
Indent: LongInt;

View File

@ -633,7 +633,7 @@ begin
if FLrsIncludeAllowed and HasLazarusResources then
begin
//debugln(['TProjectResources.UpdateMainSourceFile include directive not found: FCanHaveLrsInclude=',FLrsIncludeAllowed,' HasLazarusResources=',HasLazarusResources]);
if not CodeToolBoss.AddIncludeDirective(CodeBuf,
if not CodeToolBoss.AddIncludeDirectiveForInit(CodeBuf,
Filename,'') then
begin
Result := False;
@ -710,7 +710,7 @@ begin
Messages.Add('Could not remove "{$I '+ oldLrsFileName +'"} from main source!');
Exit;
end;
if not CodeToolBoss.AddIncludeDirective(CodeBuf, newLrsFileName, '') then
if not CodeToolBoss.AddIncludeDirectiveForInit(CodeBuf, newLrsFileName, '') then
begin
Result := False;
debugln(['TProjectResources.RenameDirectives adding include directive to main source failed']);