blob: e68884ca36eb19fd1ab6c66878642dc1c89872c5 (
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
32
33
34
35
36
37
38
|
#ifndef _FLAGS_H
#define _FLAGS_H
template <typename T = uint_least8_t>
class supports_flags
{
public:
typedef T flags_t;
protected:
flags_t flags_;
public:
supports_flags() : flags_(0) {}
supports_flags(const flags_t arg) : flags_(arg) {}
flags_t flags() const {
return flags_;
}
bool has_flags(const flags_t arg) const {
return flags_ & arg;
}
void set_flags(const flags_t arg) {
flags_ = arg;
}
void clear_flags() {
flags_ = 0;
}
void add_flags(const flags_t arg) {
flags_ |= arg;
}
void drop_flags(const flags_t arg) {
flags_ &= ~arg;
}
};
#endif // _FLAGS_H
|