Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
hugglefeed.hpp
1 //This program is free software: you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation, either version 3 of the License, or
4 //(at your option) any later version.
5 
6 //This program is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
10 
11 #ifndef HUGGLEFEED_H
12 #define HUGGLEFEED_H
13 
14 #include "exception.hpp"
15 
16 namespace Huggle
17 {
18  class HuggleQueueFilter;
19  class WikiEdit;
20 
21  //! Feed provider stub class every provider must be derived from this one
22  class HuggleFeed
23  {
24  public:
25  HuggleFeed();
26  virtual ~HuggleFeed();
27  //! Return true if this feed is operational or not
28  virtual bool IsWorking() { return false; }
29  //! Restart the feed engine
30  virtual bool Restart() {return false;}
31  //! Stop the feed engine
32  virtual void Stop() {}
33  //! Start the feed engine
34  virtual bool Start() { return false; }
35  //! This is useful to stop parsing edits from irc and like in case that queue is full
36  virtual void Pause() {}
37  //! Resume edit parsing
38  virtual void Resume() {}
39  //! Check if feed is containing some edits in buffer
40  virtual bool ContainsEdit() { return false; }
41  virtual bool IsPaused() { return false; }
42  //! Returns true in case that a provider is stopped and can be safely deleted
43 
44  //! This is useful in case we are running some background threads and we need to
45  //! wait for them to finish before we can delete the object
46  virtual bool IsStopped() { return true; }
47  //! Return a last edit from cache or NULL
48  virtual WikiEdit *RetrieveEdit() { return NULL; }
49  HuggleQueueFilter *Filter;
50  };
51 }
52 
53 #endif // HUGGLEFEED_H
virtual bool ContainsEdit()
Check if feed is containing some edits in buffer.
Definition: hugglefeed.hpp:40
Filter that can be applied to edit queue.
Feed provider stub class every provider must be derived from this one.
Definition: hugglefeed.hpp:22
virtual bool IsStopped()
Returns true in case that a provider is stopped and can be safely deleted.
Definition: hugglefeed.hpp:46
virtual bool Start()
Start the feed engine.
Definition: hugglefeed.hpp:34
virtual void Stop()
Stop the feed engine.
Definition: hugglefeed.hpp:32
virtual void Resume()
Resume edit parsing.
Definition: hugglefeed.hpp:38
virtual WikiEdit * RetrieveEdit()
Return a last edit from cache or NULL.
Definition: hugglefeed.hpp:48
Wiki edit.
Definition: wikiedit.hpp:67
virtual bool IsWorking()
Return true if this feed is operational or not.
Definition: hugglefeed.hpp:28
virtual bool Restart()
Restart the feed engine.
Definition: hugglefeed.hpp:30
virtual void Pause()
This is useful to stop parsing edits from irc and like in case that queue is full.
Definition: hugglefeed.hpp:36