From 30a6f8174ab44c12ccdfb212a2f6895440581d1a Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Thu, 8 Aug 2024 19:53:10 +0200 Subject: + Add EventListenerInterface protocol + Also added EventListenerInterface as a public class. Signed-off-by: Amlal EL Mahrouss --- SCIKit/SCIBase.hxx | 12 ++++++++++++ SCIKit/SCM.drawio | 8 ++++---- SCIKit/scm.internal.inl | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/SCIKit/SCIBase.hxx b/SCIKit/SCIBase.hxx index 95eb5bb1..c2241715 100644 --- a/SCIKit/SCIBase.hxx +++ b/SCIKit/SCIBase.hxx @@ -68,6 +68,18 @@ public: virtual VoidPtr QueryInterface(UUID* p_uuid) = 0; }; +template +class EventListenerInterface final : public ClsID +{ +public: + explicit EventListenerInterface() = default; + virtual ~UnknownInterface() = default; + + EventListenerInterface& operator=(const EventListenerInterface&) = default; + EventListenerInterface(const EventListenerInterface&) = default; + + virtual EventListenerInterface& operator +=(FnSign arg) = 0; +}; #endif /// @note Part of NK loader API. diff --git a/SCIKit/SCM.drawio b/SCIKit/SCM.drawio index 978ebb6d..b4523fe2 100644 --- a/SCIKit/SCM.drawio +++ b/SCIKit/SCM.drawio @@ -1,13 +1,13 @@ - + - + @@ -19,8 +19,8 @@ - - + + diff --git a/SCIKit/scm.internal.inl b/SCIKit/scm.internal.inl index b4e8e7dd..6b3af973 100644 --- a/SCIKit/scm.internal.inl +++ b/SCIKit/scm.internal.inl @@ -65,3 +65,20 @@ inline SInt32 ScmReleaseClass(TCLS* cls) return 0; } + +template +protocol EventListenerInterface final : public ClsID +{ +public: + explicit EventListenerInterface() = default; + virtual ~UnknownInterface() = default; + + EventListenerInterface& operator=(const EventListenerInterface&) = default; + EventListenerInterface(const EventListenerInterface&) = default; + + virtual EventListenerInterface& operator +=(FnSign arg) + { + this->AddEvent(arg); + return *this; + } +}; -- cgit v1.2.3