The Battle for Wesnoth  1.19.0-dev
visitor.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2024
3  by Gabriel Morin <gabrielmorin (at) gmail (dot) com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /**
17  * @file
18  * visitor is an abstract interface :
19  * action.accept(visitor) calls visitor.visit(action)
20  */
21 
22 #pragma once
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 }
A planned move, represented on the map by an arrow and a ghosted unit in the destination hex.
Definition: move.hpp:36
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses.
Definition: visitor.hpp:33
virtual void visit(recall_ptr recall)=0
virtual ~visitor()
Definition: visitor.hpp:42
virtual void visit(move_ptr move)=0
virtual void visit(attack_ptr attack)=0
virtual void visit(recruit_ptr recruit)=0
virtual void visit(suppose_dead_ptr sup_d)=0
Definition: display.hpp:45
std::shared_ptr< recruit > recruit_ptr
Definition: typedefs.hpp:72
std::shared_ptr< suppose_dead > suppose_dead_ptr
Definition: typedefs.hpp:76
std::shared_ptr< move > move_ptr
Definition: typedefs.hpp:68
std::shared_ptr< attack > attack_ptr
Definition: typedefs.hpp:70
std::shared_ptr< recall > recall_ptr
Definition: typedefs.hpp:74
Contains typedefs for the whiteboard.