| 1 |
// ListManager - for creating & containing all ListContainers of item & phrase lists |
| 2 |
|
| 3 |
// For all support, instructions and copyright go to: |
| 4 |
// http://e2guardian.org/ |
| 5 |
// Released under the GPL v2, with the OpenSSL exception described in the README file. |
| 6 |
|
| 7 |
#ifndef __HPP_LISTMANAGER |
| 8 |
#define __HPP_LISTMANAGER |
| 9 |
|
| 10 |
// INCLUDES |
| 11 |
|
| 12 |
#include "String.hpp" |
| 13 |
#include "ListContainer.hpp" |
| 14 |
|
| 15 |
#include <deque> |
| 16 |
|
| 17 |
// DECLARATION |
| 18 |
|
| 19 |
class ListManager |
| 20 |
{ |
| 21 |
public: |
| 22 |
// the lists we manage |
| 23 |
std::deque<ListContainer *> l; |
| 24 |
|
| 25 |
~ListManager(); |
| 26 |
|
| 27 |
void clear(); |
| 28 |
|
| 29 |
|
| 30 |
// create a new item list. re-uses existing lists if a reload is not necessary. |
| 31 |
// calls readItemList. |
| 32 |
int newItemList(const char *filename, const char *list_pwd, bool startswith, int filters, bool parent, bool isip =false, bool istime = false, bool ismap = false); |
| 33 |
//int newStdinItemList(bool startswith, int filters, bool parent ); |
| 34 |
// create a new phrase list. re-uses existing lists, but cannot check nested lists (known limitation). |
| 35 |
// does not call readPhraseList. (checkme: why?) |
| 36 |
int newPhraseList(const char *exception, const char *banned, const char *weighted, int nlimit); |
| 37 |
|
| 38 |
bool readbplfile(const char *banned, const char *exception, const char *weighted, unsigned int &list, bool force_quick_search, |
| 39 |
int nlimit); |
| 40 |
|
| 41 |
void deRefList(size_t item); |
| 42 |
|
| 43 |
// delete lists with refcount zero |
| 44 |
void garbageCollect(); |
| 45 |
|
| 46 |
private: |
| 47 |
// find an empty slot in our collection of listcontainters |
| 48 |
int findNULL(); |
| 49 |
|
| 50 |
void refList(size_t item); |
| 51 |
}; |
| 52 |
|
| 53 |
#endif |