KVIrc  4.9.2
DeveloperAPIs
KviKvsDnsManager.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_DNSMANAGER_H_
2 #define _KVI_KVS_DNSMANAGER_H_
3 //=============================================================================
4 //
5 // File : KviKvsDnsManager.h
6 // Creation date : Wed 04 Aug 2004 04:38:31 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "kvi_settings.h"
28 #include "KviPointerHashTable.h"
29 
30 #include <QObject>
31 #include <QString>
32 
33 class KviDnsResolver;
34 class KviWindow;
35 class KviKvsScript;
36 class KviKvsVariantList;
37 
39 {
40 public:
42  KviWindow * pWnd,
43  const QString & szQuery,
44  bool bRebindOnWindowClose = true,
45  KviKvsScript * pCallback = 0,
46  KviKvsVariantList * pParameterList = 0);
48 
49 protected:
52  QString m_szQuery;
53  KviKvsScript * m_pCallback; // callback to be executed when the dns terminates
54  KviKvsVariantList * m_pParameterList; // parameter list (magic)
55  bool m_bRebindOnWindowClose; // should we trigger the callback even if m_pWindow no longer exists ?
56 public:
57  KviDnsResolver * dns() { return m_pDns; };
58  KviWindow * window() { return m_pWindow; };
61  const QString & query() const { return m_szQuery; };
62  bool rebindOnWindowClose() const { return m_bRebindOnWindowClose; };
63  void setWindow(KviWindow * pWnd) { m_pWindow = pWnd; };
65 };
66 
67 class KviKvsDnsManager : public QObject
68 {
69  Q_OBJECT
70 public:
73 
74 protected:
77 
78 public:
79  static KviKvsDnsManager * instance() { return m_pInstance; };
80  static void init();
81  static void done();
82 
83  void addDns(KviKvsDnsObject * pObject);
84 protected slots:
86 
87 private:
88  void abortAll();
89 };
90 
91 #endif
const QString & query() const
Definition: KviKvsDnsManager.h:61
Class to handle variant variables lists.
Definition: KviKvsVariantList.h:41
The KVIrc Script class.
Definition: KviKvsScript.h:59
KviPointerHashTable< void *, KviKvsDnsObject > * m_pDnsObjects
Definition: KviKvsDnsManager.h:76
Definition: KviKvsDnsManager.h:38
static KviKvsDnsManager * instance()
Definition: KviKvsDnsManager.h:79
bool m_bRebindOnWindowClose
Definition: KviKvsDnsManager.h:55
QString m_szQuery
Definition: KviKvsDnsManager.h:52
static KviKvsDnsManager * m_pInstance
Definition: KviKvsDnsManager.h:75
Pointer Hash Table.
KviKvsDnsManager()
Definition: KviKvsDnsManager.cpp:67
void setParameterList(KviKvsVariantList *pList)
Definition: KviKvsDnsManager.h:64
KviKvsVariantList * m_pParameterList
Definition: KviKvsDnsManager.h:54
bool rebindOnWindowClose() const
Definition: KviKvsDnsManager.h:62
The KviDnsResolver class.
Definition: KviDnsResolver.h:93
KviWindow * window()
Definition: KviKvsDnsManager.h:58
KviDnsResolver * m_pDns
Definition: KviKvsDnsManager.h:50
KviKvsVariantList * parameterList()
Definition: KviKvsDnsManager.h:60
static void init()
Definition: KviKvsDnsManager.cpp:79
KviKvsDnsObject(KviDnsResolver *pDns, KviWindow *pWnd, const QString &szQuery, bool bRebindOnWindowClose=true, KviKvsScript *pCallback=0, KviKvsVariantList *pParameterList=0)
Definition: KviKvsDnsManager.cpp:39
static void done()
Definition: KviKvsDnsManager.cpp:89
void setWindow(KviWindow *pWnd)
Definition: KviKvsDnsManager.h:63
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
KviDnsResolver * dns()
Definition: KviKvsDnsManager.h:57
void dnsLookupTerminated(KviDnsResolver *pDns)
Definition: KviKvsDnsManager.cpp:111
~KviKvsDnsObject()
Definition: KviKvsDnsManager.cpp:49
KviKvsScript * callback()
Definition: KviKvsDnsManager.h:59
KviWindow * m_pWindow
Definition: KviKvsDnsManager.h:51
KviKvsScript * m_pCallback
Definition: KviKvsDnsManager.h:53
~KviKvsDnsManager()
Definition: KviKvsDnsManager.cpp:73
This file contains compile time settings.
Definition: KviKvsDnsManager.h:67
void addDns(KviKvsDnsObject *pObject)
Definition: KviKvsDnsManager.cpp:100