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.
15 #include <boost/shared_ptr.hpp>
17 namespace TurnPolicy
{
20 * An abstract class encapsulating the user ability
21 * to move in a given turn.
26 virtual bool check() const = 0;
30 * The user can always move in this turn.
32 class Always
: public Abstract
{
34 virtual bool check() const { return true; }
37 boost::shared_ptr
<Always
> always();
40 * The user cannot move in this turn. A null pointer in turn test
41 * has the same effect of this class.
43 class Never
: public Abstract
{
45 virtual bool check() const { return false; }
48 boost::shared_ptr
<Never
> never();
51 typedef boost::shared_ptr
<Abstract
> PolicyPtr
;
52 typedef std::map
<int, PolicyPtr
> Policies
;
59 bool operator()(int turn
) const;
60 void setPolicy(int turn
, const PolicyPtr
& policy
);
63 void setPremove(bool value
);
68 typedef TurnPolicy::Collection TurnTest
;
70 #endif // TURNPOLICY_H