#include <event.h>
Definition at line 231 of file event.h.
◆ Event() [1/2]
Quotient::Event::Event |
( |
Event && |
| ) |
|
|
defaultnoexcept |
◆ ~Event()
virtual Quotient::Event::~Event |
( |
| ) |
|
|
virtual |
◆ Event() [2/2]
◆ basicJson()
Make a minimal correct Matrix event JSON.
Definition at line 245 of file event.h.
◆ contentJson()
◆ contentPart()
const T Quotient::Event::contentPart |
( |
KeyT && |
key | ) |
const |
|
inline |
Get a part of the content object, assuming a given type.
This retrieves the value under content.<key>
from the event JSON and then converts it to T
using fromJson().
- See also
- contentJson, fromJson
Definition at line 308 of file event.h.
◆ dumpTo()
◆ editJson()
◆ fullJson()
◆ is()
template<EventClass EventT>
bool Quotient::Event::is |
( |
| ) |
const |
|
inline |
◆ isStateEvent()
bool Quotient::Event::isStateEvent |
( |
| ) |
const |
◆ matrixType()
QString Quotient::Event::matrixType |
( |
| ) |
const |
Exact Matrix type stored in JSON.
◆ metaType()
◆ operator=()
◆ switchOnType()
template<typename... VisitorTs>
auto Quotient::Event::switchOnType |
( |
VisitorTs &&... |
visitors | ) |
const |
|
inline |
Apply one of the visitors based on the actual event type.
This function uses function_traits template and is() to find the first of the passed visitor invocables that can be called with this event object, downcasting *this
in a type-safe way to the most specific type accepted by the visitor. Without this function, you can still write a stack of, for example, (else) if (const auto* evtPtr = eventCast<...>(baseEvtPtr))
blocks but switchType() provides a more concise and isolating syntax: there's no else
or trailing return/break
to forget, for one. The visitors have to all return the same type (possibly void). Here's how you might use this function:
const auto result =
eptr->switchOnType(
return 1;
},
return 2;
},
3);
As the example shows, the last parameter can optionally be a plain returned value instead of a visitor.
Definition at line 579 of file event.h.
◆ unsignedJson()
◆ unsignedPart()
const T Quotient::Event::unsignedPart |
( |
KeyT && |
key | ) |
const |
|
inline |
Get a part of the unsigned object, assuming a given type.
This retrieves the value under unsigned.<key>
from the event JSON and then converts it to T
using fromJson().
- See also
- unsignedJson, fromJson
Definition at line 321 of file event.h.
◆ EventMetaType< Event >
◆ operator<<
◆ BaseMetaType
The documentation for this class was generated from the following file: