~ubuntu-branches/ubuntu/maverick/qgo/maverick

« back to all changes in this revision

Viewing changes to src/xmlparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* xmlparser.h
 
3
*/
 
4
 
 
5
#include <qxml.h>
 
6
#include "parserdefs.h"
 
7
#include "move.h"
 
8
#include <qptrstack.h>
 
9
 
 
10
class BoardHandler;
 
11
class Tree;
 
12
class GameData;
 
13
 
 
14
enum InformationState
 
15
{
 
16
        infoNone, infoBoardSize, infoHandicap, infoKomi, infoPlayerBlack, infoPlayerWhite,
 
17
                infoRankBlack, infoRankWhite, infoDate, infoResult, infoCopyright
 
18
};
 
19
 
 
20
class XMLParser : public QXmlDefaultHandler
 
21
{
 
22
public:
 
23
        XMLParser(BoardHandler *bh);
 
24
        ~XMLParser();
 
25
        
 
26
        bool parse(QString filename);
 
27
        
 
28
protected:
 
29
        void clearData();
 
30
        bool convertPosition(const QString &atStr, int &x, int &y);
 
31
        void createNode();
 
32
        void startVariation();
 
33
        void endVariation();
 
34
        bool startDocument();
 
35
        bool endDocument();
 
36
        bool startElement(const QString&, const QString&, const QString&, const QXmlAttributes&);
 
37
        bool endElement(const QString&, const QString&, const QString&);
 
38
        bool characters(const QString&);
 
39
        
 
40
private:
 
41
        BoardHandler *boardHandler;
 
42
        QPtrStack<Position> toRemove;
 
43
        QPtrStack<Move> stack;
 
44
        QPtrStack<MoveNum> movesStack;
 
45
        int moves;
 
46
        Position *position;
 
47
        MoveNum *moveNum;
 
48
        Tree *tree;
 
49
        bool var, isRoot, isComment, isCommentPar, nodeDone, varStart;
 
50
        QString commentStr;
 
51
        GameData *gameData;
 
52
        InformationState informationState;
 
53
};