Changeset 522 for GraphicTest/Packages/Graphics32/GR32_Containers.pas
- Timestamp:
- Apr 17, 2019, 10:42:18 AM (5 years ago)
- Location:
- GraphicTest/Packages/Graphics32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/Graphics32
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
GraphicTest/Packages/Graphics32/GR32_Containers.pas
r450 r522 40 40 uses 41 41 {$IFDEF FPC} 42 Types,43 42 {$IFDEF Windows} 44 43 Windows, 44 {$ELSE} 45 Types, 45 46 {$ENDIF} 46 47 {$ELSE} 47 Windows,48 Types, Windows, 48 49 {$ENDIF} 49 50 RTLConsts, 50 GR32, SysUtils, GR32_LowLevel,Classes, TypInfo;51 GR32, SysUtils, Classes, TypInfo; 51 52 52 53 const … … 180 181 function First: TClass; 181 182 function Last: TClass; 182 function Find( AClassName: string): TClass;183 function Find(const AClassName: string): TClass; 183 184 procedure GetClassNames(Strings: TStrings); 184 185 procedure Insert(Index: Integer; AClass: TClass); … … 231 232 implementation 232 233 234 uses 235 GR32_LowLevel; 236 233 237 procedure SmartAssign(Src, Dst: TPersistent; TypeKinds: TTypeKinds = tkProperties); 234 238 var … … 247 251 Count := GetPropList(Src.ClassInfo, TypeKinds, Props, False); 248 252 253 {$IFNDEF NEXTGEN} 249 254 for I := 0 to Count - 1 do 250 255 with Props^[I]^ do … … 262 267 SetPropValue(Dst, string(Name), GetPropValue(Src, string(Name), True)); 263 268 end; 269 {$ENDIF} 264 270 finally 265 271 FreeMem(Props, Count * SizeOf(PPropInfo)); … … 422 428 I: Integer; 423 429 begin 430 {$IFDEF HAS_NATIVEINT} 431 BucketIndex := NativeUInt(Item) shr 8 and BUCKET_MASK; // KISS pointer hash(TM) 432 {$ELSE} 424 433 BucketIndex := Cardinal(Item) shr 8 and BUCKET_MASK; // KISS pointer hash(TM) 434 {$ENDIF} 425 435 // due to their randomness, pointers most commonly differ at byte 1, we use 426 436 // this characteristic for our hash and just apply the mask to it. … … 444 454 begin 445 455 if not Exists(Item, BucketIndex, ItemIndex) then 456 {$IFDEF FPC} 457 raise EListError.CreateFmt(SItemNotFound, [Item]) 458 {$ELSE} 459 {$IFDEF HAS_NATIVEINT} 460 raise EListError.CreateFmt(SItemNotFound, [NativeInt(Item)]) 461 {$ELSE} 446 462 raise EListError.CreateFmt(SItemNotFound, [Integer(Item)]) 463 {$ENDIF} 464 {$ENDIF} 447 465 else 448 466 Result := FBuckets[BucketIndex].Items[ItemIndex].Data; … … 454 472 begin 455 473 if not Exists(Item, BucketIndex, ItemIndex) then 474 {$IFDEF FPC} 475 raise EListError.CreateFmt(SItemNotFound, [Item]) 476 {$ELSE} 477 {$IFDEF HAS_NATIVEINT} 478 raise EListError.CreateFmt(SItemNotFound, [NativeInt(Item)]) 479 {$ELSE} 456 480 raise EListError.CreateFmt(SItemNotFound, [Integer(Item)]) 481 {$ENDIF} 482 {$ENDIF} 457 483 else 458 484 FBuckets[BucketIndex].Items[ItemIndex].Data := Data; … … 644 670 end; 645 671 646 function TClassList.Find( AClassName: string): TClass;672 function TClassList.Find(const AClassName: string): TClass; 647 673 var 648 674 I: Integer;
Note:
See TracChangeset
for help on using the changeset viewer.