Ported verbose deserialization.
[tagua.git] / src / icsapi.h
blobe78f8cb26f0fadf50b70b3d88456f9486710c4b1
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2007 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program 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 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef ICSAPI_H
12 #define ICSAPI_H
14 #include "tagua.h"
16 class ICSAPI {
17 public:
18 virtual ~ICSAPI() { }
20 /**
21 * Create a position using the information of a style12 line.
22 * \param turn Current turn.
23 * \param wkCastle King-side castling is possible for white
24 * \param wqCastle Queen-side castling is possible for white
25 * \param bkCastle King-side castling is possible for black
26 * \param bqCastle Queen-side castling is possible for black
27 * \param ep En-passant square.
29 virtual PositionPtr createChessboard(
30 int turn,
31 bool wkCastle,
32 bool wqCastle,
33 bool bkCastle,
34 bool bqCastle,
35 const Point& ep) = 0;
38 /**
39 * Create a new piece using the given description string.
40 * \param description A string representing the piece to be created. Its
41 * meaning is defined by the variant.
42 * \return A newly created piece.
44 virtual PiecePtr createPiece(const QString& description) = 0;
46 /**
47 * Parse ICS verbose notation.
48 * \param str A string representation of the move to be parsed.
49 * \param turn The player who is moving.
50 * \return A move object corresponding to the given verbose representation.
52 virtual MovePtr parseVerbose(const QString& str, const PositionPtr& ref) = 0;
55 // wrapper
57 template <typename Variant>
58 class WrappedICSAPI : public ICSAPI {
59 public:
60 virtual PositionPtr createChessboard(int, bool, bool, bool, bool, const Point&);
61 virtual PiecePtr createPiece(const QString& description);
62 virtual MovePtr parseVerbose(const QString&, const PositionPtr&) { return MovePtr(); }
65 #endif // ICSAPI_H