ReXGlue SDK
Loading...
Searching...
No Matches
rex::hid::IBindingSet Class Referenceabstract

#include <rex/hid/binding.h>

Public Member Functions

virtual Result< void > Register (ISettingsRegistry &settings)=0
virtual void Unregister ()=0
virtual size_t GetCount () const =0
virtual std::span< const InputSource > GetSources (size_t binding) const =0
virtual bool SetSource (size_t binding, size_t slot, const InputSource &source)=0
virtual bool SetSources (size_t binding, std::span< const InputSource > sources)=0
virtual bool Clear (size_t binding)=0
virtual bool Reset (size_t binding)=0
virtual bool ResetGroup (u32 group)=0
virtual std::optional< size_t > FindConflict (size_t binding, const InputSource &source) const =0
virtual std::optional< size_t > FindBySetting (std::string_view setting_name) const =0
virtual u32 GetGeneration () const =0
virtual std::vector< std::string > TakeParseErrors ()=0

Detailed Description

The input bindings of an application, one string setting per binding. A plain binding is a comma separated list of inputs. In a stick row item N fills key half N, an empty item keeps its position, and a whole stick input such as LStick takes no position. Text with a bad item is rejected as a whole and TakeParseErrors names each bad item. Create one with IInputSystem::CreateBindingSet. UI thread only.

Member Function Documentation

◆ Clear()

virtual bool rex::hid::IBindingSet::Clear ( size_t binding)
pure virtual

Removes every input of a binding.

Parameters
bindingThe index into the descriptions.
Returns
True when the setting took the new text, false when the set is not registered or the index is out of range.

◆ FindBySetting()

virtual std::optional< size_t > rex::hid::IBindingSet::FindBySetting ( std::string_view setting_name) const
nodiscardpure virtual

Finds the binding behind a setting.

Parameters
setting_nameThe full setting name, scope.name.
Returns
The index into the descriptions, or empty when no binding has the setting.

◆ FindConflict()

virtual std::optional< size_t > rex::hid::IBindingSet::FindConflict ( size_t binding,
const InputSource & source ) const
nodiscardpure virtual

Finds another binding of the same group that already uses an input.

Parameters
bindingThe index into the descriptions of the binding being edited.
sourceThe input to look for, compared with IsSameInput.
Returns
Index of the first other binding using the input, or empty.

◆ GetGeneration()

virtual u32 rex::hid::IBindingSet::GetGeneration ( ) const
nodiscardpure virtual

Returns a counter that rises on every change of any binding, which starts above 0.

◆ GetSources()

virtual std::span< const InputSource > rex::hid::IBindingSet::GetSources ( size_t binding) const
nodiscardpure virtual
Parameters
bindingThe index into the descriptions.
Returns
The inputs in order, empty for an index out of range.

◆ Register()

virtual Result< void > rex::hid::IBindingSet::Register ( ISettingsRegistry & settings)
nodiscardpure virtual

Registers the settings and follows them. Values from a config file or the command line are read now.

Parameters
settingsThe registry, which must outlive the registration.
Returns
Ok, or the error of the registry.

◆ Reset()

virtual bool rex::hid::IBindingSet::Reset ( size_t binding)
pure virtual

Restores the default of a binding.

Parameters
bindingThe index into the descriptions.
Returns
True when the setting was reset, false when the set is not registered or the index is out of range.

◆ ResetGroup()

virtual bool rex::hid::IBindingSet::ResetGroup ( u32 group)
pure virtual

Restores the default of every binding in a group.

Parameters
groupThe group value of the descriptions.
Returns
True when the group has a binding and every one was reset.

◆ SetSource()

virtual bool rex::hid::IBindingSet::SetSource ( size_t binding,
size_t slot,
const InputSource & source )
pure virtual

Replaces one input of a binding, or appends it when the slot is past the end.

Parameters
bindingThe index into the descriptions.
slotThe position in GetSources.
Returns
True when the setting took the new text, false when the set is not registered, the index is out of range or the source names nothing.

◆ SetSources()

virtual bool rex::hid::IBindingSet::SetSources ( size_t binding,
std::span< const InputSource > sources )
pure virtual

Replaces all inputs of a binding.

Parameters
bindingThe index into the descriptions.
Returns
True when the setting took the new text, false when the set is not registered or the index is out of range.

◆ TakeParseErrors()

virtual std::vector< std::string > rex::hid::IBindingSet::TakeParseErrors ( )
nodiscardpure virtual

Returns the messages about text that did not parse since the last call and clears them. There is one message per bad item, naming the binding.

◆ Unregister()

virtual void rex::hid::IBindingSet::Unregister ( )
pure virtual

Removes the settings from the registry. The sources keep their last values.


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