![]() |
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 | |
EventMetaType (AbstractEventMetaType *nearestBase=nullptr, const char *matrixTypeId={}) | |
event_ptr_tt< EventT > | loadFrom (const QJsonObject &fullJson, const QString &type) const |
Try to load an event from JSON, with dynamic type resolution. | |
![]() | |
auto | derivedTypes () const |
virtual | ~AbstractEventMetaType ()=default |
Additional Inherited Members | |
![]() | |
const std::type_info & | typeInfo |
const char *const | className |
const AbstractEventMetaType *const | baseType |
const event_type_t | matrixId |
![]() | |
AbstractEventMetaType (const std::type_info &typeInfo, const char *className, AbstractEventMetaType *nearestBase=nullptr, event_type_t matrixId=nullptr) | |
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.