aboutsummaryrefslogtreecommitdiff
path: root/events/typingevent.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-14 18:41:55 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-14 18:41:55 +0900
commitc5f480355c7d4c000a4ee73fd7f8107a9a9340c2 (patch)
treed7a8f51e75230aa48cd243ef40b17ced70c0216b /events/typingevent.h
parentbb14969dfa5e9e8a26a005a7f804f21a62460f68 (diff)
downloadlibquotient-c5f480355c7d4c000a4ee73fd7f8107a9a9340c2.tar.gz
libquotient-c5f480355c7d4c000a4ee73fd7f8107a9a9340c2.zip
Move all internal event pointers to std::unique_ptr<>
This causes the following changes along the way: - Owning<> template is decommissioned. - event.h has been rearranged, and Event/RoomEvent::fromJson static methods have been replaced with an external makeEvent<> function template. A side effect of that is that one cannot use a factory with a type other than the one it's defined for (i.e. you cannot call makeEvent<TypingEvent>) but that feature has been out of use for long anyway. - Room::doAddNewMessageEvents() and Room::doAddHistoricalMessageEvents() have been removed, giving place to Room::onAddNewTimelineEvents() and Room::onAddHistoricalTimelineEvents(). The most important difference is that all code that must be executed now resides in addNewMessageEvents() (it moved from Room to Room::Private) and classes inheriting from Room are not obliged to call the overridden function from the overriding function (they can do it but those functions have empty bodies in Room). This was a long overdue change, and owning pointers simply mandated it. Room::onAddNewTimelineEvents/onAddHistoricalTimelineEvents should not do anything with the passed range in terms of ownership, it's just a way to allow the derived class to update his data in due course. - Room::Private::dropDuplicateEvents() and Room::Private::insertEvents(), notably, have been updated to work with owning pointers. insertEvents() move()s pointers to the timeline, while dropDuplicateEvents uses remove_if instead of stable_partition and doesn't explicitly delete event objects. Also, a bugfix: Event accidentally had not virtual destructor for quite a long time. According to the standard, deleting an object through a pointer to a base class without a virtual destructor leads to UB. So the fact that libqmatrixclient clients even worked all these months is mere coincidence and compiler authors good will :-D
Diffstat (limited to 'events/typingevent.h')
0 files changed, 0 insertions, 0 deletions