From 6fce18743841a03c82384705d70e0a19dac7cfe9 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 9 Jul 2015 23:07:47 +0200 Subject: Moved SimpleResourceProcessor Not really where it belongs, but at least more generic --- common/pipeline.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'common') 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: Private * const d; }; +/** + * A simple processor that takes a single function + */ +class AKONADI2COMMON_EXPORT SimpleProcessor : public Akonadi2::Preprocessor +{ +public: + SimpleProcessor(const QString &id, const std::function &f) + : Akonadi2::Preprocessor(), + mFunction(f), + mId(id) + { + } + + void process(const Akonadi2::PipelineState &state, const Akonadi2::Entity &e) Q_DECL_OVERRIDE + { + mFunction(state, e); + processingCompleted(state); + } + + QString id() const + { + return mId; + } + +protected: + std::function mFunction; + QString mId; +}; + } // namespace Akonadi2 -- cgit v1.2.3