Permalink
Browse files

published TDynArrayHashed.ElemPtr/ElemCopyAt methods for Unicode Delphi

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Nov 29, 2018
1 parent 9b5fea6 commit c91e420b67770aa0184c91673a79f805e0b55f26
Showing with 16 additions and 5 deletions.
  1. +13 −3 SynCommons.pas
  2. +2 −1 SynTable.pas
  3. +1 −1 SynopseCommit.inc
@@ -5212,6 +5212,8 @@ TDynArrayHashed = record
function KnownType: TDynArrayKind; inline;
procedure Clear; inline;
procedure ElemCopy(const A; var B); inline;
function ElemPtr(index: PtrInt): pointer; inline;
procedure ElemCopyAt(index: PtrInt; var Dest); inline;
// warning: you shall call ReHash() after manual Add/Delete
function Add(const Elem): integer; inline;
procedure Delete(aIndex: PtrInt); inline;
@@ -49350,6 +49352,14 @@ procedure TDynArrayHashed.ElemCopy(const A; var B);
begin
InternalDynArray.ElemCopy(A,B);
end;
function TDynArrayHashed.ElemPtr(index: PtrInt): pointer;
begin
result := InternalDynArray.ElemPtr(index);
end;
procedure TDynArrayHashed.ElemCopyAt(index: PtrInt; var Dest);
begin
InternalDynArray.ElemCopyAt(index,Dest);
end;
function TDynArrayHashed.KnownType: TDynArrayKind;
begin
result := InternalDynArray.KnownType;
@@ -59076,8 +59086,8 @@ function TSynDictionary.DeleteDeprecated: integer;
fSafe.Padding[DIC_TIMETIX].VInteger := now;
for i := fSafe.Padding[DIC_TIMECOUNT].VInteger-1 downto 0 do
if (now>fTimeOut[i]) and (fTimeOut[i]<>0) and
(not Assigned(fOnCanDelete) or fOnCanDelete(fKeys.{$ifdef UNDIRECTDYNARRAY}
InternalDynArray.{$endif}ElemPtr(i)^,fValues.ElemPtr(i)^,i)) then begin
(not Assigned(fOnCanDelete) or
fOnCanDelete(fKeys.ElemPtr(i)^,fValues.ElemPtr(i)^,i)) then begin
fKeys.Delete(i);
fValues.Delete(i);
fTimeOuts.Delete(i);
@@ -59218,7 +59228,7 @@ function TSynDictionary.InArray(const aKey, aArrayValue;
ndx := fKeys.FindHashed(aKey);
if ndx<0 then
exit;
nested.Init(fValues.ElemType, fValues.ElemPtr(ndx)^);
nested.Init(fValues.ElemType,fValues.ElemPtr(ndx)^);
case aAction of
iaFind:
result := nested.Find(aArrayValue)>=0;
@@ -107,7 +107,8 @@ function IsMatchString(const Pattern, Text: string; CaseInsensitive: boolean=fal
// - implemented as a fast brute-force state-machine without any heap allocation
// - some common patterns ('exactmatch', 'startwith*', '*endwith', '*contained*')
// are handled with dedicated code, optionally with case-insensitive search
// - consider using TMatchs if you expect to search for several patterns
// - consider using TMatchs (or SetMatchs/TMatchDynArray) if you expect to
// search for several patterns
{$ifdef UNICODE}TMatch = record{$else}TMatch = object{$endif}
private
Pattern, Text: PUTF8Char;
@@ -1 +1 @@
'1.18.4890'
'1.18.4891'

0 comments on commit c91e420

Please sign in to comment.