KVIrc 5.2.0
Developer APIs
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"
31#include "KviHeapObject.h"
32
34{
35public:
36 enum Type
37 {
39 Module
40 };
41
42protected:
44
45public:
48
49public:
50 Type type() { return m_type; };
51};
52
54{
55public:
56 // the event handler becomes the owned of pszCode!
57 KviKvsScriptEventHandler(QString szHandlerName, const QString & szContextName, const QString & szCode, bool bEnabled = true);
59
60protected:
61 QString m_szName;
64
65public:
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
94
95/*
96#include "KviModule.h"
97
98class KVIRC_API KviKvsOldModuleEventHandler : public KviKvsEventHandler
99{
100protected:
101 KviModule * m_pModule;
102 KviModuleEventParseProc m_proc;
103public:
104 KviKvsOldModuleEventHandler(KviModuleEventParseProc p,KviModule * m);
105 virtual ~KviKvsOldModuleEventHandler();
106public:
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
Heap Object.
bool(* KviKvsModuleEventHandlerRoutine)(KviKvsModuleEventCall *c)
Definition KviKvsModuleInterface.h:133
KVIrc Script manager.
Helper functions for the QString class.
Definition KviHeapObject.h:125
Definition KviKvsEventHandler.h:34
Type
Definition KviKvsEventHandler.h:37
@ Script
Definition KviKvsEventHandler.h:38
Type m_type
Definition KviKvsEventHandler.h:43
Type type()
Definition KviKvsEventHandler.h:50
virtual ~KviKvsEventHandler()
Definition KviKvsEventHandler.h:81
KviKvsModuleEventHandlerRoutine * m_pProc
Definition KviKvsEventHandler.h:84
KviKvsModuleInterface * m_pModule
Definition KviKvsEventHandler.h:83
KviKvsModuleInterface * moduleInterface()
Definition KviKvsEventHandler.h:91
KviKvsModuleEventHandlerRoutine * handlerRoutine()
Definition KviKvsEventHandler.h:92
Definition KviKvsModuleInterface.h:136
Definition KviKvsEventHandler.h:54
const QString & code()
Definition KviKvsEventHandler.h:68
bool m_bEnabled
Definition KviKvsEventHandler.h:63
bool isEnabled()
Definition KviKvsEventHandler.h:70
QString m_szName
Definition KviKvsEventHandler.h:61
KviKvsScript * m_pScript
Definition KviKvsEventHandler.h:62
const QString & name()
Definition KviKvsEventHandler.h:67
void setEnabled(bool bEnabled)
Definition KviKvsEventHandler.h:71
KviKvsScript * script()
Definition KviKvsEventHandler.h:66
The KVIrc Script class.
Definition KviKvsScript.h:60
const QString & code() const
Returns the code of the script.
Definition KviKvsScript.cpp:103
#define m
Definition detector.cpp:78
#define t
Definition detector.cpp:85
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127