* Some optimizations from Luiz Americo, bug ID #23678

git-svn-id: trunk@23900 -
This commit is contained in:
michael 2013-03-17 17:09:08 +00:00
parent 37ba6f9b27
commit daf98ff87d

View File

@ -94,9 +94,9 @@ Type
constructor Create(AItemClass: TCollectionItemClass); constructor Create(AItemClass: TCollectionItemClass);
Procedure Assign(Source : TPersistent); override; Procedure Assign(Source : TPersistent); override;
Function Add : TCustomWebAction; Function Add : TCustomWebAction;
Function ActionByName(AName : String) : TCustomWebAction; Function ActionByName(const AName : String) : TCustomWebAction;
Function FindAction(AName : String): TCustomWebAction; Function FindAction(const AName : String): TCustomWebAction;
Function IndexOfAction(AName : String) : Integer; Function IndexOfAction(const AName : String) : Integer;
Property OnGetAction : TGetActionEvent Read FOnGetAction Write FOnGetAction; Property OnGetAction : TGetActionEvent Read FOnGetAction Write FOnGetAction;
Property Actions[Index : Integer] : TCustomWebAction Read GetActions Write SetActions; Default; Property Actions[Index : Integer] : TCustomWebAction Read GetActions Write SetActions; Default;
Property DefActionWhenUnknown : Boolean read FDefActionWhenUnknown write FDefActionWhenUnknown; Property DefActionWhenUnknown : Boolean read FDefActionWhenUnknown write FDefActionWhenUnknown;
@ -201,9 +201,9 @@ Type
function GetModule(Index : Integer): TModuleItem; function GetModule(Index : Integer): TModuleItem;
procedure SetModule(Index : Integer; const AValue: TModuleItem); procedure SetModule(Index : Integer; const AValue: TModuleItem);
Public Public
Function FindModule(AModuleName : String) : TModuleItem; Function FindModule(const AModuleName : String) : TModuleItem;
Function ModuleByName(AModuleName : String) : TModuleItem; Function ModuleByName(const AModuleName : String) : TModuleItem;
Function IndexOfModule(AModuleName : String) : Integer; Function IndexOfModule(const AModuleName : String) : Integer;
Property Modules [Index : Integer]: TModuleItem Read GetModule Write SetModule;default; Property Modules [Index : Integer]: TModuleItem Read GetModule Write SetModule;default;
end; end;
@ -299,7 +299,7 @@ begin
Items[Index]:=AValue; Items[Index]:=AValue;
end; end;
function TModuleFactory.FindModule(AModuleName: String): TModuleItem; function TModuleFactory.FindModule(const AModuleName: String): TModuleItem;
Var Var
I : Integer; I : Integer;
@ -312,14 +312,14 @@ begin
Result:=GetModule(I); Result:=GetModule(I);
end; end;
function TModuleFactory.ModuleByName(AModuleName: String): TModuleItem; function TModuleFactory.ModuleByName(const AModuleName: String): TModuleItem;
begin begin
Result:=FindModule(AModuleName); Result:=FindModule(AModuleName);
If (Result=Nil) then If (Result=Nil) then
Raise EFPHTTPError.CreateFmt(SErrNosuchModule,[AModuleName]); Raise EFPHTTPError.CreateFmt(SErrNosuchModule,[AModuleName]);
end; end;
function TModuleFactory.IndexOfModule(AModuleName: String): Integer; function TModuleFactory.IndexOfModule(const AModuleName: String): Integer;
begin begin
Result:=Count-1; Result:=Count-1;
@ -559,14 +559,14 @@ begin
Result:=TCustomWebAction(Inherited Add); Result:=TCustomWebAction(Inherited Add);
end; end;
function TCustomWebActions.ActionByName(AName: String): TCustomWebAction; function TCustomWebActions.ActionByName(const AName: String): TCustomWebAction;
begin begin
Result:=FindAction(AName); Result:=FindAction(AName);
If (Result=Nil) then If (Result=Nil) then
Raise HTTPError.CreateFmt(SErrUnknownAction,[AName]); Raise HTTPError.CreateFmt(SErrUnknownAction,[AName]);
end; end;
function TCustomWebActions.FindAction(AName: String): TCustomWebAction; function TCustomWebActions.FindAction(const AName: String): TCustomWebAction;
Var Var
I : Integer; I : Integer;
@ -579,7 +579,7 @@ begin
Result:=Actions[I]; Result:=Actions[I];
end; end;
function TCustomWebActions.IndexOfAction(AName: String): Integer; function TCustomWebActions.IndexOfAction(const AName: String): Integer;
begin begin
Result:=Count-1; Result:=Count-1;