|
Cute Chess
0.1
|
A game of chess in PGN format. More...
#include <pgngame.h>
Classes | |
| struct | MoveData |
| A struct for storing the game's move history. More... | |
Public Types | |
| enum | PgnMode { Minimal, Verbose } |
Public Member Functions | |
| void | addMove (const MoveData &data, bool addEco=true) |
| void | clear () |
| Chess::Board * | createBoard () const |
| QDate | date () const |
| QString | event () const |
| QMap< int, int > | extractScores () const |
| bool | isNull () const |
| bool | isStandard () const |
| const QVector< MoveData > & | moves () const |
| PgnGame () | |
| QString | playerName (Chess::Side side) const |
| bool | read (PgnStream &in, int maxMoves=INT_MAX-1, bool addEco=true) |
| Chess::Result | result () const |
| int | round () const |
| void | setDate (const QDate &date) |
| void | setEvent (const QString &event) |
| void | setGameEndTime (const QDateTime &dateTime) |
| void | setGameStartTime (const QDateTime &dateTime) |
| void | setMove (int ply, const MoveData &data) |
| void | setPlayerName (Chess::Side side, const QString &name) |
| void | setResult (const Chess::Result &result) |
| void | setResultDescription (const QString &description) |
| void | setRound (int round) |
| void | setSite (const QString &site) |
| void | setStartingFenString (Chess::Side side, const QString &fen) |
| void | setStartingSide (Chess::Side side) |
| void | setTag (const QString &tag, const QString &value) |
| void | setTagReceiver (QObject *receiver) |
| void | setVariant (const QString &variant) |
| QString | site () const |
| QString | startingFenString () const |
| Chess::Side | startingSide () const |
| QList< QPair< QString, QString > > | tags () const |
| QString | tagValue (const QString &tag) const |
| QString | variant () const |
| bool | write (QTextStream &out, PgnMode mode=Verbose) const |
| bool | write (const QString &filename, PgnMode mode=Verbose) const |
A game of chess in PGN format.
PGN (Portable game notation) is a text format for chess games. Specification: http://www.very-best.de/pgn-spec.htm
PgnGame is a middle format between text-based PGN games and games played by Cute Chess. PgnGame objects are used for converting played games to PGN format, importing PGN data to opening books, analyzing previous games on a graphical board, etc.
| enum PgnGame::PgnMode |
| PgnGame::PgnGame | ( | ) |
Creates a new PgnGame object.
| void PgnGame::addMove | ( | const MoveData & | data, |
| bool | addEco = true |
||
| ) |
Adds a new move to the game.
| data | The move to add. |
| addEco | Adds opening information if true. |
| void PgnGame::clear | ( | ) |
Deletes all tags and moves.
| Chess::Board * PgnGame::createBoard | ( | ) | const |
Creates a board object for viewing or analyzing the game.
The board is set to the game's starting position. Returns 0 on error.
| QDate PgnGame::date | ( | ) | const |
Returns the starting date of the game.
| QString PgnGame::event | ( | ) | const |
Returns the name of the tournament or match event.
| QMap< int, int > PgnGame::extractScores | ( | ) | const |
Returns QMap of scores extracted from PGN comments
| bool PgnGame::isNull | ( | ) | const |
Returns true if the game doesn't contain any tags or moves.
| bool PgnGame::isStandard | ( | ) | const |
Returns true if the game's variant is "standard" and it's played from the default starting position; otherwise returns false.
| const QVector< PgnGame::MoveData > & PgnGame::moves | ( | ) | const |
Returns the moves that were played in the game.
| QString PgnGame::playerName | ( | Chess::Side | side | ) | const |
Returns the player's name who plays side.
| bool PgnGame::read | ( | PgnStream & | in, |
| int | maxMoves = INT_MAX - 1, |
||
| bool | addEco = true |
||
| ) |
Reads a game from a PGN text stream.
| in | The PGN stream to read from. |
| maxMoves | The maximum number of halfmoves to read. |
| addEco | Adds opening information if true. |
Returns true if any tags and/or moves were read.
| Chess::Result PgnGame::result | ( | ) | const |
Returns the result of the game.
| int PgnGame::round | ( | ) | const |
Returns the the playing round ordinal of the game.
| void PgnGame::setDate | ( | const QDate & | date | ) |
Sets the starting date of the game.
| void PgnGame::setEvent | ( | const QString & | event | ) |
Sets the name of the tournament or match event.
| void PgnGame::setGameEndTime | ( | const QDateTime & | dateTime | ) |
Sets the end time and the duration of the game
| void PgnGame::setGameStartTime | ( | const QDateTime & | dateTime | ) |
Sets the starting time of the game
| void PgnGame::setPlayerName | ( | Chess::Side | side, |
| const QString & | name | ||
| ) |
Sets the player's name who plays side.
| void PgnGame::setResult | ( | const Chess::Result & | result | ) |
Sets the result of the game.
| void PgnGame::setResultDescription | ( | const QString & | description | ) |
Sets a description for the result.
The description is appended to the last move's comment/annotation.
| void PgnGame::setRound | ( | int | round | ) |
Sets the playing round ordinal of the game.
| void PgnGame::setSite | ( | const QString & | site | ) |
Sets the location of the event.
| void PgnGame::setStartingFenString | ( | Chess::Side | side, |
| const QString & | fen | ||
| ) |
Sets the starting position's FEN string.
| void PgnGame::setStartingSide | ( | Chess::Side | side | ) |
Sets the side that starts the game.
Sets tag's value to value. If tag doesn't exist, a new tag is created.
| void PgnGame::setTagReceiver | ( | QObject * | receiver | ) |
Sets a receiver for PGN tags
receiver is an object whose "setTag(QString tag, QString value)" slot is called when a PGN tag changes.
| void PgnGame::setVariant | ( | const QString & | variant | ) |
Sets the chess variant of the game.
| QString PgnGame::site | ( | ) | const |
Returns the location of the event.
| QString PgnGame::startingFenString | ( | ) | const |
Returns the starting position's FEN string.
| Chess::Side PgnGame::startingSide | ( | ) | const |
Returns the side that starts the game.
Returns the tags that are used to describe the game.
Returns the value of tag tag. If tag doesn't exist, an empty string is returned.
| QString PgnGame::variant | ( | ) | const |
Returns the chess variant of the game.
| bool PgnGame::write | ( | QTextStream & | out, |
| PgnMode | mode = Verbose |
||
| ) | const |
Writes the game to a text stream.
Returns true if successful; otherwise returns false.
Writes the game to a file. If the file already exists, the game will be appended to the end of the file.
Returns true if successful; otherwise returns false.
1.8.11