Cute Chess 0.1
pgngameentry.h
1/*
2 This file is part of Cute Chess.
3 Copyright (C) 2008-2018 Cute Chess authors
4
5 Cute Chess is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Cute Chess is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef PGNGAMEENTRY_H
20#define PGNGAMEENTRY_H
21
22#include <QDate>
23#include "board/result.h"
24class PgnStream;
25class PgnGameFilter;
26class QDataStream;
27
28
40class LIB_EXPORT PgnGameEntry
41{
42 public:
55
58
60 void clear();
65 bool read(PgnStream& in);
66
71 bool read(QDataStream& in);
72
76 void write(QDataStream& out) const;
77
82 bool match(const PgnGameFilter& filter) const;
83
85 qint64 pos() const;
87 qint64 lineNumber() const;
88
90 QString tagValue(TagType type) const;
91
92 private:
93 void addTag(const QByteArray& tagValue);
94
95 QByteArray m_data;
96
97 qint64 m_pos;
98 qint64 m_lineNumber;
99};
100
102extern LIB_EXPORT PgnStream& operator>>(PgnStream& in, PgnGameEntry& entry);
103
105extern LIB_EXPORT QDataStream& operator>>(QDataStream& in, PgnGameEntry& entry);
106
108extern LIB_EXPORT QDataStream& operator<<(QDataStream& out,
109 const PgnGameEntry& entry);
110
111#endif // PGNGAMEENTRY_H
An entry in a PGN collection.
Definition pgngameentry.h:41
PgnGameEntry()
Definition pgngameentry.cpp:99
TagType
Definition pgngameentry.h:45
@ BlackTag
The player of the black pieces.
Definition pgngameentry.h:51
@ VariantTag
The chess variant of the game.
Definition pgngameentry.h:53
@ EventTag
The name of the tournament or match event.
Definition pgngameentry.h:46
@ SiteTag
The location of the event.
Definition pgngameentry.h:47
@ DateTag
The starting date of the game.
Definition pgngameentry.h:48
@ WhiteTag
The player of the white pieces.
Definition pgngameentry.h:50
@ ResultTag
The result of the game.
Definition pgngameentry.h:52
@ RoundTag
The playing round ordinal of the game.
Definition pgngameentry.h:49
A filter for chess games in a PGN database.
Definition pgngamefilter.h:38
A class for reading games in PGN format from a text stream.
Definition pgnstream.h:43