summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-01-03 12:42:42 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-01-03 12:42:42 +0100
commite1c6979863b4994eabeb7ae35208472c234b24f6 (patch)
tree9f65c4449cc86b92cf566b3b1c17dd021b31efdb /common
parent4067462b0a27984df84b0379c19122d574253dfb (diff)
downloadsink-e1c6979863b4994eabeb7ae35208472c234b24f6.tar.gz
sink-e1c6979863b4994eabeb7ae35208472c234b24f6.zip
Pass entity to preprocessor.
Diffstat (limited to 'common')
-rw-r--r--common/pipeline.cpp14
-rw-r--r--common/pipeline.h3
2 files changed, 7 insertions, 10 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 18b6d51..10bae54 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -189,7 +189,6 @@ public:
189 Pipeline *pipeline; 189 Pipeline *pipeline;
190 Pipeline::Type type; 190 Pipeline::Type type;
191 QByteArray key; 191 QByteArray key;
192 Akonadi2::Entity *entity;
193 QVectorIterator<Preprocessor *> filterIt; 192 QVectorIterator<Preprocessor *> filterIt;
194 bool idle; 193 bool idle;
195}; 194};
@@ -240,11 +239,6 @@ Pipeline::Type PipelineState::type() const
240 return d->type; 239 return d->type;
241} 240}
242 241
243const Akonadi2::Entity &PipelineState::entity() const
244{
245 return *d->entity;
246}
247
248void PipelineState::step() 242void PipelineState::step()
249{ 243{
250 if (!d->pipeline) { 244 if (!d->pipeline) {
@@ -253,7 +247,11 @@ void PipelineState::step()
253 247
254 d->idle = false; 248 d->idle = false;
255 if (d->filterIt.hasNext()) { 249 if (d->filterIt.hasNext()) {
256 d->filterIt.next()->process(*this); 250 d->pipeline->storage().scan(d->key.toStdString(), [this](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool {
251 auto entity = Akonadi2::GetEntity(dataValue);
252 d->filterIt.next()->process(*this, *entity);
253 return false;
254 });
257 } else { 255 } else {
258 d->pipeline->pipelineCompleted(*this); 256 d->pipeline->pipelineCompleted(*this);
259 } 257 }
@@ -276,7 +274,7 @@ Preprocessor::~Preprocessor()
276{ 274{
277} 275}
278 276
279void Preprocessor::process(PipelineState state) 277void Preprocessor::process(PipelineState state, const Akonadi2::Entity &)
280{ 278{
281 processingCompleted(state); 279 processingCompleted(state);
282} 280}
diff --git a/common/pipeline.h b/common/pipeline.h
index 6005331..6b847f5 100644
--- a/common/pipeline.h
+++ b/common/pipeline.h
@@ -114,7 +114,6 @@ public:
114 bool isIdle() const; 114 bool isIdle() const;
115 QByteArray key() const; 115 QByteArray key() const;
116 Pipeline::Type type() const; 116 Pipeline::Type type() const;
117 const Akonadi2::Entity &entity() const;
118 117
119 void step(); 118 void step();
120 void processingCompleted(Preprocessor *filter); 119 void processingCompleted(Preprocessor *filter);
@@ -130,7 +129,7 @@ public:
130 Preprocessor(); 129 Preprocessor();
131 virtual ~Preprocessor(); 130 virtual ~Preprocessor();
132 131
133 virtual void process(PipelineState state); 132 virtual void process(PipelineState state, const Akonadi2::Entity &);
134 133
135protected: 134protected:
136 void processingCompleted(PipelineState state); 135 void processingCompleted(PipelineState state);