libevdevxx 0.4.0
A C++ wrapper for libevdev.
Loading...
Searching...
No Matches
ReadFlag.hpp
Go to the documentation of this file.
1/*
2 * libevdevxx - a C++ wrapper for libevdev
3 *
4 * Copyright (C) 2021-2023 Daniel K. O.
5 * SPDX-License-Identifier: MIT
6 */
7
8
9#ifndef LIBEVDEVXX_READ_FLAG_HPP
10#define LIBEVDEVXX_READ_FLAG_HPP
11
12
13#include <iosfwd>
14#include <string>
15
16#include <libevdev/libevdev.h>
17
18
19namespace evdev {
20
21
22 enum ReadFlag : unsigned {
23 normal = LIBEVDEV_READ_FLAG_NORMAL,
24 resync = LIBEVDEV_READ_FLAG_SYNC,
25 force_sync = LIBEVDEV_READ_FLAG_FORCE_SYNC,
26 blocking = LIBEVDEV_READ_FLAG_BLOCKING
27 };
28
29
30
31 inline
32 constexpr
35 ReadFlag b)
36 noexcept
37 {
38 return ReadFlag{ static_cast<unsigned>(a) | static_cast<unsigned>(b) };
39 }
40
41
42 inline
43 constexpr
46 ReadFlag b)
47 noexcept
48 {
49 return ReadFlag{ static_cast<unsigned>(a) & static_cast<unsigned>(b) };
50 }
51
52
53 inline
54 constexpr
57 ReadFlag b)
58 noexcept
59 {
60 return ReadFlag{ static_cast<unsigned>(a) ^ static_cast<unsigned>(b) };
61 }
62
63
64 inline
65 constexpr
68 noexcept
69 {
70 return ReadFlag{ ~static_cast<unsigned>(a) };
71 }
72
73
74 inline
75 constexpr
78 ReadFlag b)
79 {
80 a = a | b;
81 return a;
82 }
83
84
85 inline
86 constexpr
89 ReadFlag b)
90 {
91 a = a & b;
92 return a;
93 }
94
95
96 inline
97 constexpr
98 void
100 ReadFlag bit)
101 {
102 f |= bit;
103 }
104
105
106 inline
107 constexpr
108 void
110 ReadFlag bit)
111 {
112 f &= ~bit;
113 }
114
115
116 std::string
118
119
120 std::ostream&
121 operator <<(std::ostream& out,
122 ReadFlag flag);
123
124
125}
126
127
128#endif
The namespace of libevdevxx.
Definition: AbsInfo.hpp:20
ReadFlag
Definition: ReadFlag.hpp:22
@ blocking
Definition: ReadFlag.hpp:26
@ resync
Definition: ReadFlag.hpp:24
@ force_sync
Definition: ReadFlag.hpp:25
@ normal
Definition: ReadFlag.hpp:23
constexpr ReadFlag & operator&=(ReadFlag &a, ReadFlag b)
Definition: ReadFlag.hpp:88
constexpr void set(ReadFlag &f, ReadFlag bit)
Definition: ReadFlag.hpp:99
constexpr void unset(ReadFlag &f, ReadFlag bit)
Definition: ReadFlag.hpp:109
std::string to_string(const AbsInfo &info)
constexpr ReadFlag operator&(ReadFlag a, ReadFlag b) noexcept
Definition: ReadFlag.hpp:45
std::ostream & operator<<(std::ostream &out, const AbsInfo &info)
constexpr ReadFlag operator^(ReadFlag a, ReadFlag b) noexcept
Definition: ReadFlag.hpp:56
constexpr ReadFlag operator|(ReadFlag a, ReadFlag b) noexcept
Definition: ReadFlag.hpp:34
constexpr ReadFlag & operator|=(ReadFlag &a, ReadFlag b)
Definition: ReadFlag.hpp:77
constexpr ReadFlag operator~(ReadFlag a) noexcept
Definition: ReadFlag.hpp:67