* Added AddReplacesExisting

git-svn-id: trunk@26728 -
This commit is contained in:
michael 2014-02-08 13:14:25 +00:00
parent b7c6455b89
commit 4490a61981

View File

@ -61,6 +61,7 @@ type
TStringHash = class
private
FAddReplacesExisting: Boolean;
FHashList : TFPDataHashTable;
public
constructor Create(ACapacity : Cardinal = 256);
@ -70,6 +71,7 @@ type
function Modify(const Key: string; Value: Integer): Boolean;
procedure Remove(const Key: string);
function ValueOf(const Key: string): Integer;
Property AddReplacesExisting : Boolean Read FAddReplacesExisting Write FAddReplacesExisting;
end;
{ THashedStringList }
@ -262,7 +264,8 @@ end;
procedure TStringHash.Add(const Key: string; Value: Integer);
begin
FHashList.Add(Key, Pointer(Value));
if Not (AddReplacesExisting and Modify(Key,Value)) then
FHashList.Add(Key, Pointer(Value));
end;
procedure TStringHash.Clear;