summaryrefslogtreecommitdiffstats
path: root/akregator/src/articleinterceptor.h
diff options
context:
space:
mode:
Diffstat (limited to 'akregator/src/articleinterceptor.h')
-rw-r--r--akregator/src/articleinterceptor.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/akregator/src/articleinterceptor.h b/akregator/src/articleinterceptor.h
new file mode 100644
index 000000000..ed3c550c0
--- /dev/null
+++ b/akregator/src/articleinterceptor.h
@@ -0,0 +1,46 @@
+#ifndef AKREGATOR_ARTICLEINTERCEPTOR_H
+#define AKREGATOR_ARTICLEINTERCEPTOR_H
+
+#include "akregator_export.h"
+
+template <class T> class QValueList;
+
+namespace Akregator {
+
+class Article;
+
+/** Interface for intercepting new articles which were just fetched before adding
+ * them to the archive. E.g. an article filter could implement this interface to
+ * get fetched articles and label them */
+
+class AKREGATOR_EXPORT ArticleInterceptor
+{
+ public:
+ /** processes an article. Note that the interceptor may modify the article */
+ virtual void processArticle(Article& article) = 0;
+
+};
+
+/** Singleton managing the interceptors */
+class AKREGATOR_EXPORT ArticleInterceptorManager
+{
+ public:
+
+ static ArticleInterceptorManager* self();
+
+ ArticleInterceptorManager();
+ virtual ~ArticleInterceptorManager();
+
+ void addInterceptor(ArticleInterceptor* interceptor);
+ void removeInterceptor(ArticleInterceptor* interceptor);
+ QValueList<ArticleInterceptor*> interceptors() const;
+
+ private:
+ static ArticleInterceptorManager* m_self;
+ class ArticleInterceptorManagerPrivate;
+ ArticleInterceptorManagerPrivate* d;
+};
+
+} //namespace Akregator
+
+#endif // AKREGATOR_ARTICLEINTERCEPTOR_H