123456789101112131415161718192021222324252627282930313233343536373839404142 |
- /*
- * 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);
- [[maybe_unused]] bool unsubscribe(const ls::std::event::Event &_event);
- 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);
- [[nodiscard]] bool _unsubscribe(const ls::std::event::Event &_event);
- };
- }
- #endif
|