From be838b2f4f294a7e1b3f8a771f91d9d1eac14431 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 22 May 2017 10:22:28 +0900 Subject: Refactored Events The biggest change is we have no pimpls in Event objects anymore - because it's two new's instead of one per Event, and we have thousands and even more of Events created during initial sync. The other big change is introduction of RoomEvent, so that now the structure of events almost precisely reflects the CS API spec. The refactoring made UnknownEvent unnecessary as a separate class; a respective base class (either RoomEvent or Event) is used for this purpose now. All the other changes are consequences of these (mostly of RoomEvent introduction). --- events/roomnameevent.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'events/roomnameevent.h') diff --git a/events/roomnameevent.h b/events/roomnameevent.h index 8748c4be..bb823933 100644 --- a/events/roomnameevent.h +++ b/events/roomnameevent.h @@ -22,18 +22,17 @@ namespace QMatrixClient { - class RoomNameEvent : public Event + class RoomNameEvent : public RoomEvent { public: - RoomNameEvent(); - virtual ~RoomNameEvent(); + explicit RoomNameEvent(const QJsonObject& obj) + : RoomEvent(Type::RoomName, obj) + , _name(contentJson()["name"].toString()) + { } - QString name() const; - - static RoomNameEvent* fromJson(const QJsonObject& obj); + QString name() const { return _name; } private: - class Private; - Private *d; + QString _name{}; }; -} +} // namespace QMatrixClient -- cgit v1.2.3