- Timestamp:
- Sep 8, 2012, 9:28:39 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 backup 4 4 tunneler.exe 5 heaptrclog.trc
-
- Property svn:ignore
-
trunk/Components/TemplateGenerics
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
trunk/Components/TemplateGenerics/Specialized/SpecializedList.pas
r29 r30 80 80 {$DEFINE TGListIndex := Integer} 81 81 {$DEFINE TGListItem := Byte} 82 {$DEFINE TGList := TListByte }82 {$DEFINE TGList := TListByteBase} 83 83 {$DEFINE TGListSortCompare := TListByteSortCompare} 84 84 {$DEFINE TGListToStringConverter := TListByteToStringConverter} … … 87 87 {$DEFINE INTERFACE} 88 88 {$I 'GenericList.inc'} 89 90 TListByte = class(TListByteBase) 91 procedure WriteToStream(Stream: TStream); 92 procedure WriteToStreamPart(Stream: TStream; ItemIndex, ItemCount: TGListIndex); 93 procedure ReplaceStream(Stream: TStream); 94 procedure ReplaceStreamPart(Stream: TStream; ItemIndex, ItemCount: TGListIndex); 95 procedure AddStream(Stream: TStream); 96 procedure AddStreamPart(Stream: TStream; ItemCount: TGListIndex); 97 procedure WriteBuffer(var Buffer; Count: Integer); 98 procedure ReadBuffer(var Buffer; Count: Integer); 99 end; 89 100 90 101 // TListChar<Integer, Char> … … 137 148 TListMethod = class(TListMethodBase) 138 149 procedure CallAll; 139 procedure CallNotifyEvents(Sender: TObject); 140 end; 150 end; 151 152 // TListNotifyEventBase<Integer, TNotifyEvent> 153 {$DEFINE TGListIndex := Integer} 154 {$DEFINE TGListItem := TNotifyEvent} 155 {$DEFINE TGList := TListNotifyEventBase} 156 {$DEFINE TGListSortCompare := TListNotifyEventSortCompare} 157 {$DEFINE TGListToStringConverter := TListNotifyEventToStringConverter} 158 {$DEFINE TGListFromStringConverter := TListNotifyEventFromStringConverter} 159 {$DEFINE TGListItemArray := TListNotifyEventItemArray} 160 {$DEFINE INTERFACE} 161 {$I 'GenericList.inc'} 162 163 // TListNotifyEvent<Integer, TNotifyEvent> 164 TListNotifyEvent = class(TListNotifyEventBase) 165 procedure CallAll(Sender: TObject); 166 end; 167 168 169 TBaseEvent = procedure of object; 170 171 // TListSimpleEventBase<Integer, TBaseEvent> 172 {$DEFINE TGListIndex := Integer} 173 {$DEFINE TGListItem := TBaseEvent} 174 {$DEFINE TGList := TListSimpleEventBase} 175 {$DEFINE TGListSortCompare := TListSimpleEventSortCompare} 176 {$DEFINE TGListToStringConverter := TListSimpleEventToStringConverter} 177 {$DEFINE TGListFromStringConverter := TListSimpleEventFromStringConverter} 178 {$DEFINE TGListItemArray := TListSimpleEventItemArray} 179 {$DEFINE INTERFACE} 180 {$I 'GenericList.inc'} 181 182 // TListSimpleEvent<Integer, TSimpleEvent> 183 TListSimpleEvent = class(TListSimpleEventBase) 184 procedure CallAll; 185 end; 186 141 187 142 188 function StrToStr(Value: string): string; … … 216 262 {$DEFINE TGListIndex := Integer} 217 263 {$DEFINE TGListItem := Byte} 218 {$DEFINE TGList := TListByte }264 {$DEFINE TGList := TListByteBase} 219 265 {$DEFINE TGListSortCompare := TListByteSortCompare} 220 266 {$DEFINE TGListToStringConverter := TListByteToStringConverter} … … 258 304 {$I 'GenericList.inc'} 259 305 306 // TListNotifyEventBase<Integer, TNotifyEvent> 307 {$DEFINE TGListIndex := Integer} 308 {$DEFINE TGListItem := TNotifyEvent} 309 {$DEFINE TGList := TListNotifyEventBase} 310 {$DEFINE TGListSortCompare := TListNotifyEventSortCompare} 311 {$DEFINE TGListToStringConverter := TListNotifyEventToStringConverter} 312 {$DEFINE TGListFromStringConverter := TListNotifyEventFromStringConverter} 313 {$DEFINE TGListItemArray := TListNotifyEventItemArray} 314 {$DEFINE IMPLEMENTATION} 315 {$I 'GenericList.inc'} 316 317 // TListSimpleEventBase<Integer, TBaseEvent> 318 {$DEFINE TGListIndex := Integer} 319 {$DEFINE TGListItem := TBaseEvent} 320 {$DEFINE TGList := TListSimpleEventBase} 321 {$DEFINE TGListSortCompare := TListSimpleEventSortCompare} 322 {$DEFINE TGListToStringConverter := TListSimpleEventToStringConverter} 323 {$DEFINE TGListFromStringConverter := TListSimpleEventFromStringConverter} 324 {$DEFINE TGListItemArray := TListSimpleEventItemArray} 325 {$DEFINE IMPLEMENTATION} 326 {$I 'GenericList.inc'} 327 328 260 329 261 330 function StrToStr(Value: string): string; … … 263 332 Result := Value; 264 333 end; 334 335 { TListSimpleEvent } 336 337 procedure TListSimpleEvent.CallAll; 338 var 339 I: TGListIndex; 340 begin 341 I := 0; 342 while (I < Count) do begin 343 TBaseEvent(Items[I])(); 344 I := I + 1; 345 end; 346 end; 347 265 348 266 349 { TListChar } … … 323 406 end; 324 407 325 procedure TList Method.CallNotifyEvents(Sender: TObject);408 procedure TListNotifyEvent.CallAll(Sender: TObject); 326 409 var 327 410 I: TGListIndex; … … 334 417 end; 335 418 419 { TListByte } 420 421 procedure TListByte.WriteToStream(Stream: TStream); 422 var 423 I: Integer; 424 begin 425 Stream.Position := 0; 426 I := 0; 427 while I < Count do begin 428 Stream.WriteByte(Items[I]); 429 I := I + 1; 430 end; 431 end; 432 433 procedure TListByte.WriteToStreamPart(Stream: TStream; ItemIndex, ItemCount: Integer); 434 var 435 I: Integer; 436 begin 437 I := ItemIndex; 438 while I < ItemCount do begin 439 Stream.WriteByte(Items[I]); 440 I := I + 1; 441 end; 442 end; 443 444 procedure TListByte.ReplaceStream(Stream: TStream); 445 var 446 I: Integer; 447 begin 448 Stream.Position := 0; 449 I := 0; 450 while I < Count do begin 451 Items[I] := Stream.ReadByte; 452 I := I + 1; 453 end; 454 end; 455 456 procedure TListByte.ReplaceStreamPart(Stream: TStream; ItemIndex, 457 ItemCount: Integer); 458 var 459 I: Integer; 460 begin 461 I := ItemIndex; 462 while I < ItemCount do begin 463 Items[I] := Stream.ReadByte; 464 I := I + 1; 465 end; 466 end; 467 468 procedure TListByte.AddStream(Stream: TStream); 469 var 470 I: Integer; 471 begin 472 Stream.Position := 0; 473 I := Count; 474 Count := Count + Stream.Size; 475 while I < Count do begin 476 Items[I] := Stream.ReadByte; 477 I := I + 1; 478 end; 479 end; 480 481 procedure TListByte.AddStreamPart(Stream: TStream; ItemCount: Integer); 482 var 483 I: Integer; 484 begin 485 I := Count; 486 Count := Count + ItemCount; 487 while I < Count do begin 488 Items[I] := Stream.ReadByte; 489 I := I + 1; 490 end; 491 end; 492 493 procedure TListByte.WriteBuffer(var Buffer; Count: Integer); 494 begin 495 496 end; 497 498 procedure TListByte.ReadBuffer(var Buffer; Count: Integer); 499 begin 500 501 end; 502 336 503 end.
Note:
See TracChangeset
for help on using the changeset viewer.