From cba59b8cfa941548392ddc52e8e9ff2ec5b9e82e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 2 Jan 2018 16:03:20 +0100 Subject: Removed unused synclistresult --- common/synclistresult.h | 65 ---------------------- .../databasepopulationandfacadequerybenchmark.cpp | 1 - tests/pipelinebenchmark.cpp | 1 - 3 files changed, 67 deletions(-) delete mode 100644 common/synclistresult.h diff --git a/common/synclistresult.h b/common/synclistresult.h deleted file mode 100644 index 344c0ef..0000000 --- a/common/synclistresult.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include "resultprovider.h" - -namespace async { - -/* -* A result set specialization that provides a syncronous list. -* -* Only for testing purposes. -* -* WARNING: The nested eventloop can cause all sorts of trouble. Use only in testing code. -*/ -template -class SyncListResult : public QList -{ -public: - SyncListResult(const QSharedPointer> &emitter) : QList(), mEmitter(emitter) - { - emitter->onAdded([this](const T &value) { this->append(value); }); - emitter->onModified([this](const T &value) { - for (auto it = this->begin(); it != this->end(); it++) { - if (**it == *value) { - it = this->erase(it); - this->insert(it, value); - break; - } - } - }); - emitter->onRemoved([this](const T &value) { - for (auto it = this->begin(); it != this->end(); it++) { - if (**it == *value) { - this->erase(it); - break; - } - } - }); - emitter->onInitialResultSetComplete([this]() { - if (eventLoopAborter) { - eventLoopAborter(); - // Be safe in case of a second invocation of the complete handler - eventLoopAborter = std::function(); - } - }); - emitter->onComplete([this]() { mEmitter.clear(); }); - emitter->onClear([this]() { this->clear(); }); - } - - void exec() - { - QEventLoop eventLoop; - eventLoopAborter = [&eventLoop]() { eventLoop.quit(); }; - eventLoop.exec(); - } - -private: - QSharedPointer> mEmitter; - std::function eventLoopAborter; -}; -} diff --git a/tests/databasepopulationandfacadequerybenchmark.cpp b/tests/databasepopulationandfacadequerybenchmark.cpp index 7f478cf..734b00d 100644 --- a/tests/databasepopulationandfacadequerybenchmark.cpp +++ b/tests/databasepopulationandfacadequerybenchmark.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/pipelinebenchmark.cpp b/tests/pipelinebenchmark.cpp index 9262d65..e9713cd 100644 --- a/tests/pipelinebenchmark.cpp +++ b/tests/pipelinebenchmark.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3