yaze
0.2.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
notify.h
Go to the documentation of this file.
1
#ifndef YAZE_UTIL_NOTIFY_H
2
#define YAZE_UTIL_NOTIFY_H
3
4
namespace
yaze
{
5
namespace
util
{
6
12
template
<
typename
T>
13
class
NotifyValue
{
14
public
:
15
NotifyValue
() :
value_
(),
modified_
(false),
temp_value_
() {}
16
NotifyValue
(
const
T &value)
17
:
value_
(value),
modified_
(false),
temp_value_
() {}
18
19
void
set
(
const
T &value) {
20
value_
= value;
21
modified_
=
true
;
22
}
23
24
const
T &
get
() {
25
modified_
=
false
;
26
return
value_
;
27
}
28
29
T &
mutable_get
() {
30
modified_
=
false
;
31
temp_value_
=
value_
;
32
return
temp_value_
;
33
}
34
35
void
apply_changes
() {
36
if
(
temp_value_
!=
value_
) {
37
value_
=
temp_value_
;
38
modified_
=
true
;
39
}
40
}
41
42
void
operator=
(
const
T &value) {
set
(value); }
43
operator
T() {
return
get
(); }
44
45
bool
modified
()
const
{
return
modified_
; }
46
47
private
:
48
T
value_
;
49
bool
modified_
;
50
T
temp_value_
;
51
};
52
}
// namespace util
53
}
// namespace yaze
54
55
#endif
yaze::util::NotifyValue::NotifyValue
NotifyValue()
Definition
notify.h:15
yaze::util::NotifyValue::modified_
bool modified_
Definition
notify.h:49
yaze::util::NotifyValue::NotifyValue
NotifyValue(const T &value)
Definition
notify.h:16
yaze::util::NotifyValue::operator=
void operator=(const T &value)
Definition
notify.h:42
yaze::util::NotifyValue::get
const T & get()
Definition
notify.h:24
yaze::util::NotifyValue::modified
bool modified() const
Definition
notify.h:45
yaze::util::NotifyValue::apply_changes
void apply_changes()
Definition
notify.h:35
yaze::util::NotifyValue::value_
T value_
Definition
notify.h:48
yaze::util::NotifyValue::set
void set(const T &value)
Definition
notify.h:19
yaze::util::NotifyValue::mutable_get
T & mutable_get()
Definition
notify.h:29
yaze::util::NotifyValue::temp_value_
T temp_value_
Definition
notify.h:50
yaze::util
Definition
bps.cc:10
yaze
Main namespace for the application.
Definition
controller.cc:18
src
util
notify.h
Generated by
1.13.2