opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
liboscar
platform
app_main_loop_status.h
Go to the documentation of this file.
1
#pragma once
2
3
namespace
osc
4
{
5
// returned by `App::do_main_loop_step`
6
//
7
// callers should interpret an implicit conversion of this class to `true` as "the
8
// tick was ok". An implicit conversion to `false` should be interpreted as "something
9
// happened, you should stop stepping and maybe teardown the application loop"
10
class
AppMainLoopStatus
final
{
11
public
:
12
// returns a status that means "the step was ok, feel free to keep stepping"
13
static
AppMainLoopStatus
ok
() {
return
Status::Ok; }
14
15
// returns a status that means "something _requested_ that you stop stepping"
16
//
17
// (whether you stop or not is up to you - but you should probably stop)
18
static
AppMainLoopStatus
quit_requested
() {
return
Status::QuitRequested; }
19
20
explicit
operator
bool
()
const
{
return
status_ == Status::Ok; }
21
22
private
:
23
enum class
Status { Ok, QuitRequested };
24
25
AppMainLoopStatus(Status
status
) : status_{
status
} {}
26
27
Status status_;
28
};
29
}
osc::AppMainLoopStatus
Definition
app_main_loop_status.h:10
osc::AppMainLoopStatus::ok
static AppMainLoopStatus ok()
Definition
app_main_loop_status.h:13
osc::AppMainLoopStatus::quit_requested
static AppMainLoopStatus quit_requested()
Definition
app_main_loop_status.h:18
osc
Definition
custom_decoration_generator.h:5
osc::to
constexpr U to(T &&value)
Definition
conversion.h:56
Generated by
1.9.8