/* * ActionSequenze.cpp * * Created on: Dec 17, 2009 * Author: crueger */ #include "Actions/ActionSequence.hpp" #include "Actions/Action.hpp" using namespace std; ActionSequence::ActionSequence() {} ActionSequence::~ActionSequence() {} void ActionSequence::addAction(Action* _action){ actions.push_back(_action); } Action* ActionSequence::removeLastAction(){ if(actions.empty()) { return 0; } else { Action* theAction; theAction = actions.back(); actions.pop_back(); return theAction; } } void ActionSequence::callAll(){ deque::iterator it; for(it=actions.begin(); it!=actions.end(); it++) (*it)->call(); } void ActionSequence::undoAll(){ deque::reverse_iterator rit; for(rit=actions.rbegin(); rit!=actions.rend(); rit++) (*rit)->undo(); } bool ActionSequence::canUndo(){ bool canUndo=true; deque::iterator it; for(it=actions.begin(); it!=actions.end(); it++) canUndo &= (*it)->canUndo(); return canUndo; }