aboutsummaryrefslogtreecommitdiff
path: root/src/game/statusline_subscriber_adapter.hpp
blob: d53ae04a413977ac3880d235f8c51b6ef9cdc71b (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/statusline.hpp"
#include "interfaces/statusline_subscriber_adapter.hpp"
#include "interfaces/subscriber.hpp"

#include <memory>
#include <string>
#include <vector>

template <typename Context>
class StatusLineSubscriberAdapter : public ISubscriber<Context>
{
public:
	StatusLineSubscriberAdapter(
		std::shared_ptr<IStatusManager> status_manager,
		std::string (*format_func)(std::size_t section_index, const Context &context),
		const std::vector<StatusLineSection> &sections
	) noexcept;

	void update(const Context &context) noexcept override;

private:
	std::shared_ptr<IStatusManager> _status_manager;

	std::string (*_format_func)(std::size_t section_index, const Context &context);
	std::vector<StatusLineSection> _sections;
};

#include "statusline_subscriber_adapter.tpp"