Cute Chess  0.1
Public Types | Public Member Functions | List of all members
PgnDatabase Class Reference

PGN database. More...

#include <pgndatabase.h>

Inheritance diagram for PgnDatabase:
QObject

Public Types

enum  Status {
  Ok, Modified, DoesNotExist, Unreadable,
  Corrupted
}
 

Public Member Functions

QString displayName () const
 
QList< const PgnGameEntry * > entries () const
 
QString fileName () const
 
Status game (const PgnGameEntry *entry, PgnGame *game)
 
QDateTime lastModified () const
 
 PgnDatabase (const QString &fileName, QObject *parent=nullptr)
 
void setDisplayName (const QString &displayName)
 
void setEntries (const QList< const PgnGameEntry * > &entries)
 
void setLastModified (const QDateTime &lastModified)
 
Status status () const
 
virtual ~PgnDatabase ()
 

Detailed Description

PGN database.

See also
PgnGame
PgnGameEntry
PgnImporter

Member Enumeration Documentation

The current status of the database.

Enumerator
Ok 

The database can be used normally.

Modified 

Database file was modified externally.

DoesNotExist 

Database file does not exist.

Unreadable 

Database file cannot be read.

Corrupted 

Database contains corrupted or invalid data.

Constructor & Destructor Documentation

PgnDatabase::PgnDatabase ( const QString fileName,
QObject parent = nullptr 
)

Constructs a new PgnDatabase with parent and fileName as the underlying database.

PgnDatabase::~PgnDatabase ( )
virtual

Destroys the database and the game entries it contains.

Member Function Documentation

QString PgnDatabase::displayName ( ) const

Returns the display name of this database.

See also
setDisplayName
QList< const PgnGameEntry * > PgnDatabase::entries ( ) const

Returns the list of game entries in this database.

Game entries are light-weight "pointers" to the database. The game() method can be used to read the move information.

See also
game()
QString PgnDatabase::fileName ( ) const

Returns the file name of this database.

PgnDatabase::Status PgnDatabase::game ( const PgnGameEntry entry,
PgnGame game 
)

Reads game from the database using entry.

Note
game must be allocated by the caller and must not be NULL.
QDateTime PgnDatabase::lastModified ( ) const

Returns the last recorded modification time of this database.

Note
This is recorded information. The underlying database file may have been modified afterwards.
See also
setLastModified
void PgnDatabase::setDisplayName ( const QString displayName)

Set the display name of this database to displayName.

Note
Display name is meant for GUI and should be editable by the user. When presenting PGN database information in GUI, display name should be used.
See also
displayName
void PgnDatabase::setEntries ( const QList< const PgnGameEntry * > &  entries)

Set the game entries found in this database to entries.

The database takes ownership of the PgnGameEntry objects in entries.

void PgnDatabase::setLastModified ( const QDateTime lastModified)

Sets the modification time of this database.

See also
lastModified
PgnDatabase::Status PgnDatabase::status ( ) const

Returns the current status of this database.


The documentation for this class was generated from the following files: