blob: 1de459c5dedb2d6abbe292757d4ce826c7079282 (
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
31
|
#pragma once
#include "statusline_subscriber_adapter.hpp"
#include <utility>
template <typename Context>
StatusLineSubscriberAdapter<Context>::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
: _status_manager(std::move(status_manager)),
_format_func(format_func),
_sections(sections)
{
}
template <typename Context>
void StatusLineSubscriberAdapter<Context>::update(const Context &context) noexcept
{
for (std::size_t index = 0; const auto §ion : _sections)
{
auto status = _format_func(index, context);
_status_manager->set_section_body(_sections[index], status);
index++;
}
}
|