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.
11 #include "turnpolicy.h"
13 namespace TurnPolicy
{
15 Abstract::~Abstract() { }
17 boost::shared_ptr
<Always
> always() {
18 return boost::shared_ptr
<Always
>(new Always
);
21 boost::shared_ptr
<Never
> never() {
22 return boost::shared_ptr
<Never
>(new Never
);
25 Collection::Collection()
28 bool Collection::operator()(int turn
) const {
29 Policies::const_iterator it
= m_policies
.find(turn
);
30 if (it
== m_policies
.end()) {
34 return it
->second
->check();
38 void Collection::setPolicy(int turn
, const PolicyPtr
& policy
) {
39 m_policies
[turn
] = policy
;
42 void Collection::clear() {
46 void Collection::setPremove(bool value
) {
50 bool Collection::premove() const {