Cute Chess  0.1
pgngameentry.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 PGNGAMEENTRY_H
19 #define PGNGAMEENTRY_H
20 
21 #include <QDate>
22 #include "board/result.h"
23 class PgnStream;
24 class PgnGameFilter;
25 class QDataStream;
26 
27 
39 class LIB_EXPORT PgnGameEntry
40 {
41  public:
43  enum TagType
44  {
52  VariantTag
53  };
54 
56  PgnGameEntry();
57 
59  void clear();
64  bool read(PgnStream& in);
65 
70  bool read(QDataStream& in);
71 
75  void write(QDataStream& out) const;
76 
81  bool match(const PgnGameFilter& filter) const;
82 
84  qint64 pos() const;
86  qint64 lineNumber() const;
87 
89  QString tagValue(TagType type) const;
90 
91  private:
92  void addTag(const QByteArray& tagValue);
93 
94  QByteArray m_data;
95 
96  qint64 m_pos;
97  qint64 m_lineNumber;
98 };
99 
101 extern LIB_EXPORT PgnStream& operator>>(PgnStream& in, PgnGameEntry& entry);
102 
104 extern LIB_EXPORT QDataStream& operator>>(QDataStream& in, PgnGameEntry& entry);
105 
107 extern LIB_EXPORT QDataStream& operator<<(QDataStream& out,
108  const PgnGameEntry& entry);
109 
110 #endif // PGNGAMEENTRY_H
A class for reading games in PGN format from a text stream.
Definition: pgnstream.h:41
An entry in a PGN collection.
Definition: pgngameentry.h:39
TagType
Definition: pgngameentry.h:43
A filter for chess games in a PGN database.
Definition: pgngamefilter.h:36
The starting date of the game.
Definition: pgngameentry.h:47
The player of the white pieces.
Definition: pgngameentry.h:49
The result of the game.
Definition: pgngameentry.h:51
The playing round ordinal of the game.
Definition: pgngameentry.h:48
The location of the event.
Definition: pgngameentry.h:46
The name of the tournament or match event.
Definition: pgngameentry.h:45
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:441
The player of the black pieces.
Definition: pgngameentry.h:50