KVIrc 5.2.6
Developer APIs
KviKvsRunTimeCall.h
Go to the documentation of this file.
1#ifndef _KVI_KVS_RUNTIMECALL_H_
2#define _KVI_KVS_RUNTIMECALL_H_
3//=============================================================================
4//
5// File : KviKvsRunTimeCall.h
6// Creation date : Sat 23 Apr 2005 18:19:38 by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2005-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"
29#include "KviKvsVariantList.h"
30#include "KviKvsVariant.h"
31#include "KviWindow.h"
32
34{
35protected:
38public:
40 : m_pContext(pContext), m_pParams(pParams){};
41 virtual ~KviKvsRunTimeCall(){};
42
43public:
44 // the script runtime context, never zero
45 KviKvsRunTimeContext * context() { return m_pContext; };
46
47 KviWindow * window() { return m_pContext->window(); };
48
49 // parameter list access & helpers.. almost unused
50 // because of the KVSM_PARAMETER macros
51 KviKvsVariantList * parameterList() { return m_pParams; };
52 KviKvsVariantList * params() { return m_pParams; }; // the short version
53 unsigned int paramCount() { return m_pParams->count(); };
54 unsigned int parameterCount() { return m_pParams->count(); };
55 KviKvsVariant * firstParam() { return m_pParams->first(); };
56 KviKvsVariant * nextParam() { return m_pParams->next(); };
57
58 // This is virtual and returns false by default
59 // only few derived classes allow the parameter code to be
60 // extracted. This is mainly useful in module callback commands
61 // where a special parsing routine can not be implemented
62 // but parameter code is needed for later evaluation. (see /addon.register for example)
63 // Returns false if the parameter code cannot be extracted and true otherwise.
64 virtual bool getParameterCode(unsigned int uParamIdx, QString & szParamBuffer);
65
66 // forwarders from the context
67 // this MUST be called before any blocking call that might return to the main event loop
68 // and eventually quit kvirc or close the window that this command is associated to
69 // Actually this is a NO-OP but later may really do something that avoids kvirc to crash
70 void enterBlockingSection() { m_pContext->enterBlockingSection(); };
71 // this MUST be called after exiting the blocking section above
72 // if this function returns false your parsing code MUST "return false" immediately:
73 // it means that something rather critical happened and the script
74 // execution cannot continue
75 bool leaveBlockingSection() { return m_pContext->leaveBlockingSection(); };
76
77 // forwarders for context: they ease the porting
78 void warning(QString szFmt, ...);
79 bool error(QString szFmt, ...); // this ALWAYS returns false
80};
81
82#endif
Parser class to handle variant variables lists.
Handling of variant data type in KVS.
Contains the KviWindow class.
Definition KviKvsRunTimeCall.h:34
KviKvsRunTimeCall(KviKvsRunTimeContext *pContext, KviKvsVariantList *pParams)
Definition KviKvsRunTimeCall.h:39
KviKvsRunTimeContext * context()
Definition KviKvsRunTimeCall.h:45
KviKvsVariantList * parameterList()
Definition KviKvsRunTimeCall.h:51
KviKvsRunTimeContext * m_pContext
Definition KviKvsRunTimeCall.h:36
bool leaveBlockingSection()
Definition KviKvsRunTimeCall.h:75
KviKvsVariantList * m_pParams
Definition KviKvsRunTimeCall.h:37
KviKvsVariant * firstParam()
Definition KviKvsRunTimeCall.h:55
unsigned int parameterCount()
Definition KviKvsRunTimeCall.h:54
KviWindow * window()
Definition KviKvsRunTimeCall.h:47
unsigned int paramCount()
Definition KviKvsRunTimeCall.h:53
virtual ~KviKvsRunTimeCall()
Definition KviKvsRunTimeCall.h:41
KviKvsVariant * nextParam()
Definition KviKvsRunTimeCall.h:56
KviKvsVariantList * params()
Definition KviKvsRunTimeCall.h:52
void enterBlockingSection()
Definition KviKvsRunTimeCall.h:70
Definition KviKvsRunTimeContext.h:104
bool leaveBlockingSection()
Definition KviKvsRunTimeContext.cpp:84
void enterBlockingSection()
Definition KviKvsRunTimeContext.cpp:79
KviWindow * window()
Definition KviKvsRunTimeContext.h:148
Class to handle variant variables lists.
Definition KviKvsVariantList.h:42
KviKvsVariant * first()
Returns the first element of the list.
Definition KviKvsVariantList.h:210
KviKvsVariant * next()
Returns the next element of the list.
Definition KviKvsVariantList.h:216
unsigned int count()
Returns the size of the list.
Definition KviKvsVariantList.h:229
This class defines a new data type which contains variant data.
Definition KviKvsVariant.h:352
Base class for all windows in KVIrc.
Definition KviWindow.h:75
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127