aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomevent.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-22 13:44:39 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-22 13:44:39 +0100
commit231c4d723eb53f3ea5f641b743d198584840a963 (patch)
treee7ea66c240f32b1666d2a765e00bebfa36e3927d /lib/events/roomevent.h
parentb989383165b648269a231d1febadc8150676d5cf (diff)
downloadlibquotient-231c4d723eb53f3ea5f641b743d198584840a963.tar.gz
libquotient-231c4d723eb53f3ea5f641b743d198584840a963.zip
Simplify the code around EventFactory<>
The former code assumed that EventFactory<> is just a class-level shell for a bunch of functions and a static data member that only exists to allow specialisations to occur for the whole group together. On top of that, setupFactory() and registerEventType() strived to protect this group from double registration coming from static variables in an anonymous namespace produced by REGISTER_EVENT_TYPE. The whole thing is now de-static-ed: resolving the factory now relies on class-static Event/RoomEvent/StateEventBase::factory variables instead of factory_t type aliases; and REGISTER_EVENT_TYPE produces non-static inline variables instead, obviating the need of registerEventType/setupFactory kludge.
Diffstat (limited to 'lib/events/roomevent.h')
-rw-r--r--lib/events/roomevent.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h
index 7f13f6f2..8be58481 100644
--- a/lib/events/roomevent.h
+++ b/lib/events/roomevent.h
@@ -13,7 +13,7 @@ class RedactionEvent;
/** This class corresponds to m.room.* events */
class RoomEvent : public Event {
public:
- using factory_t = EventFactory<RoomEvent>;
+ static inline _impl::EventFactory<RoomEvent> factory { "RoomEvent" };
// RedactionEvent is an incomplete type here so we cannot inline
// constructors and destructors and we cannot use 'using'.