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

« back to all changes in this revision

Viewing changes to src/sgfparser.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
 * sgfparser.h
 
3
 */
 
4
 
 
5
#ifndef SGFPARSER_H
 
6
#define SGFPARSER_H
 
7
 
 
8
#include <qstring.h>
 
9
 
 
10
class BoardHandler;
 
11
class Tree;
 
12
class QTextStream;
 
13
class Move;
 
14
struct ASCII_Import;
 
15
class XMLParser;
 
16
class GameData;
 
17
 
 
18
class SGFParser
 
19
{
 
20
public:
 
21
        SGFParser(BoardHandler *bh);
 
22
        ~SGFParser();
 
23
 
 
24
        bool parse(const QString &fileName, const QString &filter=0, bool fastLoad=false);
 
25
        bool parseString(const QString &toParse);
 
26
        bool doWrite(const QString &fileName, Tree *tree);
 
27
        bool exportSGFtoClipB(QString *str, Tree *tree);
 
28
        bool parseASCII(const QString &fileName, ASCII_Import *charset, bool isFilename=true);
 
29
    
 
30
protected:
 
31
        QString loadFile(const QString &fileName);
 
32
        bool doParse(const QString &toParseStr, bool fastLoad=false);
 
33
        bool corruptSgf(int where=0, QString reason=NULL);
 
34
        int minPos(int n1, int n2, int n3);
 
35
        bool initGame(const QString &toParse, const QString &fileName);
 
36
        bool parseProperty(const QString &toParse, const QString &prop, QString &result);
 
37
        void traverse(Move *t, GameData *gameData);
 
38
        void writeGameHeader(GameData *gameData);
 
39
        bool parseASCIIStream(QTextStream *stream, ASCII_Import *charset);
 
40
        bool doASCIIParse(const QString &toParse, int &y, ASCII_Import *charset);
 
41
        bool checkBoardSize(const QString &toParse, ASCII_Import *charset);
 
42
//      void convertOldSgf(QString &toParse);
 
43
        bool initStream(QTextStream *stream);
 
44
        bool writeStream(Tree *tree);
 
45
 
 
46
private:
 
47
        BoardHandler *boardHandler;
 
48
        QTextStream *stream;
 
49
        bool isRoot;
 
50
        XMLParser *xmlParser;
 
51
        int asciiOffsetX, asciiOffsetY;
 
52
};
 
53
 
 
54
#endif