1
#ifndef _KVI_KVS_REPORT_H_
2
#define _KVI_KVS_REPORT_H_
3
//=============================================================================
5
// File : kvi_kvs_report.h
6
// Creation date : Thu 25 Sep 2003 05.12 CEST by Szymon Stefanek
8
// This file is part of the KVirc irc client distribution
9
// Copyright (C) 2003-2008 Szymon Stefanek (pragma at kvirc dot net)
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 opinion) any later version.
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.
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.
25
//=============================================================================
27
#include "kvi_settings.h"
28
#include "kvi_qstring.h"
29
#include "kvi_pointerlist.h"
33
class KVIRC_API KviKvsReport
36
enum Type { RunTimeError, RunTimeWarning, ParserError, ParserWarning };
38
KviKvsReport(Type t,const QString &szContext,const QString &szMessage,const QString &szLocation,KviWindow * pWindow);
44
QString m_szContext; // context name (script name, usually)
45
QString m_szMessage; // report message, always present
46
QString m_szLocation; // line and col description (may be some thing like "at end of input")
48
KviWindow * m_pWindow; // the window that the script was attacched to
51
KviPointerList<QString> * m_pCodeListing; // code listing, if present, it is owned
52
KviPointerList<QString> * m_pCallStack; // call stack, if present, it is owned
54
Type type() const { return m_eType; };
56
KviWindow * window(){ return m_pWindow; };
57
const QString & context(){ return m_szContext; };
58
const QString & message(){ return m_szMessage; };
59
const QString & location(){ return m_szLocation; };
60
KviPointerList<QString> * codeListing(){ return m_pCodeListing; };
61
KviPointerList<QString> * callStack(){ return m_pCallStack; };
63
void setContext(const QString &szContext){ m_szContext = szContext; };
64
void setMessage(const QString &szMessage){ m_szMessage = szMessage; };
65
void setLocation(const QString &szLocation){ m_szLocation = szLocation; };
66
void setCodeListing(KviPointerList<QString> * pListing){ m_pCodeListing = pListing; };
67
void setCallStack(KviPointerList<QString> * pStack){ m_pCallStack = pStack; };
69
static void findLineAndCol(const QChar * pBegin,const QChar * pPoint,int &iLine,int &iCol);
70
static void findLineColAndListing(const QChar * pBegin,const QChar * pPoint,int &iLine,int &iCol,KviPointerList<QString> * pListing);
72
static void report(KviKvsReport * r,KviWindow * pOutput);
75
#endif //!_KVI_KVS_REPORT_H_