aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/input.hpp
blob: b71de677bc1afa04a6e0bc876f53a50526c2e355 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include "interfaces/publisher.hpp"
#include "interfaces/subscriber.hpp"

#include <cstddef>
#include <memory>

// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class IInputHandler : public IPublisher<char, std::nullptr_t>
{
public:
	using Event = char;
	using Context = std::nullptr_t;

	~IInputHandler() noexcept override = default;

	virtual void listen() const noexcept = 0;

	void subscribe(
		const Event &event,
		const std::shared_ptr<ISubscriber<Context>> &subscriber) noexcept override = 0;

	void notify_subscribers(const Event &event,
							const Context &context) const noexcept override = 0;

	virtual void enter_raw_mode() noexcept = 0;

	virtual void leave_raw_mode() noexcept = 0;
};