cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
Term::MetaKey Class Reference

#include <cpp-terminal/key.hpp>

Public Types

enum class  Value : std::int32_t { None = 0 , Alt = (1UL << 22UL) , Ctrl = (1UL << 23UL) }
 

Public Member Functions

constexpr MetaKey ()
 
constexpr MetaKey (const MetaKey &key)=default
 
MetaKeyoperator= (const MetaKey &key)=default
 
constexpr MetaKey (const Value &v)
 
MetaKeyoperator= (const Value &v)
 
constexpr MetaKey (std::int32_t val)
 
MetaKeyoperator= (std::int32_t val)
 
constexpr operator std::int32_t () const
 
constexpr bool hasAlt () const
 
constexpr bool hasCtrl () const
 
MetaKeyoperator+= (MetaKey r)
 
MetaKeyoperator+= (MetaKey::Value r)
 

Public Attributes

std::int32_t value
 

Friends

constexpr MetaKey operator+ (MetaKey l, MetaKey r)
 
constexpr MetaKey operator+ (MetaKey::Value l, MetaKey::Value r)
 
constexpr MetaKey operator+ (MetaKey l, MetaKey::Value r)
 
constexpr MetaKey operator+ (MetaKey::Value l, MetaKey r)
 
constexpr bool operator== (MetaKey l, MetaKey r)
 
constexpr bool operator== (MetaKey l, MetaKey::Value r)
 
constexpr bool operator== (MetaKey::Value l, MetaKey r)
 
constexpr bool operator!= (MetaKey l, MetaKey r)
 
constexpr bool operator!= (MetaKey l, MetaKey::Value r)
 
constexpr bool operator!= (MetaKey::Value l, MetaKey r)
 
constexpr bool operator< (MetaKey l, MetaKey r)
 
constexpr bool operator>= (MetaKey l, MetaKey r)
 
constexpr bool operator>= (MetaKey l, MetaKey::Value r)
 
constexpr bool operator>= (MetaKey::Value l, MetaKey r)
 
constexpr bool operator> (MetaKey l, MetaKey r)
 
constexpr bool operator> (MetaKey l, MetaKey::Value r)
 
constexpr bool operator> (MetaKey::Value l, MetaKey r)
 
constexpr bool operator<= (MetaKey l, MetaKey r)
 
constexpr bool operator<= (MetaKey l, MetaKey::Value r)
 
constexpr bool operator<= (MetaKey::Value l, MetaKey r)
 

Detailed Description

Definition at line 18 of file key.hpp.

Member Enumeration Documentation

◆ Value

enum class Term::MetaKey::Value : std::int32_t
strong
Enumerator
None 
Alt 
Ctrl 

Definition at line 21 of file key.hpp.

22 {
23 // Last utf8 codepoint is U+10FFFF (000100001111111111111111) So:
24 None = 0,
25 Alt = (1UL << 22UL),
26 Ctrl = (1UL << 23UL),
27 };

Constructor & Destructor Documentation

◆ MetaKey() [1/4]

Term::MetaKey::MetaKey ( )
inlineconstexpr

Definition at line 29 of file key.hpp.

29: value(static_cast<std::int32_t>(Value::None)) {}
std::int32_t value
Definition key.hpp:82

◆ MetaKey() [2/4]

Term::MetaKey::MetaKey ( const MetaKey & key)
constexprdefault

◆ MetaKey() [3/4]

Term::MetaKey::MetaKey ( const Value & v)
inlineconstexpr

Definition at line 33 of file key.hpp.

33: value(static_cast<std::int32_t>(v)) {}

◆ MetaKey() [4/4]

Term::MetaKey::MetaKey ( std::int32_t val)
inlineexplicitconstexpr

Definition at line 40 of file key.hpp.

40: value(val) {}

Member Function Documentation

◆ hasAlt()

bool Term::MetaKey::hasAlt ( ) const
inlineconstexpr

Definition at line 49 of file key.hpp.

49{ return (this->value & static_cast<std::int32_t>(MetaKey::Value::Alt)) == static_cast<std::int32_t>(MetaKey::Value::Alt); }

◆ hasCtrl()

bool Term::MetaKey::hasCtrl ( ) const
inlineconstexpr

Definition at line 50 of file key.hpp.

50{ return (this->value & static_cast<std::int32_t>(MetaKey::Value::Ctrl)) == static_cast<std::int32_t>(MetaKey::Value::Ctrl); }

◆ operator std::int32_t()

Term::MetaKey::operator std::int32_t ( ) const
inlineexplicitconstexpr

Definition at line 47 of file key.hpp.

47{ return this->value; }

◆ operator+=() [1/2]

MetaKey & Term::MetaKey::operator+= ( MetaKey r)
inline

Definition at line 57 of file key.hpp.

57{ return *this = *this + r; }

◆ operator+=() [2/2]

MetaKey & Term::MetaKey::operator+= ( MetaKey::Value r)
inline

Definition at line 58 of file key.hpp.

58{ return *this = *this + r; }

◆ operator=() [1/3]

MetaKey & Term::MetaKey::operator= ( const MetaKey & key)
inlinedefault

◆ operator=() [2/3]

MetaKey & Term::MetaKey::operator= ( const Value & v)
inline

Definition at line 34 of file key.hpp.

35 {
36 this->value = static_cast<std::int32_t>(v);
37 return *this;
38 }

◆ operator=() [3/3]

MetaKey & Term::MetaKey::operator= ( std::int32_t val)
inline

Definition at line 41 of file key.hpp.

42 {
43 this->value = val;
44 return *this;
45 }

Friends And Related Symbol Documentation

◆ operator!= [1/3]

bool operator!= ( MetaKey l,
MetaKey r )
friend

Definition at line 64 of file key.hpp.

64{ return !(l == r); }

◆ operator!= [2/3]

bool operator!= ( MetaKey l,
MetaKey::Value r )
friend

Definition at line 65 of file key.hpp.

65{ return !(l == r); }

◆ operator!= [3/3]

bool operator!= ( MetaKey::Value l,
MetaKey r )
friend

Definition at line 66 of file key.hpp.

66{ return !(l == r); }

◆ operator+ [1/4]

MetaKey operator+ ( MetaKey l,
MetaKey r )
friend

Definition at line 52 of file key.hpp.

52{ return MetaKey(l.value | r.value); }
constexpr MetaKey()
Definition key.hpp:29

◆ operator+ [2/4]

MetaKey operator+ ( MetaKey l,
MetaKey::Value r )
friend

Definition at line 54 of file key.hpp.

54{ return l + MetaKey(r); }

◆ operator+ [3/4]

MetaKey operator+ ( MetaKey::Value l,
MetaKey r )
friend

Definition at line 55 of file key.hpp.

55{ return MetaKey(l) + r; }

◆ operator+ [4/4]

MetaKey operator+ ( MetaKey::Value l,
MetaKey::Value r )
friend

Definition at line 53 of file key.hpp.

53{ return MetaKey(l) + MetaKey(r); }

◆ operator<

bool operator< ( MetaKey l,
MetaKey r )
friend

Definition at line 68 of file key.hpp.

68{ return l.value < r.value; }

◆ operator<= [1/3]

bool operator<= ( MetaKey l,
MetaKey r )
friend

Definition at line 78 of file key.hpp.

78{ return !(l > r); }

◆ operator<= [2/3]

bool operator<= ( MetaKey l,
MetaKey::Value r )
friend

Definition at line 79 of file key.hpp.

79{ return !(l > r); }

◆ operator<= [3/3]

bool operator<= ( MetaKey::Value l,
MetaKey r )
friend

Definition at line 80 of file key.hpp.

80{ return !(l > r); }

◆ operator== [1/3]

bool operator== ( MetaKey l,
MetaKey r )
friend

Definition at line 60 of file key.hpp.

60{ return l.value == r.value; }

◆ operator== [2/3]

bool operator== ( MetaKey l,
MetaKey::Value r )
friend

Definition at line 61 of file key.hpp.

61{ return l == MetaKey(r); }

◆ operator== [3/3]

bool operator== ( MetaKey::Value l,
MetaKey r )
friend

Definition at line 62 of file key.hpp.

62{ return MetaKey(l) == r; }

◆ operator> [1/3]

bool operator> ( MetaKey l,
MetaKey r )
friend

Definition at line 74 of file key.hpp.

74{ return r < l; }

◆ operator> [2/3]

bool operator> ( MetaKey l,
MetaKey::Value r )
friend

Definition at line 75 of file key.hpp.

75{ return r < l; }

◆ operator> [3/3]

bool operator> ( MetaKey::Value l,
MetaKey r )
friend

Definition at line 76 of file key.hpp.

76{ return r < l; }

◆ operator>= [1/3]

bool operator>= ( MetaKey l,
MetaKey r )
friend

Definition at line 70 of file key.hpp.

70{ return !(l < r); }

◆ operator>= [2/3]

bool operator>= ( MetaKey l,
MetaKey::Value r )
friend

Definition at line 71 of file key.hpp.

71{ return !(l < r); }

◆ operator>= [3/3]

bool operator>= ( MetaKey::Value l,
MetaKey r )
friend

Definition at line 72 of file key.hpp.

72{ return !(l < r); }

Member Data Documentation

◆ value

std::int32_t Term::MetaKey::value

Definition at line 82 of file key.hpp.


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