diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-02 22:36:21 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:58 +0200 |
commit | fb080f6fb911b1831c176a06259e384772541dd5 (patch) | |
tree | e18140e700cd974f84a5630f41fcb0b496b7e772 /src/game/statusline_subscriber_adapter.hpp | |
parent | 40d02748924aa7c48b04cf948204d8dacdfbbc74 (diff) |
refactor: seperate statusline related concerns
Diffstat (limited to 'src/game/statusline_subscriber_adapter.hpp')
-rw-r--r-- | src/game/statusline_subscriber_adapter.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
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 <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> §ions + ) 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" |