2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
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.
11 #ifndef CORE__MOVE_SERIALIZER_H
12 #define CORE__MOVE_SERIALIZER_H
21 * @brief MoveSerializer takes care of converting moves to a displayable form and vice-versa.
23 class TAGUA_EXPORT IMoveSerializer
{
25 virtual ~IMoveSerializer();
28 * Serialize a move given a reference game state.
29 * It is assumed that the move has already been tested against @a ref.
30 * Calling this function on an untested or illegal move is safe but its return
32 * Do not try to call this function on an invalid move.
33 * @param ref The position in which this move shall be executed.
34 * @return A string representation for this move.
36 virtual QString
serialize(const Move
& move
, const IState
* ref
) const = 0;
39 * Convert a string representation of a move back to a move object.
40 * @param ref The position in which this move shall be executed.
41 * @return A move corresponding to the given string representation.
43 virtual Move
deserialize(const QString
& str
, const IState
* ref
) const = 0;
46 * @return Serializer type.
48 virtual QString
type() const = 0;
51 #endif // CORE__MOVE_SERIALIZER_H