1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
/****************************************************************************
** $Id: qt/examples/xmlquotes/quoteparser.h 2.3.1 edited 2001-01-26 $
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of an example program for Qt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
#include <qxml.h>
#include <qstringlist.h>
class QuoteHandler : public QXmlDefaultHandler
{
public:
QuoteHandler();
virtual ~QuoteHandler();
// return the list of quotes
QStringList quotes();
// return the error protocol if parsing failed
QString errorProtocol();
// overloaded handler functions
bool startDocument();
bool startElement( const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts );
bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName );
bool characters( const QString& ch );
QString errorString();
bool fatalError( const QXmlParseException& exception );
private:
QStringList quoteList;
QString errorProt;
QString author;
QString reference;
enum State {
StateInit,
StateDocument,
StateQuote,
StateLine,
StateHeading,
StateP
};
State state;
};
|