From fb080f6fb911b1831c176a06259e384772541dd5 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 2 May 2022 22:36:21 +0200 Subject: refactor: seperate statusline related concerns --- src/game/statusline_subscriber_adapter.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/game/statusline_subscriber_adapter.hpp (limited to 'src/game/statusline_subscriber_adapter.hpp') diff --git a/src/game/statusline_subscriber_adapter.hpp b/src/game/statusline_subscriber_adapter.hpp new file mode 100644 index 0000000..d53ae04 --- /dev/null +++ b/src/game/statusline_subscriber_adapter.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "interfaces/statusline.hpp" +#include "interfaces/statusline_subscriber_adapter.hpp" +#include "interfaces/subscriber.hpp" + +#include +#include +#include + +template +class StatusLineSubscriberAdapter : public ISubscriber +{ +public: + StatusLineSubscriberAdapter( + std::shared_ptr status_manager, + std::string (*format_func)(std::size_t section_index, const Context &context), + const std::vector §ions + ) noexcept; + + void update(const Context &context) noexcept override; + +private: + std::shared_ptr _status_manager; + + std::string (*_format_func)(std::size_t section_index, const Context &context); + std::vector _sections; +}; + +#include "statusline_subscriber_adapter.tpp" -- cgit v1.2.3-18-g5258