Changeset 105 for trunk/Packages/CoolWeb/WebServer/UWebApp.pas
- Timestamp:
- Oct 9, 2012, 1:58:45 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CoolWeb/WebServer/UWebApp.pas
r96 r105 24 24 TPageList = class(TListObject) 25 25 RootDir: string; 26 function FindByPage(Page: TWebPage): TRegistredPage; 26 27 function FindByName(Name: string): TRegistredPage; 27 procedure RegisterPage(Page Class: TWebPageClass; out Reference; Path: string);28 procedure UnregisterPage(Pa th: string);28 procedure RegisterPage(Page: TWebPage; Path: string); 29 procedure UnregisterPage(Page: TWebPage); 29 30 function ProducePage(HandlerData: THTTPHandlerData): Boolean; 30 31 end; … … 78 79 { TPageList } 79 80 81 function TPageList.FindByPage(Page: TWebPage): TRegistredPage; 82 var 83 I: Integer; 84 begin 85 I := 0; 86 while (I < Count) and (TRegistredPage(Items[I]).Page <> Page) do Inc(I); 87 if I < Count then Result := TRegistredPage(Items[I]) 88 else Result := nil; 89 end; 90 80 91 function TPageList.FindByName(Name: string): TRegistredPage; 81 92 var … … 117 128 end; 118 129 119 procedure TPageList.RegisterPage(PageClass: TWebPageClass; out Reference; 120 Path: string); 130 procedure TPageList.RegisterPage(Page: TWebPage; Path: string); 121 131 var 122 132 NewPage: TRegistredPage; … … 125 135 NewPage := TRegistredPage(AddNew(TRegistredPage.Create)); 126 136 // NewPage.Page := PageClass.Create(Self); 127 NewPage.Page := Page Class.Create(nil);137 NewPage.Page := Page; 128 138 NewPage.Name := Path; 129 TWebPage(Reference) := NewPage.Page; 130 end; 131 132 procedure TPageList.UnregisterPage(Path: string); 133 var 134 Page: TRegistredPage; 135 begin 136 Page := FindByName(Path); 137 Remove(Page); 139 end; 140 141 procedure TPageList.UnregisterPage(Page: TWebPage); 142 var 143 RegPage: TRegistredPage; 144 begin 145 RegPage := FindByPage(Page); 146 Remove(RegPage); 138 147 end; 139 148
Note:
See TracChangeset
for help on using the changeset viewer.