1
0
mirror of synced 2024-12-22 17:23:07 +01:00

Fixed: OwnsObject property and constructor parameter for ObjectHash

This commit is contained in:
Mark van Renswoude 2004-09-01 18:19:31 +00:00
parent 9abc76272c
commit f92c475873
2 changed files with 23 additions and 1 deletions

View File

@ -1134,7 +1134,7 @@ end;
{========================= TX2ObjectBTree {========================= TX2ObjectBTree
Item Management Item Management
========================================} ========================================}
constructor TX2ObjectBTree.Create; constructor TX2ObjectBTree.Create();
begin begin
inherited; inherited;

View File

@ -166,12 +166,19 @@ type
protected protected
procedure FreeHashItem(var AItem: PX2HashItem); override; procedure FreeHashItem(var AItem: PX2HashItem); override;
public public
constructor Create(); overload; override;
constructor Create(AOwnsObjects: Boolean); reintroduce; overload;
//:$ Gets or sets an item. //:$ Gets or sets an item.
property Items[Key: String]: TObject read GetItem property Items[Key: String]: TObject read GetItem
write SetItem; default; write SetItem; default;
//:$ Returns the value at the current cursor location. //:$ Returns the value at the current cursor location.
property CurrentValue: TObject read GetCurrentValue; property CurrentValue: TObject read GetCurrentValue;
//:$ Determines if objects are destroyed when they are removed
property OwnsObjects: Boolean read FOwnsObjects
write FOwnsObjects;
end; end;
implementation implementation
@ -599,6 +606,21 @@ end;
{========================== TX2ObjectHash {========================== TX2ObjectHash
Item Management Item Management
========================================} ========================================}
constructor TX2ObjectHash.Create();
begin
inherited;
FOwnsObjects := False;
end;
constructor TX2ObjectHash.Create(AOwnsObjects: Boolean);
begin
inherited Create();
FOwnsObjects := AOwnsObjects;
end;
function TX2ObjectHash.GetItem; function TX2ObjectHash.GetItem;
begin begin
Result := TObject(inherited GetItem(Key)); Result := TObject(inherited GetItem(Key));