Public Member Functions | Protected Attributes

editor::editor_action_chain Class Reference

Container action wrapping several actions into one. More...

#include <action.hpp>

Inheritance diagram for editor::editor_action_chain:
Inheritance graph
[legend]
Collaboration diagram for editor::editor_action_chain:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 editor_action_chain ()
 Create an empty action chain.
 editor_action_chain (const editor_action_chain &other)
editor_action_chainoperator= (const editor_action_chain &other)
editor_action_chainclone () const
 Action cloning.
 editor_action_chain (std::deque< editor_action * > actions)
 Create an action chain from a deque of action pointers.
 editor_action_chain (editor_action *action)
 Create an action chain by wrapping around a single action pointer.
 ~editor_action_chain ()
 The destructor deletes all the owned action pointers.
int action_count () const
 Go through the chain and add up all the action counts.
void append_action (editor_action *a)
 Add an action at the end of the chain.
void prepend_action (editor_action *a)
 Add an action at the beginning of the chain.
bool empty () const
editor_actionpop_last_action ()
 Remove the last added action and return it, transferring ownership to the caller.
editor_actionpop_first_action ()
 Remove the first added action and return it, transferring ownership to the caller.
editor_action_chainperform (map_context &m) const
 Perform all the actions in order and create a undo action chain.
void perform_without_undo (map_context &m) const
 Perform all the actions in order.
const char * get_name () const

Protected Attributes

std::deque< editor_action * > actions_
 The action pointers owned by this action chain.

Detailed Description

Container action wrapping several actions into one.

The actions are performed in the order they are added, i.e. in the usual iteration order through the container.

Definition at line 80 of file action.hpp.


Constructor & Destructor Documentation

editor::editor_action_chain::editor_action_chain (  )  [inline]

Create an empty action chain.

Definition at line 86 of file action.hpp.

editor::editor_action_chain::editor_action_chain ( const editor_action_chain other  ) 

Definition at line 71 of file action.cpp.

editor::editor_action_chain::editor_action_chain ( std::deque< editor_action * >  actions  )  [inline, explicit]

Create an action chain from a deque of action pointers.

Note: the action chain assumes ownership of the pointers.

Definition at line 101 of file action.hpp.

editor::editor_action_chain::editor_action_chain ( editor_action action  )  [inline, explicit]

Create an action chain by wrapping around a single action pointer.

Note: the action chain assumes ownership of the pointer.

Definition at line 110 of file action.hpp.

editor::editor_action_chain::~editor_action_chain (  ) 

The destructor deletes all the owned action pointers.

Definition at line 90 of file action.cpp.

References actions_, and editor::editor_action::clone().

Here is the call graph for this function:


Member Function Documentation

int editor::editor_action_chain::action_count (  )  const [virtual]

Go through the chain and add up all the action counts.

Reimplemented from editor::editor_action.

Definition at line 100 of file action.cpp.

void editor::editor_action_chain::append_action ( editor_action a  ) 

Add an action at the end of the chain.

Definition at line 109 of file action.cpp.

Referenced by editor::mouse_action_map_label::drag_left().

Here is the caller graph for this function:

editor_action_chain * editor::editor_action_chain::clone (  )  const [virtual]

Action cloning.

Implements editor::editor_action.

Definition at line 96 of file action.cpp.

References actions_.

bool editor::editor_action_chain::empty (  )  const
Returns:
true when there are no actions in the chain. Empty action chains should usually be discarded as to not keep "empty" actions around.

Definition at line 115 of file action.cpp.

References actions_.

Referenced by editor::map_context::partial_undo(), perform(), and pop_first_action().

Here is the caller graph for this function:

const char* editor::editor_action_chain::get_name (  )  const [inline, virtual]
Returns:
a short name of this action type, defaults to unknown

Reimplemented from editor::editor_action.

Definition at line 164 of file action.hpp.

editor_action_chain & editor::editor_action_chain::operator= ( const editor_action_chain other  ) 

Definition at line 78 of file action.cpp.

References actions_, and editor::editor_action::clone().

Here is the call graph for this function:

editor_action_chain * editor::editor_action_chain::perform ( map_context m  )  const [virtual]

Perform all the actions in order and create a undo action chain.

Reimplemented from editor::editor_action.

Definition at line 130 of file action.cpp.

References actions_, and empty().

Here is the call graph for this function:

void editor::editor_action_chain::perform_without_undo ( map_context m  )  const [virtual]

Perform all the actions in order.

Implements editor::editor_action.

Definition at line 140 of file action.cpp.

editor_action * editor::editor_action_chain::pop_first_action (  ) 

Remove the first added action and return it, transferring ownership to the caller.

Definition at line 124 of file action.cpp.

References actions_, and empty().

Referenced by editor::map_context::partial_undo().

Here is the call graph for this function:

Here is the caller graph for this function:

editor_action * editor::editor_action_chain::pop_last_action (  ) 

Remove the last added action and return it, transferring ownership to the caller.

Definition at line 118 of file action.cpp.

References actions_.

void editor::editor_action_chain::prepend_action ( editor_action a  ) 

Add an action at the beginning of the chain.

Definition at line 112 of file action.cpp.

Referenced by editor::map_context::perform_partial_action().

Here is the caller graph for this function:


Member Data Documentation

The action pointers owned by this action chain.

Definition at line 170 of file action.hpp.

Referenced by clone(), empty(), operator=(), perform(), pop_first_action(), pop_last_action(), and ~editor_action_chain().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:24 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs