diff options
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/syncjob.cpp | 3 | ||||
-rw-r--r-- | jobs/syncjob.h | 33 |
2 files changed, 2 insertions, 34 deletions
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp index 554ac0f7..cec9595f 100644 --- a/jobs/syncjob.cpp +++ b/jobs/syncjob.cpp @@ -96,8 +96,7 @@ BaseJob::Status SyncJob::parseJson(const QJsonDocument& data) void SyncRoomData::EventList::fromJson(const QJsonObject& roomContents) { - auto l = eventsFromJson(roomContents[jsonKey].toObject()["events"].toArray()); - swap(l); + assign(eventsFromJson(roomContents[jsonKey].toObject()["events"].toArray())); } SyncRoomData::SyncRoomData(QString roomId_, JoinState joinState_, const QJsonObject& room_) diff --git a/jobs/syncjob.h b/jobs/syncjob.h index be1d4776..b41c09d4 100644 --- a/jobs/syncjob.h +++ b/jobs/syncjob.h @@ -22,41 +22,10 @@ #include "../joinstate.h" #include "../events/event.h" +#include "util.h" namespace QMatrixClient { - /** - * @brief A crude wrapper around a container of pointers that owns pointers - * to contained objects - * - * Similar to vector<unique_ptr<>>, upon deletion, EventsHolder - * will delete all events contained in it. - */ - template <typename ContainerT> - class Owning : public ContainerT - { - public: - Owning() = default; -#if defined(_MSC_VER) && _MSC_VER < 1900 - // Workaround: Dangerous (auto_ptr style) copy constructor because - // VS2013 (unnecessarily) instantiates EventList::QVector<>::toList() - // which instantiates QList< Owning<> > which needs the contained - // object to have a non-deleted copy constructor. - Owning(Owning& other) : ContainerT(std::move(other)) { } -#else - Owning(Owning&) = delete; -#endif - Owning(Owning&& other) : ContainerT(std::move(other)) { } - ~Owning() { for (auto e: *this) delete e; } - - /** - * @brief returns the underlying events and releases the ownership - * - * Acts similar to unique_ptr::release. - */ - ContainerT release() { return std::move(*this); } - }; - class SyncRoomData { public: |