libevdevxx 0.5.4
A C++ wrapper for libevdev.
Loading...
Searching...
No Matches
Code Struct Reference

Type-safe class for evdev codes (KEY_*, BTN_*, REL_*, etc). More...

#include <Code.hpp>

Public Types

using BaseType = detail::NumberBase<std::uint16_t, Code>
using value_type = typename BaseType::Value
 The underlying value, same as std::uint16_t.

Public Member Functions

 Code (Type type, value_type code_num)
Public Member Functions inherited from NumberBase< std::uint16_t, Code >
constexpr NumberBase () noexcept
constexpr NumberBase (Value value) noexcept
constexpr operator Value () const noexcept
constexpr bool operator== (const NumberBase &other) const noexcept=default
constexpr std::strong_ordering operator<=> (const NumberBase &other) const noexcept=default
constexpr NumberBaseoperator++ () noexcept
constexpr Derived operator++ (int) noexcept

Static Public Member Functions

static std::pair< Type, Codeparse (std::string_view name, std::size_t *pos=nullptr)
 Parse a Type and Code from a string.
static Code max (Type type)
 Returns the maximum code available for a given type.

Additional Inherited Members

Protected Types inherited from NumberBase< std::uint16_t, Code >
using Value
using Derived
Protected Attributes inherited from NumberBase< std::uint16_t, Code >
Value value

Detailed Description

Type-safe class for evdev codes (KEY_*, BTN_*, REL_*, etc).

A Code object can only be explicitly constructed from an integer. Conversion back to the integer value is implicit.

Member Typedef Documentation

◆ BaseType

using BaseType = detail::NumberBase<std::uint16_t, Code>

◆ value_type

using value_type = typename BaseType::Value

The underlying value, same as std::uint16_t.

Constructor & Destructor Documentation

◆ Code()

Code ( Type type,
value_type code_num )

Member Function Documentation

◆ max()

Code max ( Type type)
staticnodiscard

Returns the maximum code available for a given type.

◆ parse()

std::pair< Type, Code > parse ( std::string_view name,
std::size_t * pos = nullptr )
staticnodiscard

Parse a Type and Code from a string.

Parameters
namethe string to parse.
[out]posif not NULL, store how many characters were parsed.

The documentation for this struct was generated from the following file: