diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-09 23:07:47 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-09 23:07:47 +0200 |
commit | 6fce18743841a03c82384705d70e0a19dac7cfe9 (patch) | |
tree | efc6672caf3878c1bac28c1615354604798fc540 /common/pipeline.h | |
parent | 9fb535b4cdd6af360e3bbc5ce914e9a2c11ba047 (diff) | |
download | sink-6fce18743841a03c82384705d70e0a19dac7cfe9.tar.gz sink-6fce18743841a03c82384705d70e0a19dac7cfe9.zip |
Moved SimpleResourceProcessor
Not really where it belongs, but at least more generic
Diffstat (limited to 'common/pipeline.h')
-rw-r--r-- | common/pipeline.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/common/pipeline.h b/common/pipeline.h index b695bde..6df2d76 100644 --- a/common/pipeline.h +++ b/common/pipeline.h | |||
@@ -122,5 +122,34 @@ private: | |||
122 | Private * const d; | 122 | Private * const d; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | /** | ||
126 | * A simple processor that takes a single function | ||
127 | */ | ||
128 | class AKONADI2COMMON_EXPORT SimpleProcessor : public Akonadi2::Preprocessor | ||
129 | { | ||
130 | public: | ||
131 | SimpleProcessor(const QString &id, const std::function<void(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e)> &f) | ||
132 | : Akonadi2::Preprocessor(), | ||
133 | mFunction(f), | ||
134 | mId(id) | ||
135 | { | ||
136 | } | ||
137 | |||
138 | void process(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e) Q_DECL_OVERRIDE | ||
139 | { | ||
140 | mFunction(state, e); | ||
141 | processingCompleted(state); | ||
142 | } | ||
143 | |||
144 | QString id() const | ||
145 | { | ||
146 | return mId; | ||
147 | } | ||
148 | |||
149 | protected: | ||
150 | std::function<void(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e)> mFunction; | ||
151 | QString mId; | ||
152 | }; | ||
153 | |||
125 | } // namespace Akonadi2 | 154 | } // namespace Akonadi2 |
126 | 155 | ||