KVIrc  4.9.2
DeveloperAPIs
KviKvsEventHandler.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_EVENTHANDLER_H_
2 #define _KVI_KVS_EVENTHANDLER_H_
3 //=============================================================================
4 //
5 // File : KviKvsEventHandler.h
6 // Creation date : Mon 23 Feb 2004 03:04:58 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 "KviKvsScript.h"
29 #include "KviQString.h"
30 #include "KviKvsModuleInterface.h"
31 #include "KviHeapObject.h"
32 
34 {
35 public:
36  enum Type
37  {
39  Module
40  };
41 
42 protected:
44 
45 public:
47  virtual ~KviKvsEventHandler();
48 
49 public:
50  Type type() { return m_type; };
51 };
52 
54 {
55 public:
56  // the event handler becomes the owned of pszCode!
57  KviKvsScriptEventHandler(const QString & szHandlerName, const QString & szContextName, const QString & szCode, bool bEnabled = true);
58  virtual ~KviKvsScriptEventHandler();
59 
60 protected:
61  QString m_szName;
63  bool m_bEnabled;
64 
65 public:
66  KviKvsScript * script() { return m_pScript; };
67  const QString & name() { return m_szName; };
68  const QString & code() { return m_pScript->code(); };
69 
70  bool isEnabled() { return m_bEnabled; };
71  void setEnabled(bool bEnabled) { m_bEnabled = bEnabled; };
72 
73  // Static allocator function.
74  // This MUST be used by the modules to allocate event structures
75  // instead of the new operator.
76  // See KviHeapObject.cpp for an explanation.
77  static KviKvsScriptEventHandler * createInstance(const QString & szHandlerName, const QString & szContextName, const QString & szCode, bool bEnabled = true);
78 };
79 
81 {
82 protected:
85 
86 public:
88  virtual ~KviKvsModuleEventHandler();
89 
90 public:
91  KviKvsModuleInterface * moduleInterface() { return m_pModule; };
93 };
94 
95 /*
96 #include "KviModule.h"
97 
98 class KVIRC_API KviKvsOldModuleEventHandler : public KviKvsEventHandler
99 {
100 protected:
101  KviModule * m_pModule;
102  KviModuleEventParseProc m_proc;
103 public:
104  KviKvsOldModuleEventHandler(KviModuleEventParseProc p,KviModule * m);
105  virtual ~KviKvsOldModuleEventHandler();
106 public:
107  KviModule * module(){ return m_pModule; };
108  void setModule(KviModule * m){ m_pModule = m; };
109  KviModuleEventParseProc proc(){ return m_proc; };
110  void setProc(KviModuleEventParseProc p){ m_proc = p; };
111 };
112 
113 */
114 #endif
Definition: KviKvsEventHandler.h:53
Definition: KviHeapObject.h:124
Definition: KviKvsEventHandler.h:38
bool(* KviKvsModuleEventHandlerRoutine)(KviKvsModuleEventCall *c)
Definition: KviKvsModuleInterface.h:132
#define KVIRC_API
Definition: kvi_settings.h:128
Type
Definition: KviKvsEventHandler.h:36
#define m
Definition: detector.cpp:77
KviKvsModuleInterface * moduleInterface()
Definition: KviKvsEventHandler.h:91
The KVIrc Script class.
Definition: KviKvsScript.h:59
const QString & code()
Definition: KviKvsEventHandler.h:68
Definition: KviKvsEventHandler.h:80
KviKvsModuleInterface * m_pModule
Definition: KviKvsEventHandler.h:83
void setEnabled(bool bEnabled)
Definition: KviKvsEventHandler.h:71
const QString & name()
Definition: KviKvsEventHandler.h:67
KVIrc Script manager.
Type m_type
Definition: KviKvsEventHandler.h:43
QString m_szName
Definition: KviKvsEventHandler.h:61
bool m_bEnabled
Definition: KviKvsEventHandler.h:63
Definition: KviKvsEventHandler.h:33
KviKvsScript * script()
Definition: KviKvsEventHandler.h:66
KviKvsModuleEventHandlerRoutine * m_pProc
Definition: KviKvsEventHandler.h:84
Type type()
Definition: KviKvsEventHandler.h:50
KviKvsModuleEventHandlerRoutine * handlerRoutine()
Definition: KviKvsEventHandler.h:92
QHashIterator< int, QFile * > t(getDict)
bool isEnabled()
Definition: KviKvsEventHandler.h:70
Heap Object.
This file contains compile time settings.
Definition: KviKvsModuleInterface.h:134
Helper functions for the QString class.
KviKvsScript * m_pScript
Definition: KviKvsEventHandler.h:62