libevdevxx 0.5.3
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) 2025 Daniel K. O.
5 * SPDX-License-Identifier: MIT
6 */
7
8#ifndef LIBEVDEVXX_READ_FLAG_HPP
9#define LIBEVDEVXX_READ_FLAG_HPP
10
11#include <iosfwd>
12#include <string>
13
14#include <libevdev/libevdev.h>
15
16
17namespace evdev {
18
19 enum ReadFlag : unsigned {
20 normal = LIBEVDEV_READ_FLAG_NORMAL,
21 resync = LIBEVDEV_READ_FLAG_SYNC,
22 force_sync = LIBEVDEV_READ_FLAG_FORCE_SYNC,
23 blocking = LIBEVDEV_READ_FLAG_BLOCKING,
24 };
25
26
27 [[nodiscard]]
28 constexpr
31 ReadFlag b)
32 noexcept
33 {
34 return ReadFlag{ static_cast<unsigned>(a) | static_cast<unsigned>(b) };
35 }
36
37
38 [[nodiscard]]
39 constexpr
42 ReadFlag b)
43 noexcept
44 {
45 return ReadFlag{ static_cast<unsigned>(a) & static_cast<unsigned>(b) };
46 }
47
48
49 [[nodiscard]]
50 constexpr
53 ReadFlag b)
54 noexcept
55 {
56 return ReadFlag{ static_cast<unsigned>(a) ^ static_cast<unsigned>(b) };
57 }
58
59
60 [[nodiscard]]
61 constexpr
64 noexcept
65 {
66 return ReadFlag{ ~static_cast<unsigned>(a) };
67 }
68
69
70 [[nodiscard]]
71 constexpr
74 ReadFlag b)
75 {
76 a = a | b;
77 return a;
78 }
79
80
81 inline
82 constexpr
85 ReadFlag b)
86 {
87 a = a & b;
88 return a;
89 }
90
91
92 [[nodiscard]]
93 std::string
95
96
97 std::ostream&
98 operator <<(std::ostream& out,
99 ReadFlag flag);
100
101} // namespace evdev
102
103#endif
The namespace of libevdevxx.
Definition AbsInfo.hpp:18
ReadFlag
Definition ReadFlag.hpp:19
@ blocking
Definition ReadFlag.hpp:23
@ resync
Definition ReadFlag.hpp:21
@ force_sync
Definition ReadFlag.hpp:22
@ normal
Definition ReadFlag.hpp:20
constexpr ReadFlag & operator&=(ReadFlag &a, ReadFlag b)
Definition ReadFlag.hpp:84
std::string to_string(const AbsInfo &info)
constexpr ReadFlag operator&(ReadFlag a, ReadFlag b) noexcept
Definition ReadFlag.hpp:41
std::ostream & operator<<(std::ostream &out, const AbsInfo &info)
constexpr ReadFlag operator^(ReadFlag a, ReadFlag b) noexcept
Definition ReadFlag.hpp:52
constexpr ReadFlag operator|(ReadFlag a, ReadFlag b) noexcept
Definition ReadFlag.hpp:30
constexpr ReadFlag & operator|=(ReadFlag &a, ReadFlag b)
Definition ReadFlag.hpp:73
constexpr ReadFlag operator~(ReadFlag a) noexcept
Definition ReadFlag.hpp:63