aboutsummaryrefslogtreecommitdiff
path: root/jobs/syncjob.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-02-27 16:40:03 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-02-28 12:31:38 +0900
commit6c6b5b1bc18e16d0b40b674c8a48e0104ec73729 (patch)
tree53587f877fba6d3f08e3105a9a6981fe92d34205 /jobs/syncjob.h
parent2a5301b5a50c49b480b2c3968b4bca2610a8d6f0 (diff)
downloadlibquotient-6c6b5b1bc18e16d0b40b674c8a48e0104ec73729.tar.gz
libquotient-6c6b5b1bc18e16d0b40b674c8a48e0104ec73729.zip
Renamed logging_util.h to util.h and moved (improved) Owning<> and lookup() there
Because these fall outside of SyncJob and Event context, respectively. In addition, Owning<> has gained a move assignment operator (because we have a move constructor) and assign() convenience method to take ownership over an existing container; also, Owning<>::release() is done the right way now (the previous version was copying the return value to a new container instead of releasing the old container).
Diffstat (limited to 'jobs/syncjob.h')
-rw-r--r--jobs/syncjob.h33
1 files changed, 1 insertions, 32 deletions
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: