Cute Chess
0.1
projects
lib
src
econode.h
1
/*
2
This file is part of Cute Chess.
3
4
Cute Chess is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
Cute Chess is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef ECONODE_H
19
#define ECONODE_H
20
21
#include <QString>
22
#include <QMap>
23
#include "pgngame.h"
24
class
QDataStream
;
25
class
PgnStream
;
26
42
class
LIB_EXPORT
EcoNode
43
{
44
public
:
46
~
EcoNode
();
47
53
bool
isLeaf()
const
;
58
EcoNode
* child(
const
QString
& sanMove)
const
;
63
QString
ecoCode()
const
;
68
QString
opening()
const
;
73
QString
variation()
const
;
74
76
static
void
initialize();
78
static
void
initialize(
PgnStream
& in);
83
static
const
EcoNode
* root();
88
static
const
EcoNode
* find(
const
QVector<PgnGame::MoveData>
& moves);
90
static
void
write(
const
QString
& fileName);
91
92
private
:
93
friend
LIB_EXPORT
QDataStream
& operator<<(
QDataStream
& out,
const
EcoNode
* node);
94
friend
LIB_EXPORT
QDataStream
& operator>>(
QDataStream
& in,
EcoNode
*& node);
95
96
EcoNode
();
97
void
addChild(
const
QString
& sanMove,
EcoNode
* child);
98
99
qint16 m_ecoCode;
100
qint32 m_opening;
101
QString
m_variation;
102
103
QMap<QString, EcoNode*>
m_children;
104
};
105
107
extern
LIB_EXPORT
QDataStream
&
operator<<
(
QDataStream
& out,
const
EcoNode
* node);
112
extern
LIB_EXPORT
QDataStream
& operator>>(
QDataStream
& in,
EcoNode
*& node);
113
114
#endif // ECONODE_H
PgnStream
A class for reading games in PGN format from a text stream.
Definition:
pgnstream.h:41
QDataStream
QMap
EcoNode
A node in the ECO tree (Encyclopaedia of Chess Openings)
Definition:
econode.h:42
QString
QVector< PgnGame::MoveData >
QCPVector2D::operator<<
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition:
qcustomplot.h:441
Generated by
1.8.14