#include <event.h>
|
static QJsonObject | basicJson (const QString &matrixType, const QJsonObject &content) |
| Make a minimal correct Matrix event JSON. More...
|
|
|
| Event (const QJsonObject &json) |
|
QJsonObject & | editJson () |
|
virtual void | dumpTo (QDebug dbg) const |
|
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]
Quotient::Event::Event |
( |
const QJsonObject & |
json | ) |
|
|
explicitprotected |
◆ basicJson()
static QJsonObject Quotient::Event::basicJson |
( |
const QString & |
matrixType, |
|
|
const QJsonObject & |
content |
|
) |
| |
|
inlinestatic |
Make a minimal correct Matrix event JSON.
Definition at line 245 of file event.h.
◆ contentJson()
const QJsonObject Quotient::Event::contentJson |
( |
| ) |
const |
◆ contentPart()
template<typename T , typename KeyT >
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()
virtual void Quotient::Event::dumpTo |
( |
QDebug |
dbg | ) |
const |
|
protectedvirtual |
◆ editJson()
QJsonObject& Quotient::Event::editJson |
( |
| ) |
|
|
inlineprotected |
◆ fullJson()
const QJsonObject& Quotient::Event::fullJson |
( |
| ) |
const |
|
inline |
◆ 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(
[](const RoomMemberEvent& memberEvent) {
return 1;
},
[](const CallEvent& callEvent) {
return 2;
},
3);
event_ptr_tt< RoomEvent > RoomEventPtr
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()
const QJsonObject Quotient::Event::unsignedJson |
( |
| ) |
const |
◆ unsignedPart()
template<typename T , typename KeyT >
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: