The Battle for Wesnoth  1.19.7+dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
actions::undo_action_container Class Reference

#include <undo_action.hpp>

Classes

struct  subaction_factory
 

Public Types

using t_factory = std::function< t_step_ptr(const config &)>
 
using t_factory_map = std::map< std::string, t_factory >
 

Public Member Functions

 undo_action_container ()
 
bool empty () const
 
t_stepssteps ()
 
bool undo (int side)
 
void write (config &cfg)
 
void read (const config &cfg)
 Creates the list of undo steps based on a config. More...
 
void add (t_step_ptr &&action)
 
void set_unit_id_diff (int id_diff)
 

Static Public Member Functions

static t_factory_mapget_factories ()
 

Private Types

using t_step_ptr = std::unique_ptr< undo_action >
 
using t_steps = std::vector< t_step_ptr >
 

Private Attributes

t_steps steps_
 
int unit_id_diff_
 

Detailed Description

Definition at line 30 of file undo_action.hpp.

Member Typedef Documentation

◆ t_factory

Definition at line 57 of file undo_action.hpp.

◆ t_factory_map

Definition at line 58 of file undo_action.hpp.

◆ t_step_ptr

using actions::undo_action_container::t_step_ptr = std::unique_ptr<undo_action>
private

Definition at line 32 of file undo_action.hpp.

◆ t_steps

Definition at line 33 of file undo_action.hpp.

Constructor & Destructor Documentation

◆ undo_action_container()

actions::undo_action_container::undo_action_container ( )

Definition at line 40 of file undo_action.cpp.

Member Function Documentation

◆ add()

void actions::undo_action_container::add ( t_step_ptr &&  action)

Definition at line 59 of file undo_action.cpp.

References steps_.

Referenced by read().

◆ empty()

bool actions::undo_action_container::empty ( ) const
inline

Definition at line 42 of file undo_action.hpp.

References steps_.

◆ get_factories()

undo_action_container::t_factory_map & actions::undo_action_container::get_factories ( )
static

◆ read()

void actions::undo_action_container::read ( const config cfg)

Creates the list of undo steps based on a config.

Throws bad_lexical_cast or config::error if it cannot parse the config properly.

Definition at line 65 of file undo_action.cpp.

References add(), config::child_range(), and get_factories().

◆ set_unit_id_diff()

void actions::undo_action_container::set_unit_id_diff ( int  id_diff)
inline

Definition at line 52 of file undo_action.hpp.

References unit_id_diff_.

◆ steps()

t_steps& actions::undo_action_container::steps ( )
inline

Definition at line 43 of file undo_action.hpp.

References steps_.

◆ undo()

bool actions::undo_action_container::undo ( int  side)

◆ write()

void actions::undo_action_container::write ( config cfg)

Definition at line 72 of file undo_action.cpp.

References config::add_child(), and steps_.

Member Data Documentation

◆ steps_

t_steps actions::undo_action_container::steps_
private

Definition at line 35 of file undo_action.hpp.

Referenced by add(), empty(), steps(), undo(), and write().

◆ unit_id_diff_

int actions::undo_action_container::unit_id_diff_
private

Definition at line 36 of file undo_action.hpp.

Referenced by set_unit_id_diff(), and undo().


The documentation for this class was generated from the following files: