summaryrefslogtreecommitdiffstats
path: root/akregator/src/articleinterceptor.h
blob: ed3c550c07207d858ae578519cd28f1e0946d670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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