IDE: use const string when possible for reading / writing a project.

git-svn-id: trunk@45762 -
This commit is contained in:
juha 2014-07-03 11:51:01 +00:00
parent 399317698e
commit 40e463a9c2

View File

@ -130,8 +130,7 @@ type
procedure SetTypes(const AValue: TUnitCompDependencyTypes); procedure SetTypes(const AValue: TUnitCompDependencyTypes);
procedure SetUsedByUnit(const AValue: TUnitInfo); procedure SetUsedByUnit(const AValue: TUnitInfo);
public public
NextDependency, PrevDependency: NextDependency,PrevDependency: array[TUnitCompDependencyList] of TUnitComponentDependency;
array[TUnitCompDependencyList] of TUnitComponentDependency;
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure ClearComponentProperties; procedure ClearComponentProperties;
@ -2822,7 +2821,7 @@ end;
procedure TProject.LoadFromLPI; procedure TProject.LoadFromLPI;
const const
Path = 'ProjectOptions/'; Path = ProjOptionsPath;
begin begin
if (FFileVersion=0) and (FXMLConfig.GetValue(Path+'Units/Count',0)=0) then if (FFileVersion=0) and (FXMLConfig.GetValue(Path+'Units/Count',0)=0) then
if IDEMessageDialog(lisStrangeLpiFile, if IDEMessageDialog(lisStrangeLpiFile,
@ -2889,11 +2888,11 @@ begin
end; end;
procedure TProject.LoadFromSession; procedure TProject.LoadFromSession;
const
Path = 'ProjectSession/';
var var
Path: String;
pds: TPathDelimSwitch; pds: TPathDelimSwitch;
begin begin
Path:='ProjectSession/';
pds:=CheckPathDelim(FXMLConfig.GetValue(Path+'PathDelim/Value', '/'), pds:=CheckPathDelim(FXMLConfig.GetValue(Path+'PathDelim/Value', '/'),
fPathDelimChanged); fPathDelimChanged);
SessionStorePathDelim:=pds; SessionStorePathDelim:=pds;
@ -2967,17 +2966,19 @@ begin
try try
// get format // get format
fStorePathDelim:=CheckPathDelim(FXMLConfig.GetValue('ProjectOptions/PathDelim/Value','/'),fPathDelimChanged); fStorePathDelim:=CheckPathDelim(FXMLConfig.GetValue(ProjOptionsPath+'PathDelim/Value','/'),
fPathDelimChanged);
fCurStorePathDelim:=StorePathDelim; fCurStorePathDelim:=StorePathDelim;
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF}
FFileVersion:= FXMLConfig.GetValue('ProjectOptions/Version/Value',0); FFileVersion:= FXMLConfig.GetValue(ProjOptionsPath+'Version/Value',0);
if not FLoadParts then if not FLoadParts then
LoadFromLPI; LoadFromLPI;
// load MacroValues and compiler options // load MacroValues and compiler options
ClearBuildModes; ClearBuildModes;
BuildModes.LoadProjOptsFromXMLConfig(FXMLConfig, ProjOptionsPath); BuildModes.LoadProjOptsFromXMLConfig(FXMLConfig, ProjOptionsPath);
// load matrix options // load matrix options
BuildModes.SharedMatrixOptions.LoadFromXMLConfig(FXMLConfig, 'ProjectOptions/BuildModes/SharedMatrixOptions/'); BuildModes.SharedMatrixOptions.LoadFromXMLConfig(FXMLConfig,
ProjOptionsPath+'BuildModes/SharedMatrixOptions/');
finally finally
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject freeing xml');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject freeing xml');{$ENDIF}
fPathDelimChanged:=false; fPathDelimChanged:=false;
@ -3117,11 +3118,11 @@ begin
end; end;
procedure TProject.SaveToLPI; procedure TProject.SaveToLPI;
const
Path = ProjOptionsPath;
var var
Path: String;
CurFlags: TProjectWriteFlags; CurFlags: TProjectWriteFlags;
begin begin
Path:='ProjectOptions/';
// format // format
FXMLConfig.SetValue(Path+'Version/Value',ProjectInfoFileVersion); FXMLConfig.SetValue(Path+'Version/Value',ProjectInfoFileVersion);
FXMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[fCurStorePathDelim],'/'); FXMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[fCurStorePathDelim],'/');
@ -3191,10 +3192,9 @@ begin
end; end;
procedure TProject.SaveToSession; procedure TProject.SaveToSession;
var const
Path: String; Path = 'ProjectSession/';
begin begin
Path:='ProjectSession/';
fCurStorePathDelim:=SessionStorePathDelim; fCurStorePathDelim:=SessionStorePathDelim;
FXMLConfig.SetDeleteValue(Path+'PathDelim/Value', FXMLConfig.SetDeleteValue(Path+'PathDelim/Value',
PathDelimSwitchToDelim[fCurStorePathDelim],'/'); PathDelimSwitchToDelim[fCurStorePathDelim],'/');
@ -6546,26 +6546,22 @@ begin
FreeAndNil(FCompProps); FreeAndNil(FCompProps);
end; end;
function TUnitComponentDependency.NextUsedByDependency function TUnitComponentDependency.NextUsedByDependency: TUnitComponentDependency;
: TUnitComponentDependency;
begin begin
Result:=NextDependency[ucdlUsedBy]; Result:=NextDependency[ucdlUsedBy];
end; end;
function TUnitComponentDependency.PrevUsedByDependency function TUnitComponentDependency.PrevUsedByDependency: TUnitComponentDependency;
: TUnitComponentDependency;
begin begin
Result:=PrevDependency[ucdlUsedBy]; Result:=PrevDependency[ucdlUsedBy];
end; end;
function TUnitComponentDependency.NextRequiresDependency function TUnitComponentDependency.NextRequiresDependency: TUnitComponentDependency;
: TUnitComponentDependency;
begin begin
Result:=NextDependency[ucdlRequires]; Result:=NextDependency[ucdlRequires];
end; end;
function TUnitComponentDependency.PrevRequiresDependency function TUnitComponentDependency.PrevRequiresDependency: TUnitComponentDependency;
: TUnitComponentDependency;
begin begin
Result:=PrevDependency[ucdlRequires]; Result:=PrevDependency[ucdlRequires];
end; end;