logging changes
[scorecard] / src / xml-parser.h
1 #ifndef XMLPARSER_H
2 #define XMLPARSER_H
3
4 #include <QList>
5 #include <QXmlDefaultHandler>
6
7 #include "data.h"
8
9 class ScoreHandler : public QXmlDefaultHandler
10 {
11  public:
12   ScoreHandler(QList<Score *> &scoreList);
13
14   bool startDocument();
15   bool endDocument();
16   bool startElement(const QString &namespaceURI, const QString &localName,
17                     const QString &qName, const QXmlAttributes &attributes);
18   bool endElement(const QString &namespaceURI, const QString &localName,
19                   const QString &qName);
20   bool fatalError(const QXmlParseException &exception);
21   QString errorString() const;
22   
23  private:
24   QList<Score *> &scoreList;
25   Score *score;
26   Hole *hole;
27   QString errorStr;
28   bool inScore;
29 };
30
31 class ClubHandler : public QXmlDefaultHandler
32 {
33  public:
34   ClubHandler(QList<Club *> &clubList);
35
36   bool startDocument();
37   bool endDocument();
38   bool startElement(const QString &namespaceURI, const QString &localName,
39                     const QString &qName, const QXmlAttributes &attributes);
40   bool endElement(const QString &namespaceURI, const QString &localName,
41                   const QString &qName);
42   bool fatalError(const QXmlParseException &exception);
43   QString errorString() const;
44   
45  private:
46   QList<Club *> &clubList;
47   Club *club;
48   Course *course;
49   Hole *hole;
50   QString errorStr;
51   bool inClub;
52   bool inCourse;
53 };
54
55 #endif