Cute Chess 0.1
pgndatabase.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 PGN_DATABASE_H
20#define PGN_DATABASE_H
21
22#include <QObject>
23#include <QList>
24#include <QDateTime>
25#include <QFile>
26#include <pgngame.h>
27#include <pgngameentry.h>
28class PgnStream;
29
37class PgnDatabase : public QObject
38{
39 Q_OBJECT
40
41 public:
51
56 PgnDatabase(const QString& fileName, QObject* parent = nullptr);
58 virtual ~PgnDatabase();
59
76
78 QString fileName() const;
79
81 Status status() const;
82
91 QDateTime lastModified() const;
92
99
105 QString displayName() const;
116
122 Status game(const PgnGameEntry* entry, PgnGame* game);
123
124 private:
126 QDateTime m_lastModified;
127 QString m_fileName;
128 QString m_displayName;
129};
130
131#endif // PGN_DATABASE_H
QDateTime lastModified() const
Definition pgndatabase.cpp:65
void setLastModified(const QDateTime &lastModified)
Definition pgndatabase.cpp:70
Status
Definition pgndatabase.h:44
@ Unreadable
Database file cannot be read.
Definition pgndatabase.h:48
@ DoesNotExist
Database file does not exist.
Definition pgndatabase.h:47
@ Modified
Database file was modified externally.
Definition pgndatabase.h:46
@ Corrupted
Database contains corrupted or invalid data.
Definition pgndatabase.h:49
@ Ok
The database can be used normally.
Definition pgndatabase.h:45
Status status() const
Definition pgndatabase.cpp:51
QList< const PgnGameEntry * > entries() const
Definition pgndatabase.cpp:41
void setDisplayName(const QString &displayName)
Definition pgndatabase.cpp:80
QString fileName() const
Definition pgndatabase.cpp:46
Status game(const PgnGameEntry *entry, PgnGame *game)
Definition pgndatabase.cpp:85
QString displayName() const
Definition pgndatabase.cpp:75
void setEntries(const QList< const PgnGameEntry * > &entries)
Definition pgndatabase.cpp:35
PgnDatabase(const QString &fileName, QObject *parent=nullptr)
Definition pgndatabase.cpp:23
virtual ~PgnDatabase()
Definition pgndatabase.cpp:30
An entry in a PGN collection.
Definition pgngameentry.h:41
A game of chess in PGN format.
Definition pgngame.h:52
A class for reading games in PGN format from a text stream.
Definition pgnstream.h:43