The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
visitor.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2016 by Gabriel Morin <gabrielmorin (at) gmail (dot) com>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org
4 
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.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13  */
14 
15 /**
16  * @file
17  * visitor is an abstract interface :
18  * action.accept(visitor) calls visitor.visit(action)
19  */
20 
21 #ifndef WB_VISITOR_HPP_
22 #define WB_VISITOR_HPP_
23 
24 #include "typedefs.hpp"
25 
26 namespace wb
27 {
28 
29 /**
30  * Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses.
31  */
32 class visitor
33 {
34 public:
35  virtual void visit(move_ptr move) = 0;
36  virtual void visit(attack_ptr attack) = 0;
37  virtual void visit(recruit_ptr recruit) = 0;
38  virtual void visit(recall_ptr recall) = 0;
39  virtual void visit(suppose_dead_ptr sup_d) = 0;
40 
41 protected:
42  virtual ~visitor() {}
43 };
44 
45 }
46 
47 #endif /* WB_VISITOR_HPP_ */
virtual void visit(move_ptr move)=0
Contains typedefs for the whiteboard.
A planned move, represented on the map by an arrow and a ghosted unit in the destination hex...
Definition: move.hpp:33
virtual ~visitor()
Definition: visitor.hpp:42
Definition: display.hpp:47
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...
Definition: visitor.hpp:32