4a021dd3c65da89aa86a6e509e54ed3a92487bb2
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_VALIDATOR_H
11 #define DELEGATORS_VALIDATOR_H
13 #include "../validator.h"
15 namespace Delegators
{
17 class Validator
: public IValidator
{
19 IValidator
* m_validator
;
21 Validator(IValidator
* validator
)
22 : m_validator(validator
) {
23 m_validator
->setDelegator(this);
25 virtual ~Validator() { delete m_validator
; }
26 virtual bool pseudolegal(const IState
* state
, Move
& move
) const {
27 return m_validator
->pseudolegal(state
, move
);
29 virtual bool legal(const IState
* state
, Move
& move
) const {
30 return m_validator
->legal(state
, move
);
32 virtual bool attacks(const IState
* state
, const IColor
* player
,
33 const Point
& square
, const Piece
& target
= Piece()) const {
34 return m_validator
->attacks(state
, player
, square
, target
);
36 virtual const IColor
* mover(const IState
* state
, const Move
& move
) const {
37 return m_validator
->mover(state
, move
);
39 virtual void setDelegator(IValidator
* delegator
) {
40 return m_validator
->setDelegator(delegator
);
46 #endif // DELEGATORS_VALIDATOR_H