1
/* ---------------------------------------------------------------------
2
* vglogreader: reads xml log into a VgLog vglogreader.h
3
* ---------------------------------------------------------------------
4
* This file is part of Valkyrie, a front-end for Valgrind
5
* Copyright (C) 2000-2008, OpenWorks LLP <info@open-works.co.uk>
6
* This program is released under the terms of the GNU GPL v.2
7
* See the file COPYING for the full license details.
10
#ifndef __VK_XMLPARSER_H
11
#define __VK_XMLPARSER_H
14
#include <qlistview.h>
15
#include <qvaluelist.h>
20
/* For debugging xml parser */
22
#define QXmlSimpleReader VkXmlSimpleReader
23
#define QXmlInputSource VkXmlInputSource
24
#define QXmlDefaultHandler VkXmlDefaultHandler
25
#define QXmlAttributes VkXmlAttributes
26
#define QXmlParseException VkXmlParseException
30
/**********************************************************************/
32
Simple xml handler class for valgrind logs:
33
- creates node tree from input
34
- hands off complete top-level branches to VgLog
35
(e.g. preamble, error etc)
38
class VgLogHandler : public QXmlDefaultHandler
41
VgLogHandler( VgLog* l );
45
bool processingInstruction( const QString& target,
46
const QString& data );
47
bool startElement( const QString& nsURI,
48
const QString& localName,
50
const QXmlAttributes& atts );
51
bool endElement( const QString& nsURI,
52
const QString& localName,
53
const QString& qName );
54
bool characters( const QString& ch );
58
// reimplement error handlers
59
bool error( const QXmlParseException& exception );
60
bool fatalError( const QXmlParseException& exception );
62
/* only set if fatal error */
63
QString fatalMsg() { return m_fatalMsg; }
64
/* may have reached end of log even with fatal error */
65
bool finished() { return m_finished; }
78
/**********************************************************************/
80
Simple subclass of QXmlSimpleReader,
81
to setup VgLogHandler for this reader
83
class VgLogReader : public QXmlSimpleReader
86
VgLogReader( VgLog* vglog );
89
bool parse( QString filepath, bool incremental=false );
92
VgLogHandler* handler() { return vghandler; }
95
VgLogHandler* vghandler;
96
QXmlInputSource* source;
100
#endif // #ifndef __VK_XMLPARSER_H