GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::events::KeyModifiers Class Reference

Set of key modifiers. More...

#include <GREM/events/keyboard.hpp>

Public Member Functions

constexpr KeyModifiers () noexcept=default
 Construct an empty key modifier set.
constexpr KeyModifiers (KeyModifier keyModifier) noexcept
 Construct a key modifier set containing only one specific key modifier.
constexpr bool operator== (const KeyModifiers &other) const noexcept=default
 Compare this key modifier set to another for equality.
constexpr bool empty () const noexcept
 Check if the key modifier set is empty.
constexpr bool contains (KeyModifier keyModifier) const noexcept
 Check if the key modifier set contains the given key modifier.
constexpr bool containsAnyOf (KeyModifiers keyModifiers) const noexcept
 Check if the key modifier set contains at least one of the given key modifiers.
constexpr bool containsAllOf (KeyModifiers keyModifiers) const noexcept
 Check if the key modifier set contains all of the given key modifiers.

Static Public Attributes

static const KeyModifiers ALL = ~KeyModifiers{}
 Set containing all possible key modifiers.
static const KeyModifiers CONTROL = KeyModifier::LEFT_CONTROL | KeyModifier::RIGHT_CONTROL
 Left or right control.
static const KeyModifiers SHIFT = KeyModifier::LEFT_SHIFT | KeyModifier::RIGHT_SHIFT
 Left or right shift.
static const KeyModifiers ALT = KeyModifier::LEFT_ALT | KeyModifier::RIGHT_ALT
 Left or right alt.
static const KeyModifiers GUI = KeyModifier::LEFT_GUI | KeyModifier::RIGHT_GUI
 Left or right GUI.

Friends

constexpr KeyModifiers operator~ (KeyModifiers a) noexcept
 Get the complement of a key modifier set.
constexpr KeyModifiers operator& (KeyModifiers a, KeyModifiers b) noexcept
 Get the intersection of two key modifier sets.
constexpr KeyModifiers operator| (KeyModifiers a, KeyModifiers b) noexcept
 Get the union of two key modifier sets.
constexpr KeyModifiers operator^ (KeyModifiers a, KeyModifiers b) noexcept
 Get the symmetric difference of two key modifier sets.
constexpr KeyModifiers & operator&= (KeyModifiers &a, KeyModifiers b) noexcept
 Assign the intersection of two key modifier sets to the first set.
constexpr KeyModifiers & operator|= (KeyModifiers &a, KeyModifiers b) noexcept
 Assign the union of two key modifier sets to the first set.
constexpr KeyModifiers & operator^= (KeyModifiers &a, KeyModifiers b) noexcept
 Assign the symmetric difference of two key modifier sets to the first set.

Detailed Description

Set of key modifiers.

See also
KeyModifier

Constructor & Destructor Documentation

◆ KeyModifiers() [1/2]

grem::events::KeyModifiers::KeyModifiers ( )
constexprdefaultnoexcept

Construct an empty key modifier set.

◆ KeyModifiers() [2/2]

grem::events::KeyModifiers::KeyModifiers ( KeyModifier keyModifier)
inlineconstexprnoexcept

Construct a key modifier set containing only one specific key modifier.

Parameters
keyModifierkey modifier identifier to include.
Note
Key modifier sets can be combined using operator|(KeyModifiers, KeyModifiers).

Member Function Documentation

◆ operator==()

bool grem::events::KeyModifiers::operator== ( const KeyModifiers & other) const
nodiscardconstexprdefaultnoexcept

Compare this key modifier set to another for equality.

Parameters
otherthe key modifier set to compare this one to.
Returns
true if the key modifier sets are equal, false otherwise.

◆ empty()

bool grem::events::KeyModifiers::empty ( ) const
inlinenodiscardconstexprnoexcept

Check if the key modifier set is empty.

Returns
true if the set contains no key modifiers, false otherwise.

◆ contains()

bool grem::events::KeyModifiers::contains ( KeyModifier keyModifier) const
inlinenodiscardconstexprnoexcept

Check if the key modifier set contains the given key modifier.

Parameters
keyModifierkey modifier identifier to check for.
Returns
true if the set contains the given key modifier, false otherwise.

◆ containsAnyOf()

bool grem::events::KeyModifiers::containsAnyOf ( KeyModifiers keyModifiers) const
inlinenodiscardconstexprnoexcept

Check if the key modifier set contains at least one of the given key modifiers.

Parameters
keyModifierskey modifier set to check for.
Returns
true if the set contains at least one of the given key modifiers, false otherwise.

◆ containsAllOf()

bool grem::events::KeyModifiers::containsAllOf ( KeyModifiers keyModifiers) const
inlinenodiscardconstexprnoexcept

Check if the key modifier set contains all of the given key modifiers.

Parameters
keyModifierskey modifier set to check for.
Returns
true if the set contains all of the given key modifiers, false otherwise.

◆ operator~

KeyModifiers operator~ ( KeyModifiers a)
friend

Get the complement of a key modifier set.

Parameters
athe set to invert.
Returns
a set containing all possible key modifiers except those in the given set.

◆ operator&

KeyModifiers operator& ( KeyModifiers a,
KeyModifiers b )
friend

Get the intersection of two key modifier sets.

Parameters
afirst key modifier set.
bsecond key modifier set.
Returns
a set containing all key modifiers contained in both a and b.

◆ operator|

KeyModifiers operator| ( KeyModifiers a,
KeyModifiers b )
friend

Get the union of two key modifier sets.

Parameters
afirst key modifier set.
bsecond key modifier set.
Returns
a set containing all key modifiers contained in a or b or both.

◆ operator^

KeyModifiers operator^ ( KeyModifiers a,
KeyModifiers b )
friend

Get the symmetric difference of two key modifier sets.

Parameters
afirst key modifier set.
bsecond key modifier set.
Returns
a set containing all key modifiers contained in either a or b, but not both.

◆ operator&=

KeyModifiers & operator&= ( KeyModifiers & a,
KeyModifiers b )
friend

Assign the intersection of two key modifier sets to the first set.

Parameters
afirst key modifier set.
bsecond key modifier set.
Returns
a reference to the first set, which was assigned to.

◆ operator|=

KeyModifiers & operator|= ( KeyModifiers & a,
KeyModifiers b )
friend

Assign the union of two key modifier sets to the first set.

Parameters
afirst key modifier set.
bsecond key modifier set.
Returns
a reference to the first set, which was assigned to.

◆ operator^=

KeyModifiers & operator^= ( KeyModifiers & a,
KeyModifiers b )
friend

Assign the symmetric difference of two key modifier sets to the first set.

Parameters
afirst key modifier set.
bsecond key modifier set.
Returns
a reference to the first set, which was assigned to.

Member Data Documentation

◆ ALL

KeyModifiers grem::events::KeyModifiers::ALL = ~KeyModifiers{}
inlinestaticconstexpr

Set containing all possible key modifiers.

◆ CONTROL

KeyModifiers grem::events::KeyModifiers::CONTROL = KeyModifier::LEFT_CONTROL | KeyModifier::RIGHT_CONTROL
inlinestaticconstexpr

Left or right control.

◆ SHIFT

KeyModifiers grem::events::KeyModifiers::SHIFT = KeyModifier::LEFT_SHIFT | KeyModifier::RIGHT_SHIFT
inlinestaticconstexpr

Left or right shift.

◆ ALT

KeyModifiers grem::events::KeyModifiers::ALT = KeyModifier::LEFT_ALT | KeyModifier::RIGHT_ALT
inlinestaticconstexpr

Left or right alt.

◆ GUI

KeyModifiers grem::events::KeyModifiers::GUI = KeyModifier::LEFT_GUI | KeyModifier::RIGHT_GUI
inlinestaticconstexpr

Left or right GUI.


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