2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
10 #ifndef DELEGATORS__MOVESERIALIZER_H
11 #define DELEGATORS__MOVESERIALIZER_H
13 #include "../moveserializer.h"
16 namespace Delegators
{
18 class MoveSerializer
: public IMoveSerializer
{
20 IMoveSerializer
* m_serializer
;
22 MoveSerializer(IMoveSerializer
* serializer
)
23 : m_serializer(serializer
) {
24 m_serializer
->setDelegator(this);
26 virtual ~MoveSerializer() { delete m_serializer
; }
27 virtual QString
serialize(const Move
& move
, const IState
* ref
) const {
28 return m_serializer
->serialize(move
, ref
);
30 virtual Move
deserialize(const QString
& str
, const IState
* ref
) const {
31 return m_serializer
->deserialize(str
, ref
);
33 virtual QString
symbol(const IType
* type
) const { return m_serializer
->symbol(type
); }
34 virtual QString
suffix(const Move
& move
, const IState
* ref
) const {
35 return m_serializer
->suffix(move
, ref
);
37 virtual QString
type() const { return m_serializer
->type(); }
38 virtual void setDelegator(IMoveSerializer
* delegator
) {
39 m_serializer
->setDelegator(delegator
);
43 } // namespace Delegators
45 #endif // DELEGATORS__MOVESERIALIZER_H