KVIrc  4.9.2
DeveloperAPIs
KviKvsKernel.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_KERNEL_H_
2 #define _KVI_KVS_KERNEL_H_
3 //=============================================================================
4 //
5 // File : KviKvsKernel.h
6 // Creation date : Tue 30 Sep 2003 13.46 CEST by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2003-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 
29 #include "KviKvsParser.h"
30 #include "KviPointerList.h"
31 #include "KviQString.h"
32 
33 #include "KviPointerHashTable.h"
34 
39 class KviKvsVariantList;
40 class KviKvsSwitchList;
41 class KviKvsVariant;
42 class KviKvsScript;
43 class KviKvsHash;
44 
47 {
50 
53 {
56 
59 {
62 
63 typedef bool (*coreCallbackCommandExecRoutine)(KviKvsRunTimeContext * c, KviKvsVariantList * pParams, KviKvsSwitchList * pSwitches, const KviKvsScript * pCallback);
65 {
68 
70 {
71 public:
72  KviKvsKernel();
73  ~KviKvsKernel();
74 
75 private:
76  static KviKvsKernel * m_pKvsKernel; // global kernel object
77 
79 
83 
86 
89 
90 public:
91  static void init();
92  static void done();
93  static KviKvsKernel * instance() { return m_pKvsKernel; };
94 
95  KviKvsVariantList * emptyParameterList() { return m_pEmptyParameterList; };
96 
97  KviKvsHash * globalVariables() { return m_pGlobalVariables; };
98 
99  KviKvsObjectController * objectController() { return m_pObjectController; };
100 
101  KviKvsAsyncOperationManager * asyncOperationManager() { return m_pAsyncOperationManager; };
102 
104  {
105  m_pSpecialCommandParsingRoutineDict->replace(szCmdName, r);
106  };
108  {
109  return m_pSpecialCommandParsingRoutineDict->find(szCmdName);
110  };
111 
113  {
114  m_pCoreSimpleCommandExecRoutineDict->replace(szCmdName, r);
115  };
117  {
118  return m_pCoreSimpleCommandExecRoutineDict->find(szCmdName);
119  };
120 
122  {
123  m_pCoreFunctionExecRoutineDict->replace(szFncName, r);
124  };
126  {
127  return m_pCoreFunctionExecRoutineDict->find(szFncName);
128  };
129 
131  {
132  m_pCoreCallbackCommandExecRoutineDict->replace(szCmdName, r);
133  };
135  {
136  return m_pCoreCallbackCommandExecRoutineDict->find(szCmdName);
137  };
138 
139  void completeCommand(const QString & szCommandBegin, KviPointerList<QString> * pMatches);
140  void completeFunction(const QString & szFunctionBegin, KviPointerList<QString> * pMatches);
141  void completeModuleCommand(const QString & szModuleName, const QString & szCommandBegin, KviPointerList<QString> * matches);
142  void completeModuleFunction(const QString & szModuleName, const QString & szFunctionBegin, KviPointerList<QString> * matches);
143 
144  KviPointerList<QString> * completeCommandAllocateResult(const QString & szCommandBegin)
145  {
147  p->setAutoDelete(true);
148  completeCommand(szCommandBegin, p);
149  return p;
150  }
151 
152  KviPointerList<QString> * completeFunctionAllocateResult(const QString & szFunctionBegin)
153  {
155  p->setAutoDelete(true);
156  completeFunction(szFunctionBegin, p);
157  return p;
158  }
160  {
161  /* if (!l) return;
162  for (int i=0;i<l->count();i++)
163  {
164  delete l->at(i);
165  }
166  */
167  if(!l)
168  return;
169  delete l;
170  }
171  void getAllFunctionsCommandsCore(QStringList * list);
172 };
173 
174 #endif
Definition: KviKvsKernel.h:58
KviKvsAsyncOperationManager * asyncOperationManager()
Definition: KviKvsKernel.h:101
KviKvsHash * globalVariables()
Definition: KviKvsKernel.h:97
This class defines a new data type which contains variant data.
Definition: KviKvsVariant.h:351
KviKvsCoreCallbackCommandExecRoutine * findCoreCallbackCommandExecRoutine(const QString &szCmdName)
Definition: KviKvsKernel.h:134
#define KVIRC_API
Definition: kvi_settings.h:128
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
Definition: KviKvsKernel.h:46
KviPointerHashTable< QString, KviKvsSpecialCommandParsingRoutine > * m_pSpecialCommandParsingRoutineDict
Definition: KviKvsKernel.h:78
Class to handle variant variables lists.
Definition: KviKvsVariantList.h:41
The KVIrc Script class.
Definition: KviKvsScript.h:59
Definition: KviKvsObjectController.h:37
#define l
Definition: detector.cpp:76
KviKvsCoreSimpleCommandExecRoutine * findCoreSimpleCommandExecRoutine(const QString &szCmdName)
Definition: KviKvsKernel.h:116
KviKvsVariantList * m_pEmptyParameterList
Definition: KviKvsKernel.h:85
bool(* coreCallbackCommandExecRoutine)(KviKvsRunTimeContext *c, KviKvsVariantList *pParams, KviKvsSwitchList *pSwitches, const KviKvsScript *pCallback)
Definition: KviKvsKernel.h:63
Definition: KviKvsParser.h:54
KviKvsVariantList * emptyParameterList()
Definition: KviKvsKernel.h:95
specialCommandParsingRoutine proc
Definition: KviKvsKernel.h:48
Definition: KviKvsAsyncOperation.h:48
bool(* coreSimpleCommandExecRoutine)(KviKvsRunTimeContext *c, KviKvsVariantList *pParams, KviKvsSwitchList *pSwitches)
Definition: KviKvsKernel.h:51
KviKvsTreeNodeCommand *(KviKvsParser::* specialCommandParsingRoutine)()
Definition: KviKvsKernel.h:45
This class defines a new data type which contains hash data.
Definition: KviKvsHash.h:47
Definition: KviKvsSwitchList.h:33
KviKvsCoreFunctionExecRoutine * findCoreFunctionExecRoutine(const QString &szFncName)
Definition: KviKvsKernel.h:125
Pointer Hash Table.
KviPointerHashTable< QString, KviKvsCoreCallbackCommandExecRoutine > * m_pCoreCallbackCommandExecRoutineDict
Definition: KviKvsKernel.h:81
KviKvsObjectController * objectController()
Definition: KviKvsKernel.h:99
void setAutoDelete(bool bAutoDelete)
Sets the autodelete flag.
Definition: KviPointerList.h:1090
coreSimpleCommandExecRoutine proc
Definition: KviKvsKernel.h:54
void registerCoreSimpleCommandExecRoutine(const QString &szCmdName, KviKvsCoreSimpleCommandExecRoutine *r)
Definition: KviKvsKernel.h:112
void done()
Definition: KviKvs.cpp:50
Definition: KviKvsKernel.h:64
Definition: KviKvsKernel.h:69
void registerSpecialCommandParsingRoutine(const QString &szCmdName, KviKvsSpecialCommandParsingRoutine *r)
Definition: KviKvsKernel.h:103
struct _KviKvsSpecialCommandParsingRoutine KviKvsSpecialCommandParsingRoutine
bool(* coreFunctionExecRoutine)(KviKvsRunTimeContext *c, KviKvsVariantList *pParams, KviKvsVariant *pRetBuffer)
Definition: KviKvsKernel.h:57
KviPointerList< QString > * completeCommandAllocateResult(const QString &szCommandBegin)
Definition: KviKvsKernel.h:144
KviPointerHashTable< QString, KviKvsCoreFunctionExecRoutine > * m_pCoreFunctionExecRoutineDict
Definition: KviKvsKernel.h:82
KviKvsObjectController * m_pObjectController
Definition: KviKvsKernel.h:87
Definition: KviKvsTreeNodeSpecialCommand.h:31
#define r
Definition: detector.cpp:82
C++ Template based double linked pointer list class.
Definition: KviKvsRunTimeContext.h:103
coreFunctionExecRoutine proc
Definition: KviKvsKernel.h:60
struct _KviKvsCoreFunctionExecRoutine KviKvsCoreFunctionExecRoutine
KviPointerHashTable< QString, KviKvsCoreSimpleCommandExecRoutine > * m_pCoreSimpleCommandExecRoutineDict
Definition: KviKvsKernel.h:80
KviKvsHash * m_pGlobalVariables
Definition: KviKvsKernel.h:84
static KviKvsKernel * instance()
Definition: KviKvsKernel.h:93
Definition: KviKvsTreeNodeCommand.h:34
coreCallbackCommandExecRoutine proc
Definition: KviKvsKernel.h:66
Definition: KviKvsKernel.h:52
A fast pointer hash table implementation.
Definition: KviPointerHashTable.h:391
void registerCoreCallbackCommandExecRoutine(const QString &szCmdName, KviKvsCoreCallbackCommandExecRoutine *r)
Definition: KviKvsKernel.h:130
struct _KviKvsCoreSimpleCommandExecRoutine KviKvsCoreSimpleCommandExecRoutine
int init()
Definition: winamp.cpp:118
This file contains compile time settings.
static KviKvsKernel * m_pKvsKernel
Definition: KviKvsKernel.h:76
KviKvsAsyncOperationManager * m_pAsyncOperationManager
Definition: KviKvsKernel.h:88
void freeCompletionResult(KviPointerList< QString > *l)
Definition: KviKvsKernel.h:159
KviKvsSpecialCommandParsingRoutine * findSpecialCommandParsingRoutine(const QString &szCmdName)
Definition: KviKvsKernel.h:107
#define p
Definition: detector.cpp:80
Helper functions for the QString class.
struct _KviKvsCoreCallbackCommandExecRoutine KviKvsCoreCallbackCommandExecRoutine
KviPointerList< QString > * completeFunctionAllocateResult(const QString &szFunctionBegin)
Definition: KviKvsKernel.h:152
void registerCoreFunctionExecRoutine(const QString &szFncName, KviKvsCoreFunctionExecRoutine *r)
Definition: KviKvsKernel.h:121