Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
gc.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 GC_H
12 #define GC_H
13 
14 #include <QList>
15 #include <QMutex>
16 #include "collectable.hpp"
17 
18 #define HUGGLECONSUMER_WIKIEDIT 0
19 #define HUGGLECONSUMER_PROVIDERIRC 1
20 #define HUGGLECONSUMER_QUEUE 2
21 #define HUGGLECONSUMER_CORE_POSTPROCESS 3
22 #define HUGGLECONSUMER_DELETEFORM 4
23 #define HUGGLECONSUMER_PROCESSLIST 5
24 #define HUGGLECONSUMER_HUGGLETOOL 6
25 #define HUGGLECONSUMER_EDITQUERY 7
26 #define HUGGLECONSUMER_REVERTQUERY 8
27 #define HUGGLECONSUMER_MAINFORM 9
28 #define HUGGLECONSUMER_LOGINFORM 10
29 
30 namespace Huggle
31 {
32  class Collectable;
33 
34  //! Garbage collector that can be used to collect some objects
35 
36  //! Every object must be derived from Collectable, otherwise it
37  //! must not be handled by garbage collector
38  class GC
39  {
40  public:
41  //! List of all managed queries that qgc keeps track of
42  static QList<Collectable*> list;
43  //! QMutex that is used to lock the GC::list object
44 
45  //! This lock needs to be aquired every time when you need to access this list
46  //! from any thread during runtime
47  static QMutex Lock;
48  //! Function that walks through the list and delete these that can be deleted
49  static void DeleteOld();
50  };
51 }
52 
53 #endif // GC_H
static void DeleteOld()
Function that walks through the list and delete these that can be deleted.
Definition: gc.cpp:16
static QMutex Lock
QMutex that is used to lock the GC::list object.
Definition: gc.hpp:47
Garbage collector that can be used to collect some objects.
Definition: gc.hpp:38
static QList< Collectable * > list
List of all managed queries that qgc keeps track of.
Definition: gc.hpp:42