"_posts/git@git.chaotikum.org:chaotikum/website.git" did not exist on "a3678fe30cd0f9d4606bc1afd47068292d3aa3c0"
Newer
Older
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
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <functional>
#include <memory>
#include <shared_mutex>
#include "progress_indicator.hpp"
#include "ui_context.hpp"
#include "event.hpp"
namespace rmrf::ui {
/**
* This class is designed to be the first level adapter to curses.
* It implements some basic information handling and a registry for
* views.
*/
class display : private std::enable_shared_from_this<display> {
public:
typedef display self_type;
typedef std::shared_ptr<self_type> ptr_type;
private:
typedef std::shared_mutex mutex_type;
typedef std::lock_guard<mutex_type> lock_type;
mutable mutex_type m;
public:
display();
virtual ~display();
public:
template<typename F, typename ...Args>
decltype(auto) sync(F &&f, Args &&... args) {
lock_type lock(m);
return std::forward<F>(f)(shared_from_this(), std::forward<Args>(args)...);
}
};
}