Skip to content

Commit

Permalink
Now using ExtendedPassthroughSubscriber in SystemExtensionComponent, …
Browse files Browse the repository at this point in the history
…to handle Args. #20
  • Loading branch information
bero committed Dec 7, 2024
1 parent d365812 commit 9bbd4f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Source/BoldHandles.pas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


{ Global compiler directives }
{$include bold.inc}
unit BoldHandles;
Expand Down Expand Up @@ -154,18 +154,18 @@ TBoldNonSystemHandle = class(TBoldElementHandle)
TBoldSystemExtensionComponent = class(TBoldHandle)
private
fStaticSystemHandle: TBoldAbstractSystemHandle;
fSubscriber: TBoldPassthroughSubscriber;
fSubscriber: TBoldExtendedPassthroughSubscriber;
function GetBoldSystem: TBoldSystem;
function GetSubscriber: TBoldPassthroughSubscriber;
function GetSubscriber: TBoldExtendedPassthroughSubscriber;
protected
procedure _Receive(Originator: TObject; OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent); virtual;
procedure _Receive(Originator: TObject; OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent; const Args: array of const); virtual;
function GetHandledObject: TObject; override;
function GetStaticSystemHandle: TBoldAbstractSystemHandle; virtual;
procedure SetStaticSystemHandle(Value: TBoldAbstractSystemHandle); virtual;
procedure StaticBoldTypeChanged; virtual;
procedure PlaceSubscriptions; virtual;
property BoldSystem: TBoldSystem read GetBoldSystem;
property Subscriber: TBoldPassthroughSubscriber read GetSubscriber;
property Subscriber: TBoldExtendedPassthroughSubscriber read GetSubscriber;
public
destructor Destroy; override;
published
Expand Down Expand Up @@ -647,10 +647,10 @@ function TBoldSystemExtensionComponent.GetStaticSystemHandle: TBoldAbstractSyste
result := fStaticSystemHandle;
end;

function TBoldSystemExtensionComponent.GetSubscriber: TBoldPassthroughSubscriber;
function TBoldSystemExtensionComponent.GetSubscriber: TBoldExtendedPassthroughSubscriber;
begin
if not Assigned(fSubscriber) then
fSubscriber := TBoldPassthroughSubscriber.Create(_Receive);
fSubscriber := TBoldExtendedPassthroughSubscriber.CreateWithExtendedReceive(_Receive);
result := fSubscriber;
end;

Expand Down Expand Up @@ -680,7 +680,7 @@ procedure TBoldSystemExtensionComponent.StaticBoldTypeChanged;
end;

procedure TBoldSystemExtensionComponent._Receive(Originator: TObject;
OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent);
OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent; const Args: array of const);
begin
Assert(RequestedEvent in [breFreeHandle, breValueIdentityChanged], IntToStr(OriginalEvent) + ',' + IntToStr(RequestedEvent));
case RequestedEvent of
Expand Down
4 changes: 2 additions & 2 deletions Source/BoldIndexableLoadedObjectsHandle.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TBoldIndexableLoadedObjectsHandle = class(TBoldSystemExtensionComponent)
private
fBoldIndexableLoadedObjectsList: TBoldIndexableLoadedObjectsList;
protected
procedure _Receive(Originator: TObject; OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent); override;
procedure _Receive(Originator: TObject; OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent; const Args: array of const); override;
function GetHandledObject: TObject; override;
public
destructor Destroy; override;
Expand Down Expand Up @@ -76,7 +76,7 @@ procedure TBoldIndexableLoadedObjectsHandle.InitializeIndexByNames(
end;

procedure TBoldIndexableLoadedObjectsHandle._Receive(Originator: TObject;
OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent);
OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent; const Args: array of const);
begin
if (Originator = StaticSystemHandle) and (OriginalEvent = beDestroying) then
FreeAndNil(fBoldIndexableLoadedObjectsList);
Expand Down

0 comments on commit 9bbd4f7

Please sign in to comment.