libevdevxx 0.5.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) 2025 Daniel K. O.
5 * SPDX-License-Identifier: MIT
6 */
7
8#ifndef LIBEVDEVXX_ABS_INFO_HPP
9#define LIBEVDEVXX_ABS_INFO_HPP
10
11#include <cstdint>
12#include <iosfwd>
13#include <string>
14
15#include <libevdev/libevdev.h>
16
17
18namespace evdev {
19
21 struct AbsInfo {
22
23 std::int32_t val = 0;
24 std::int32_t min = 0;
25 std::int32_t max = 0;
26 std::int32_t fuzz = 0;
27 std::int32_t flat = 0;
28 std::int32_t res = 0;
29
30
31 constexpr
33 noexcept = default;
34
35
36 constexpr
38 noexcept :
39 val{a.value},
40 min{a.minimum},
41 max{a.maximum},
42 fuzz{a.fuzz},
43 flat{a.flat},
44 res{a.resolution}
45 {}
46
47
48 constexpr
49 AbsInfo&
50 operator=(const ::input_absinfo& a)
51 noexcept
52 {
53 val = a.value;
54 min = a.minimum;
55 max = a.maximum;
56 fuzz = a.fuzz;
57 flat = a.flat;
58 res = a.resolution;
59 return *this;
60 }
61
62
63 constexpr
64 operator ::input_absinfo()
65 const noexcept
66 {
67 return {
68 .value = val,
69 .minimum = min,
70 .maximum = max,
71 .fuzz = fuzz,
72 .flat = flat,
73 .resolution = res
74 };
75 }
76 };
77
78
79 std::string
80 to_string(const AbsInfo& info);
81
82
83 std::ostream&
84 operator <<(std::ostream& out,
85 const AbsInfo& info);
86
87} // namespace evdev
88
89#endif
The namespace of libevdevxx.
Definition AbsInfo.hpp:18
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:21
std::int32_t flat
Definition AbsInfo.hpp:27
std::int32_t min
Definition AbsInfo.hpp:24
constexpr AbsInfo & operator=(const ::input_absinfo &a) noexcept
Definition AbsInfo.hpp:50
std::int32_t res
Definition AbsInfo.hpp:28
std::int32_t max
Definition AbsInfo.hpp:25
std::int32_t val
Definition AbsInfo.hpp:23
constexpr operator::input_absinfo() const noexcept
Definition AbsInfo.hpp:64
constexpr AbsInfo() noexcept=default
std::int32_t fuzz
Definition AbsInfo.hpp:26