2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 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 MOVESERIALIZER_H
12 #define MOVESERIALIZER_H
15 #include "decoratedmove.h"
17 class AbstractMoveSerializer
{
19 virtual ~AbstractMoveSerializer() { }
20 virtual QString
SAN() const = 0;
21 virtual DecoratedMove
toDecoratedMove() const = 0;
24 template <typename Pos
>
25 class MoveSerializerBase
: public AbstractMoveSerializer
{
28 typedef typename
Position::Move Move
;
29 typedef typename
Position::Piece Piece
;
32 const Position
& m_ref
;
34 virtual QString
checkSuffix() const {
48 MoveSerializerBase(const Move
& move
, const Position
& ref
)
51 virtual ~MoveSerializerBase() { }
53 virtual QString
SAN() const;
54 virtual DecoratedMove
toDecoratedMove() const;
57 template <typename Pos
>
58 class MoveSerializer
: public MoveSerializerBase
<Pos
> {
60 typedef typename
Position::Move Move
;
62 MoveSerializer(const Move
& move
, const Position
& ref
)
63 : MoveSerializerBase
<Position
>(move
, ref
) { }
66 #endif // MOVESERIALIZER_H