#pragma once #include "DI/auto_wirable.hpp" #include "interfaces/input.hpp" #include "interfaces/subscriber.hpp" #include #include #include #include class InputHandler : public IInputHandler, public AutoWirable { public: InputHandler() noexcept = default; void listen() const noexcept override; void subscribe(const Event &event, const std::shared_ptr> &subscriber) noexcept override; void notify_subscribers(const Event &event, const Context &context) const noexcept override; void enter_raw_mode() noexcept override; void leave_raw_mode() noexcept override; private: std::array>>, static_cast(CHAR_MAX * 2U)> _subscribers; std::shared_ptr _original_termios = nullptr; using _SubscribersSizeType = decltype(_subscribers)::size_type; static _SubscribersSizeType _event_as_index(const Event &event) noexcept; };