The Battle for Wesnoth  1.15.2+dev
visitor.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2018 by Gabriel Morin <gabrielmorin (at) gmail (dot) com>
3  Part of the Battle for Wesnoth Project https://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 #pragma once
22 
23 #include "typedefs.hpp"
24 
25 namespace wb
26 {
27 
28 /**
29  * Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses.
30  */
31 class visitor
32 {
33 public:
34  virtual void visit(move_ptr move) = 0;
35  virtual void visit(attack_ptr attack) = 0;
36  virtual void visit(recruit_ptr recruit) = 0;
37  virtual void visit(recall_ptr recall) = 0;
38  virtual void visit(suppose_dead_ptr sup_d) = 0;
39 
40 protected:
41  virtual ~visitor() {}
42 };
43 
44 }
std::shared_ptr< attack > attack_ptr
Definition: typedefs.hpp:69
virtual void visit(move_ptr move)=0
std::shared_ptr< recruit > recruit_ptr
Definition: typedefs.hpp:71
Contains typedefs for the whiteboard.
std::shared_ptr< suppose_dead > suppose_dead_ptr
Definition: typedefs.hpp:75
std::shared_ptr< move > move_ptr
Definition: typedefs.hpp:67
std::shared_ptr< recall > recall_ptr
Definition: typedefs.hpp:73
A planned move, represented on the map by an arrow and a ghosted unit in the destination hex...
Definition: move.hpp:32
virtual ~visitor()
Definition: visitor.hpp:41
Definition: display.hpp:48
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...
Definition: visitor.hpp:31