aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/input.hpp
blob: 795ade22fdc9c5d4d98d8c2897524db32dd122fe (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
#pragma once

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

#include <cstddef>
#include <memory>

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;
};