summaryrefslogtreecommitdiffstats
path: root/common/resultset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/resultset.cpp')
-rw-r--r--common/resultset.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/common/resultset.cpp b/common/resultset.cpp
index 6e1479a..293035b 100644
--- a/common/resultset.cpp
+++ b/common/resultset.cpp
@@ -20,56 +20,38 @@
20 20
21#include "common/log.h" 21#include "common/log.h"
22 22
23ResultSet::ResultSet() 23ResultSet::ResultSet() : mIt(nullptr)
24 : mIt(nullptr)
25{ 24{
26
27} 25}
28 26
29ResultSet::ResultSet(const ValueGenerator &generator, const SkipValue &skip) 27ResultSet::ResultSet(const ValueGenerator &generator, const SkipValue &skip) : mIt(nullptr), mValueGenerator(generator), mSkip(skip)
30 : mIt(nullptr),
31 mValueGenerator(generator),
32 mSkip(skip)
33{ 28{
34
35} 29}
36 30
37ResultSet::ResultSet(const IdGenerator &generator) 31ResultSet::ResultSet(const IdGenerator &generator) : mIt(nullptr), mGenerator(generator), mSkip([this]() { next(); })
38 : mIt(nullptr),
39 mGenerator(generator),
40 mSkip([this]() {
41 next();
42 })
43{ 32{
44
45} 33}
46 34
47ResultSet::ResultSet(const QVector<QByteArray> &resultSet) 35ResultSet::ResultSet(const QVector<QByteArray> &resultSet)
48 : mResultSet(resultSet), 36 : mResultSet(resultSet),
49 mIt(mResultSet.constBegin()), 37 mIt(mResultSet.constBegin()),
50 mSkip([this]() { 38 mSkip([this]() {
51 if (mIt != mResultSet.constEnd()) { 39 if (mIt != mResultSet.constEnd()) {
52 mIt++; 40 mIt++;
53 } 41 }
54 }), 42 }),
55 mFirst(true) 43 mFirst(true)
56{ 44{
57
58} 45}
59 46
60ResultSet::ResultSet(const ResultSet &other) 47ResultSet::ResultSet(const ResultSet &other) : mResultSet(other.mResultSet), mIt(nullptr), mFirst(true)
61 : mResultSet(other.mResultSet),
62 mIt(nullptr),
63 mFirst(true)
64{ 48{
65 if (other.mValueGenerator) { 49 if (other.mValueGenerator) {
66 mValueGenerator = other.mValueGenerator; 50 mValueGenerator = other.mValueGenerator;
67 mSkip = other.mSkip; 51 mSkip = other.mSkip;
68 } else if (other.mGenerator) { 52 } else if (other.mGenerator) {
69 mGenerator = other.mGenerator; 53 mGenerator = other.mGenerator;
70 mSkip = [this]() { 54 mSkip = [this]() { next(); };
71 next();
72 };
73 } else { 55 } else {
74 mResultSet = other.mResultSet; 56 mResultSet = other.mResultSet;
75 mIt = mResultSet.constBegin(); 57 mIt = mResultSet.constBegin();
@@ -96,7 +78,7 @@ bool ResultSet::next()
96 return true; 78 return true;
97 } 79 }
98 } else { 80 } else {
99 next([](const Sink::ApplicationDomain::ApplicationDomainType::Ptr &value, Sink::Operation){ return false; }); 81 next([](const Sink::ApplicationDomain::ApplicationDomainType::Ptr &value, Sink::Operation) { return false; });
100 } 82 }
101 return false; 83 return false;
102} 84}