KVIrc  4.9.2
DeveloperAPIs
KviKvsReport.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_REPORT_H_
2 #define _KVI_KVS_REPORT_H_
3 //=============================================================================
4 //
5 // File : KviKvsReport.h
6 // Creation date : Thu 25 Sep 2003 05.12 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 #include "KviQString.h"
29 #include "KviPointerList.h"
30 
31 class KviWindow;
32 
34 {
35 public:
36  enum Type
37  {
41  ParserWarning
42  };
43 
44 public:
45  KviKvsReport(Type t, const QString & szContext, const QString & szMessage, const QString & szLocation, KviWindow * pWindow);
46  ~KviKvsReport();
47 
48 protected:
50 
51  // mandatory
52  QString m_szContext; // context name (script name, usually)
53  QString m_szMessage; // report message, always present
54  QString m_szLocation; // line and col description (may be some thing like "at end of input")
55 
56  KviWindow * m_pWindow; // the window that the script was attacched to
57 
58  // optional
59  KviPointerList<QString> * m_pCodeListing; // code listing, if present, it is owned
60  KviPointerList<QString> * m_pCallStack; // call stack, if present, it is owned
61 public:
62  Type type() const { return m_eType; };
63 
64  KviWindow * window() { return m_pWindow; };
65  const QString & context() { return m_szContext; };
66  const QString & message() { return m_szMessage; };
67  const QString & location() { return m_szLocation; };
68  KviPointerList<QString> * codeListing() { return m_pCodeListing; };
69  KviPointerList<QString> * callStack() { return m_pCallStack; };
70 
71  void setContext(const QString & szContext) { m_szContext = szContext; };
72  void setMessage(const QString & szMessage) { m_szMessage = szMessage; };
73  void setLocation(const QString & szLocation) { m_szLocation = szLocation; };
74  void setCodeListing(KviPointerList<QString> * pListing) { m_pCodeListing = pListing; };
75  void setCallStack(KviPointerList<QString> * pStack) { m_pCallStack = pStack; };
76 
77  static void findLineAndCol(const QChar * pBegin, const QChar * pPoint, int & iLine, int & iCol);
78  static void findLineColAndListing(const QChar * pBegin, const QChar * pPoint, int & iLine, int & iCol, KviPointerList<QString> * pListing);
79 
80  static void report(KviKvsReport * r, KviWindow * pOutput);
81 };
82 
83 #endif
Definition: KviKvsReport.h:39
const QString & message()
Definition: KviKvsReport.h:66
void setCallStack(KviPointerList< QString > *pStack)
Definition: KviKvsReport.h:75
#define KVIRC_API
Definition: kvi_settings.h:128
void setMessage(const QString &szMessage)
Definition: KviKvsReport.h:72
Definition: KviKvsReport.h:40
Type type() const
Definition: KviKvsReport.h:62
void setCodeListing(KviPointerList< QString > *pListing)
Definition: KviKvsReport.h:74
KviPointerList< QString > * m_pCodeListing
Definition: KviKvsReport.h:59
QString m_szContext
Definition: KviKvsReport.h:52
KviPointerList< QString > * callStack()
Definition: KviKvsReport.h:69
Definition: KviKvsReport.h:33
Definition: KviKvsReport.h:38
QString m_szLocation
Definition: KviKvsReport.h:54
KviPointerList< QString > * codeListing()
Definition: KviKvsReport.h:68
KviWindow * window()
Definition: KviKvsReport.h:64
void setLocation(const QString &szLocation)
Definition: KviKvsReport.h:73
QHashIterator< int, QFile * > t(getDict)
#define r
Definition: detector.cpp:82
C++ Template based double linked pointer list class.
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
KviWindow * m_pWindow
Definition: KviKvsReport.h:56
QString m_szMessage
Definition: KviKvsReport.h:53
Type m_eType
Definition: KviKvsReport.h:49
KviPointerList< QString > * m_pCallStack
Definition: KviKvsReport.h:60
const QString & context()
Definition: KviKvsReport.h:65
Type
Definition: KviKvsReport.h:36
This file contains compile time settings.
const QString & location()
Definition: KviKvsReport.h:67
void setContext(const QString &szContext)
Definition: KviKvsReport.h:71
Helper functions for the QString class.