Forráskód Böngészése

Remove reworked status for new event based classes

Patrick-Christopher Mattulat 9 hónapja
szülő
commit
2f3d18093a

+ 6 - 7
CMakeLists.txt

@@ -181,7 +181,6 @@ set(SOURCE_FILES_CORE
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IBoxing.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEncoding.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEvaluator.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IEventSubscriber.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IListener.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/IReader.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/core/interface/ISerializable.cpp
@@ -205,9 +204,9 @@ set(SOURCE_FILES_ENCODING
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/encoding/Base64.cpp)
 
 set(SOURCE_FILES_EVENT
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/reworked/Event.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/reworked/EventListener.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/reworked/EventManager.cpp)
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/Event.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventListener.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/event/EventManager.cpp)
 
 set(SOURCE_FILES_IO
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/evaluator/FileExistenceEvaluator.cpp
@@ -337,9 +336,9 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/encoding/Base64Test.cpp)
 
     set(UNIT_TEST_FILES_EVENT
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/reworked/EventListenerTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/reworked/EventManagerTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/reworked/EventTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventListenerTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventManagerTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/OnClickEvent.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/Button.cpp)
 

+ 0 - 32
include/ls-std/core/interface/IEventSubscriber.hpp

@@ -1,32 +0,0 @@
-/*
- * Author:          Patrick-Christopher Mattulat
- * Company:         Lynar Studios
- * E-Mail:          webmaster@lynarstudios.com
- * Created:         2020-11-27
- * Changed:         2023-02-08
- *
- * */
-
-#ifndef LS_STD_I_EVENT_SUBSCRIBER_HPP
-#define LS_STD_I_EVENT_SUBSCRIBER_HPP
-
-#include "IListener.hpp"
-#include <ls-std/core/type/EventTypes.hpp>
-#include <ls-std/os/dynamic-goal.hpp>
-#include <memory>
-
-namespace ls::std::core::interface_type
-{
-  class LS_STD_DYNAMIC_GOAL IEventSubscriber
-  {
-    public:
-
-      IEventSubscriber();
-      virtual ~IEventSubscriber();
-
-      virtual void subscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener) = 0;
-      virtual void unsubscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener) = 0;
-  };
-}
-
-#endif

+ 0 - 27
include/ls-std/core/type/EventTypes.hpp

@@ -1,27 +0,0 @@
-/*
- * Author:          Patrick-Christopher Mattulat
- * Company:         Lynar Studios
- * E-Mail:          webmaster@lynarstudios.com
- * Created:         2020-11-26
- * Changed:         2023-05-17
- *
- * */
-
-#ifndef LS_STD_EVENT_TYPES_HPP
-#define LS_STD_EVENT_TYPES_HPP
-
-#include <functional>
-#include <map>
-#include <string>
-#include <vector>
-
-namespace ls::std::core::type
-{
-  using event_id = ::std::string;
-  using event_parameter_id = ::std::string;
-  using event_parameter_value = ::std::string;
-  using event_parameter = ::std::pair<::std::string, ::std::string>;
-  using event_parameter_list = ::std::map<ls::std::core::type::event_parameter_id, ls::std::core::type::event_parameter_value, ::std::less<>>;
-}
-
-#endif

+ 4 - 4
include/ls-std/event/reworked/Event.hpp → include/ls-std/event/Event.hpp

@@ -7,15 +7,15 @@
 *
 * */
 
-#ifndef LS_STD_EVENT_REWORKED_HPP
-#define LS_STD_EVENT_REWORKED_HPP
+#ifndef LS_STD_EVENT_HPP
+#define LS_STD_EVENT_HPP
 
 #include <ls-std/core/Class.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
 #include <memory>
 #include <string>
 
-namespace ls::std::event::reworked
+namespace ls::std::event
 {
   class LS_STD_DYNAMIC_GOAL Event : public ls::std::core::Class
   {
@@ -25,7 +25,7 @@ namespace ls::std::event::reworked
       ~Event() noexcept override;
 
       [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getManager() const;
-      [[nodiscard]] ls::std::event::reworked::Event of(const ::std::shared_ptr<ls::std::core::Class> &_manager) const;
+      [[nodiscard]] ls::std::event::Event of(const ::std::shared_ptr<ls::std::core::Class> &_manager) const;
       void setManager(const ::std::shared_ptr<ls::std::core::Class> &_manager);
 
     private:

+ 40 - 0
include/ls-std/event/EventListener.hpp

@@ -0,0 +1,40 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2024-05-16
+* Changed:         2024-05-17
+*
+* */
+
+#ifndef LS_STD_EVENT_LISTENER_HPP
+#define LS_STD_EVENT_LISTENER_HPP
+
+#include "Event.hpp"
+#include <ls-std/core/Class.hpp>
+#include <ls-std/event/type/EventTypes.hpp>
+#include <ls-std/os/dynamic-goal.hpp>
+
+namespace ls::std::event
+{
+  class LS_STD_DYNAMIC_GOAL EventListener : public ::std::enable_shared_from_this<EventListener>, public ls::std::core::Class
+  {
+    public:
+
+      explicit EventListener();
+      ~EventListener() noexcept override;
+
+      [[nodiscard]] ls::std::event::type::listener_id getId() const;
+      void setId(ls::std::event::type::listener_id _id);
+      [[maybe_unused]] bool subscribe(const ls::std::event::Event &_event, const ls::std::event::type::event_action &_action);
+
+    private:
+
+      ls::std::event::type::listener_id id{};
+
+      void _requestListenerId(const ::std::shared_ptr<ls::std::core::Class> &_manager);
+      [[nodiscard]] bool _subscribe(const ls::std::event::Event &_event, const ls::std::event::type::event_action &_action);
+  };
+}
+
+#endif

+ 53 - 0
include/ls-std/event/EventManager.hpp

@@ -0,0 +1,53 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2024-05-16
+* Changed:         2024-05-17
+*
+* */
+
+#ifndef LS_STD_EVENT_MANAGER_HPP
+#define LS_STD_EVENT_MANAGER_HPP
+
+#include "Event.hpp"
+#include "EventListener.hpp"
+#include <list>
+#include <ls-std/core/Class.hpp>
+#include <ls-std/event/type/EventTypes.hpp>
+#include <ls-std/os/dynamic-goal.hpp>
+#include <memory>
+#include <unordered_map>
+
+namespace ls::std::event::type
+{
+  using event_listeners = ::std::list<::std::pair<::std::shared_ptr<ls::std::event::EventListener>, ls::std::event::type::event_action>>;
+  using event_observability_inventory = ::std::unordered_map<::std::string, ls::std::event::type::event_listeners>;
+}
+
+namespace ls::std::event
+{
+  class LS_STD_DYNAMIC_GOAL EventManager : public ls::std::core::Class
+  {
+    public:
+
+      explicit EventManager();
+      ~EventManager() noexcept override;
+
+      [[nodiscard]] ls::std::event::type::listener_id getNextProvisionId() const;
+      [[nodiscard]] bool holdsListenerForEvent(ls::std::event::type::listener_id _id, const ls::std::event::Event &_event);
+      void invoke(const ls::std::event::Event &_event) const;
+      [[nodiscard]] ls::std::event::type::listener_id requestListenerId();
+      void subscribeListenerForEvent(::std::shared_ptr<ls::std::event::EventListener> _listener, const ls::std::event::Event &_event, ls::std::event::type::event_action _action);
+
+    private:
+
+      ls::std::event::type::event_observability_inventory inventory{};
+      ls::std::event::type::listener_id provisionId = 1;
+
+      static void _notifyListeners(const ls::std::event::type::event_listeners &_listeners);
+      bool _observesEvent(const ls::std::event::Event &_event) const;
+  };
+}
+
+#endif

+ 0 - 40
include/ls-std/event/reworked/EventListener.hpp

@@ -1,40 +0,0 @@
-/*
-* Author:          Patrick-Christopher Mattulat
-* Company:         Lynar Studios
-* E-Mail:          webmaster@lynarstudios.com
-* Created:         2024-05-16
-* Changed:         2024-05-17
-*
-* */
-
-#ifndef LS_STD_EVENT_LISTENER_REWORKED_HPP
-#define LS_STD_EVENT_LISTENER_REWORKED_HPP
-
-#include <ls-std/core/Class.hpp>
-#include <ls-std/event/reworked/Event.hpp>
-#include <ls-std/event/reworked/type/EventTypes.hpp>
-#include <ls-std/os/dynamic-goal.hpp>
-
-namespace ls::std::event::reworked
-{
-  class LS_STD_DYNAMIC_GOAL EventListener : public ::std::enable_shared_from_this<EventListener>, public ls::std::core::Class
-  {
-    public:
-
-      explicit EventListener();
-      ~EventListener() noexcept override;
-
-      [[nodiscard]] ls::std::event::reworked::type::listener_id getId() const;
-      void setId(ls::std::event::reworked::type::listener_id _id);
-      [[maybe_unused]] bool subscribe(const ls::std::event::reworked::Event &_event, const ls::std::event::reworked::type::event_action &_action);
-
-    private:
-
-      ls::std::event::reworked::type::listener_id id{};
-
-      void _requestListenerId(const ::std::shared_ptr<ls::std::core::Class> &_manager);
-      [[nodiscard]] bool _subscribe(const ls::std::event::reworked::Event &_event, const ls::std::event::reworked::type::event_action &_action);
-  };
-}
-
-#endif

+ 0 - 53
include/ls-std/event/reworked/EventManager.hpp

@@ -1,53 +0,0 @@
-/*
-* Author:          Patrick-Christopher Mattulat
-* Company:         Lynar Studios
-* E-Mail:          webmaster@lynarstudios.com
-* Created:         2024-05-16
-* Changed:         2024-05-17
-*
-* */
-
-#ifndef LS_STD_EVENT_MANAGER_REWORKED_HPP
-#define LS_STD_EVENT_MANAGER_REWORKED_HPP
-
-#include "Event.hpp"
-#include "EventListener.hpp"
-#include <list>
-#include <ls-std/core/Class.hpp>
-#include <ls-std/event/reworked/type/EventTypes.hpp>
-#include <ls-std/os/dynamic-goal.hpp>
-#include <memory>
-#include <unordered_map>
-
-namespace ls::std::event::reworked::type
-{
-  using event_listeners = ::std::list<::std::pair<::std::shared_ptr<ls::std::event::reworked::EventListener>, ls::std::event::reworked::type::event_action>>;
-  using event_observability_inventory = ::std::unordered_map<::std::string, ls::std::event::reworked::type::event_listeners>;
-}
-
-namespace ls::std::event::reworked
-{
-  class LS_STD_DYNAMIC_GOAL EventManager : public ls::std::core::Class
-  {
-    public:
-
-      explicit EventManager();
-      ~EventManager() noexcept override;
-
-      [[nodiscard]] ls::std::event::reworked::type::listener_id getNextProvisionId() const;
-      [[nodiscard]] bool holdsListenerForEvent(ls::std::event::reworked::type::listener_id _id, const ls::std::event::reworked::Event &_event);
-      void invoke(const ls::std::event::reworked::Event &_event) const;
-      [[nodiscard]] ls::std::event::reworked::type::listener_id requestListenerId();
-      void subscribeListenerForEvent(::std::shared_ptr<ls::std::event::reworked::EventListener> _listener, const ls::std::event::reworked::Event &_event, ls::std::event::reworked::type::event_action _action);
-
-    private:
-
-      ls::std::event::reworked::type::event_observability_inventory inventory{};
-      ls::std::event::reworked::type::listener_id provisionId = 1;
-
-      static void _notifyListeners(const ls::std::event::reworked::type::event_listeners &_listeners);
-      bool _observesEvent(const ls::std::event::reworked::Event &_event) const;
-  };
-}
-
-#endif

+ 3 - 3
include/ls-std/event/reworked/type/EventTypes.hpp → include/ls-std/event/type/EventTypes.hpp

@@ -7,13 +7,13 @@
 *
 * */
 
-#ifndef LS_STD_EVENT_TYPES_REWORKED_HPP
-#define LS_STD_EVENT_TYPES_REWORKED_HPP
+#ifndef LS_STD_EVENT_TYPES_HPP
+#define LS_STD_EVENT_TYPES_HPP
 
 #include <cstdint>
 #include <functional>
 
-namespace ls::std::event::reworked::type
+namespace ls::std::event::type
 {
   using event_action = ::std::function<void()>;
   using listener_id = uint32_t;

+ 0 - 2
include/ls-std/ls-std-core.hpp

@@ -31,7 +31,6 @@
 
 #include <ls-std/core/interface/IBoxing.hpp>
 #include <ls-std/core/interface/IEncoding.hpp>
-#include <ls-std/core/interface/IEventSubscriber.hpp>
 #include <ls-std/core/interface/IListener.hpp>
 #include <ls-std/core/interface/IReader.hpp>
 #include <ls-std/core/interface/ISerializable.hpp>
@@ -39,7 +38,6 @@
 #include <ls-std/core/interface/IValidator.hpp>
 #include <ls-std/core/interface/IWriter.hpp>
 
-#include <ls-std/core/type/EventTypes.hpp>
 #include <ls-std/core/type/RawPointer.hpp>
 #include <ls-std/core/type/Types.hpp>
 

+ 5 - 5
include/ls-std/ls-std-event.hpp

@@ -3,17 +3,17 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-05-14
- * Changed:         2024-05-16
+ * Changed:         2024-05-17
  *
  * */
 
 #ifndef LS_STD_LS_STD_EVENT_HPP
 #define LS_STD_LS_STD_EVENT_HPP
 
-#include <ls-std/event/reworked/type/EventTypes.hpp>
+#include <ls-std/event/type/EventTypes.hpp>
 
-#include <ls-std/event/reworked/Event.hpp>
-#include <ls-std/event/reworked/EventListener.hpp>
-#include <ls-std/event/reworked/EventManager.hpp>
+#include <ls-std/event/Event.hpp>
+#include <ls-std/event/EventListener.hpp>
+#include <ls-std/event/EventManager.hpp>
 
 #endif

+ 0 - 16
source/ls-std/core/interface/IEventSubscriber.cpp

@@ -1,16 +0,0 @@
-/*
- * Author:          Patrick-Christopher Mattulat
- * Company:         Lynar Studios
- * E-Mail:          webmaster@lynarstudios.com
- * Created:         2023-02-04
- * Changed:         2023-02-23
- *
- * */
-
-#include <ls-std/core/interface/IEventSubscriber.hpp>
-
-using ls::std::core::interface_type::IEventSubscriber;
-
-IEventSubscriber::IEventSubscriber() = default;
-
-IEventSubscriber::~IEventSubscriber() = default;

+ 4 - 4
source/ls-std/event/reworked/Event.cpp → source/ls-std/event/Event.cpp

@@ -3,16 +3,16 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2024-05-16
-* Changed:         2024-05-16
+* Changed:         2024-05-17
 *
 * */
 
-#include "ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp"
-#include <ls-std/event/reworked/Event.hpp>
+#include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
+#include <ls-std/event/Event.hpp>
 
 using ls::std::core::Class;
 using ls::std::core::NullPointerArgumentEvaluator;
-using ls::std::event::reworked::Event;
+using ls::std::event::Event;
 using ::std::shared_ptr;
 using ::std::string;
 

+ 7 - 7
source/ls-std/event/reworked/EventListener.cpp → source/ls-std/event/EventListener.cpp

@@ -8,16 +8,16 @@
 * */
 
 #include <ls-std/core/evaluator/NullPointerEvaluator.hpp>
-#include <ls-std/event/reworked/EventListener.hpp>
-#include <ls-std/event/reworked/EventManager.hpp>
+#include <ls-std/event/EventListener.hpp>
+#include <ls-std/event/EventManager.hpp>
 
 using ls::std::core::Class;
 using ls::std::core::NullPointerEvaluator;
-using ls::std::event::reworked::Event;
-using ls::std::event::reworked::EventListener;
-using ls::std::event::reworked::EventManager;
-using ls::std::event::reworked::type::event_action;
-using ls::std::event::reworked::type::listener_id;
+using ls::std::event::Event;
+using ls::std::event::EventListener;
+using ls::std::event::EventManager;
+using ls::std::event::type::event_action;
+using ls::std::event::type::listener_id;
 using ::std::dynamic_pointer_cast;
 using ::std::shared_ptr;
 

+ 8 - 8
source/ls-std/event/reworked/EventManager.cpp → source/ls-std/event/EventManager.cpp

@@ -8,18 +8,18 @@
 * */
 
 #include <ls-std/core/exception/EventNotHandledException.hpp>
-#include <ls-std/event/reworked/EventListener.hpp>
-#include <ls-std/event/reworked/EventManager.hpp>
+#include <ls-std/event/EventListener.hpp>
+#include <ls-std/event/EventManager.hpp>
 #include <utility>
 
 using ls::std::core::Class;
 using ls::std::core::EventNotHandledException;
-using ls::std::event::reworked::Event;
-using ls::std::event::reworked::EventListener;
-using ls::std::event::reworked::EventManager;
-using ls::std::event::reworked::type::event_action;
-using ls::std::event::reworked::type::event_listeners;
-using ls::std::event::reworked::type::listener_id;
+using ls::std::event::Event;
+using ls::std::event::EventListener;
+using ls::std::event::EventManager;
+using ls::std::event::type::event_action;
+using ls::std::event::type::event_listeners;
+using ls::std::event::type::listener_id;
 using ::std::make_pair;
 using ::std::move;
 using ::std::shared_ptr;

+ 2 - 2
test/cases/event/reworked/EventListenerTest.cpp → test/cases/event/EventListenerTest.cpp

@@ -14,8 +14,8 @@
 #include <memory>
 
 using ls::std::core::NullPointerException;
-using ls::std::event::reworked::EventListener;
-using ls::std::event::reworked::EventManager;
+using ls::std::event::EventListener;
+using ls::std::event::EventManager;
 using ::std::make_shared;
 using ::std::string;
 using test::event::Button;

+ 1 - 1
test/cases/event/reworked/EventManagerTest.cpp → test/cases/event/EventManagerTest.cpp

@@ -14,7 +14,7 @@
 #include <string>
 
 using ls::std::core::EventNotHandledException;
-using ls::std::event::reworked::EventManager;
+using ls::std::event::EventManager;
 using ::std::make_shared;
 using ::std::string;
 using test::event::Button;

+ 3 - 3
test/cases/event/reworked/EventTest.cpp → test/cases/event/EventTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2024-05-16
-* Changed:         2024-05-16
+* Changed:         2024-05-17
 *
 * */
 
@@ -12,8 +12,8 @@
 #include <ls-std/ls-std-event.hpp>
 
 using ls::std::core::IllegalArgumentException;
-using ls::std::event::reworked::Event;
-using ls::std::event::reworked::EventManager;
+using ls::std::event::Event;
+using ls::std::event::EventManager;
 using ::std::make_shared;
 using testing::Test;
 

+ 2 - 2
test/classes/event/Button.cpp

@@ -3,13 +3,13 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2024-05-16
-* Changed:         2024-05-16
+* Changed:         2024-05-17
 *
 * */
 
 #include "Button.hpp"
 
-using ls::std::event::reworked::EventListener;
+using ls::std::event::EventListener;
 using test::event::Button;
 
 Button::Button() : EventListener()

+ 2 - 2
test/classes/event/Button.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2024-05-16
-* Changed:         2024-05-16
+* Changed:         2024-05-17
 *
 * */
 
@@ -14,7 +14,7 @@
 
 namespace test::event
 {
-  class Button : public ls::std::event::reworked::EventListener
+  class Button : public ls::std::event::EventListener
   {
     public:
 

+ 2 - 2
test/classes/event/OnClickEvent.cpp

@@ -3,13 +3,13 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2024-05-16
-* Changed:         2024-05-16
+* Changed:         2024-05-17
 *
 * */
 
 #include "OnClickEvent.hpp"
 
-using ls::std::event::reworked::Event;
+using ls::std::event::Event;
 using test::event::OnClickEvent;
 
 OnClickEvent::OnClickEvent() : Event("OnClickEvent")

+ 3 - 3
test/classes/event/OnClickEvent.hpp

@@ -3,18 +3,18 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2024-05-16
-* Changed:         2024-05-16
+* Changed:         2024-05-17
 *
 * */
 
 #ifndef LS_STD_ON_CLICK_EVENT_HPP
 #define LS_STD_ON_CLICK_EVENT_HPP
 
-#include <ls-std/event/reworked/Event.hpp>
+#include <ls-std/event/Event.hpp>
 
 namespace test::event
 {
-  class OnClickEvent : public ls::std::event::reworked::Event
+  class OnClickEvent : public ls::std::event::Event
   {
     public: