libQuotient
A Qt library for building matrix clients
|
A family of event meta-types to load and match events. More...
#include <event.h>
Public Member Functions | |
event_ptr_tt< EventT > | loadFrom (const QJsonObject &fullJson, const QString &type) const |
Try to load an event from JSON, with dynamic type resolution. More... | |
AbstractEventMetaType (const char *className, AbstractEventMetaType *nearestBase=nullptr, const char *matrixId=nullptr) | |
Public Member Functions inherited from Quotient::AbstractEventMetaType | |
AbstractEventMetaType (const char *className, AbstractEventMetaType *nearestBase=nullptr, const char *matrixId=nullptr) | |
void | addDerived (const AbstractEventMetaType *newType) |
auto | derivedTypes () const |
virtual | ~AbstractEventMetaType ()=default |
Additional Inherited Members | |
Public Attributes inherited from Quotient::AbstractEventMetaType | |
const char *const | className |
C++ class name this metatype is for. More... | |
const AbstractEventMetaType *const | baseType |
const event_type_t | matrixId |
A family of event meta-types to load and match events.
TL;DR for the loadFrom() story:
|
inlineexplicit |
|
inline |
Try to load an event from JSON, with dynamic type resolution.
The generic logic defined in this class template and invoked applies to all event types defined in the library and boils down to the following: 1. a. If EventT has TypeId defined (which normally is a case of all leaf - specific - event types, via QUO_EVENT macro) and type
doesn't exactly match it, nullptr is immediately returned. b. In absence of TypeId, an event type is assumed to be a base; its derivedTypes are examined, and this algorithm is applied recursively on each.
state_key
is checked in any type derived from StateEvent.