carb::eventdispatcher::Event¶
Defined in carb/eventdispatcher/EventDispatcherTypes.h
Inheritance Relationships¶
Base Type¶
public carb::eventdispatcher::EventData
(carb::eventdispatcher::EventData)
-
class
carb::eventdispatcher
::
Event
: public carb::eventdispatcher::EventData¶ A presentation class for EventData. Allows querying the data via a simple C++ interface.
Public Functions
-
bool
hasKey
(RStringKey key) const¶ Returns true if an Event contains the requested key.
- Parameters
key – The key to query.
- Returns
true
if the key is contained in the Event,false
otherwise.
-
const variant::Variant *
get
(RStringKey key) const¶ Returns a variant value from the event by key.
- Parameters
key – The key to query.
- Returns
A variant::Variant representing the item if the key is present;
nullptr
otherwise.
-
template<class
T
>
cpp17::optional<T>getValue
(RStringKey key) const¶ Retrieves a value from the Event by key.
- Template Parameters
T – The requested type to convert the value to.
- Parameters
key – The key to query.
- Returns
An
optional
value wherehas_value()
istrue
if the key exists and the variant value that it represents can be converted to typeT
. Otherwise returns an emptyoptional
.
-
template<class
T
>
TgetValueOr
(RStringKey key, T &&defaultValue) const¶ Retrieves a value from the Event by key, or a fallback value.
Effectively the same as
getValue<T>(key).value_or(defaultValue)
- Template Parameters
T – The requested type to convert the value to.
- Parameters
key – The key to query.
defaultValue – A value to return if the key does not exist or is not convertable to
T
.
Public Members
-
size_t
numVariants
¶ Number of items in the
variants
array member.
-
NamedVariant const *
variants
¶ An array of NamedVariant of length
numVariants
.
-
bool