Skip to content

Commit c7ee903

Browse files
committed
moved TDictionaryOwnerships to Spring.pas
1 parent 8f34129 commit c7ee903

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Source/Base/Collections/Spring.Collections.pas

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ interface
4040
Spring;
4141

4242
const
43+
doOwnsKeys = Spring.doOwnsKeys;
44+
doOwnsValues = Spring.doOwnsValues;
45+
4346
caAdded = Spring.caAdded;
4447
caRemoved = Spring.caRemoved;
4548
caExtracted = Spring.caExtracted;
@@ -50,7 +53,7 @@ interface
5053
caReseted = Spring.caReset deprecated 'Use caReset instead';
5154

5255
type
53-
TDictionaryOwnerships = set of (doOwnsKeys, doOwnsValues);
56+
TDictionaryOwnerships = Spring.TDictionaryOwnerships;
5457

5558
TCollectionChangedAction = Spring.TCollectionChangedAction;
5659

Source/Base/Spring.pas

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,26 @@ TManagedInterfacedObject = class(TInterfacedObject)
490490
{$ENDREGION}
491491

492492

493+
{$REGION 'TDictionaryOwnerships}
494+
495+
/// <summary>
496+
/// Controls the ownership of objects stored in any associative collection.
497+
/// </summary>
498+
TDictionaryOwnerships = set of (
499+
/// <summary>
500+
/// Objects stored as key are being destroyed when removed
501+
/// </summary>
502+
doOwnsKeys,
503+
504+
/// <summary>
505+
/// Objects stored as value are being destroyed when removed
506+
/// </summary>
507+
doOwnsValues
508+
);
509+
510+
{$ENDREGION}
511+
512+
493513
{$REGION 'TCollectionChangedAction'}
494514

495515
/// <summary>
@@ -9328,7 +9348,7 @@ TWeakReferences = record
93289348
procedure TWeakReferences.Initialize;
93299349
begin
93309350
fLock := TCriticalSection.Create;
9331-
fWeakReferences := TObjectDictionary<Pointer, TList>.Create([doOwnsValues]);
9351+
fWeakReferences := TObjectDictionary<Pointer, TList>.Create([Generics.Collections.doOwnsValues]);
93329352
end;
93339353

93349354
procedure TWeakReferences.Finalize;

0 commit comments

Comments
 (0)