source: molecuilder/src/Actions/Action.cpp@ 0012e6

Last change on this file since 0012e6 was 0012e6, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Added methods that allow bookkeeping of actions for undo/redo methods

  • Property mode set to 100644
File size: 825 bytes
Line 
1/*
2 * Action.cpp
3 *
4 * Created on: Dec 8, 2009
5 * Author: crueger
6 */
7
8#include <string>
9
10#include "Actions/Action.hpp"
11#include "Actions/ActionRegistry.hpp"
12
13using namespace std;
14
15// this object is only ever used as indicator.
16ActionState success_val;
17
18ActionState *Action::success = &success_val;
19
20Action::Action(std::string _name,bool _doRegister) :
21name(_name)
22{
23 if(_doRegister){
24 ActionRegistry::getInstance().registerAction(this);
25 }
26}
27
28Action::~Action()
29{}
30
31const string Action::getName(){
32 return name;
33}
34
35void Action::call(){
36 // forward to private virtual
37 performCall();
38}
39ActionState* Action::undo(ActionState* _state) {
40 // forward to private virtual
41 return performUndo(_state);
42}
43ActionState* Action::redo(ActionState* _state) {
44 // forward to private virtual
45 return performRedo(_state);
46}
Note: See TracBrowser for help on using the repository browser.