libevdevxx 0.4.0
A C++ wrapper for libevdev.
Loading...
Searching...
No Matches
AbsInfo.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_ABS_INFO_HPP
10#define LIBEVDEVXX_ABS_INFO_HPP
11
12
13#include <cstdint>
14#include <iosfwd>
15#include <string>
16
17#include <libevdev/libevdev.h>
18
19
20namespace evdev {
21
23 struct AbsInfo {
24
25 std::int32_t val = 0;
26 std::int32_t min = 0;
27 std::int32_t max = 0;
28 std::int32_t fuzz = 0;
29 std::int32_t flat = 0;
30 std::int32_t res = 0;
31
32
33 constexpr
35 noexcept = default;
36
37
38 constexpr
40 noexcept :
41 val{a.value},
42 min{a.minimum},
43 max{a.maximum},
44 fuzz{a.fuzz},
45 flat{a.flat},
46 res{a.resolution}
47 {}
48
49
50 constexpr
51 AbsInfo&
52 operator=(const ::input_absinfo& a)
53 noexcept
54 {
55 val = a.value;
56 min = a.minimum;
57 max = a.maximum;
58 fuzz = a.fuzz;
59 flat = a.flat;
60 res = a.resolution;
61 return *this;
62 }
63
64
65 constexpr
66 operator ::input_absinfo()
67 const noexcept
68 {
69 return {
70 .value = val,
71 .minimum = min,
72 .maximum = max,
73 .fuzz = fuzz,
74 .flat = flat,
75 .resolution = res
76 };
77 }
78 };
79
80
81 std::string
83
84
85 std::ostream&
86 operator <<(std::ostream& out,
87 const AbsInfo& info);
88
89
90} // namespace evdev
91
92
93#endif
The namespace of libevdevxx.
Definition: AbsInfo.hpp:20
std::string to_string(const AbsInfo &info)
std::ostream & operator<<(std::ostream &out, const AbsInfo &info)
Maps to the input_absinfo struct from linux/input.h.
Definition: AbsInfo.hpp:23
std::int32_t flat
Definition: AbsInfo.hpp:29
std::int32_t min
Definition: AbsInfo.hpp:26
constexpr AbsInfo & operator=(const ::input_absinfo &a) noexcept
Definition: AbsInfo.hpp:52
std::int32_t res
Definition: AbsInfo.hpp:30
std::int32_t max
Definition: AbsInfo.hpp:27
std::int32_t val
Definition: AbsInfo.hpp:25
constexpr operator::input_absinfo() const noexcept
Definition: AbsInfo.hpp:66
constexpr AbsInfo() noexcept=default
std::int32_t fuzz
Definition: AbsInfo.hpp:28