Ignore:
Timestamp:
Jan 7, 2010, 2:46:34 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
d97af9
Parents:
34ff5e6
Message:

Added a central registry that allows access to actions by name.

Location:
molecuilder/src/Actions
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Actions/Action.cpp

    r34ff5e6 r3e8325  
    66 */
    77
    8 #include "Action.hpp"
     8#include <string>
    99
    10 Action::Action()
    11 {}
     10#include "Actions/Action.hpp"
     11#include "Actions/ActionRegistry.hpp"
     12
     13using namespace std;
     14
     15Action::Action(std::string _name,bool _doRegister) :
     16name(_name)
     17{
     18  if(_doRegister){
     19    ActionRegistry::getRegistry()->registerAction(this);
     20  }
     21}
    1222
    1323Action::~Action()
    1424{}
     25
     26const string Action::getName(){
     27  return name;
     28}
  • molecuilder/src/Actions/Action.hpp

    r34ff5e6 r3e8325  
    88#ifndef ACTION_H_
    99#define ACTION_H_
     10
     11#include <string>
    1012
    1113/**
     
    2123protected:
    2224public:
    23   Action();
     25  Action(std::string _name,bool _doRegister=true);
    2426  virtual ~Action();
    2527
     
    2830  virtual bool canUndo()=0;
    2931
     32  virtual const std::string getName();
     33
     34private:
     35  std::string name;
    3036};
    3137
  • molecuilder/src/Actions/ErrorAction.cpp

    r34ff5e6 r3e8325  
    1414using namespace std;
    1515
    16 ErrorAction::ErrorAction(const char * _errorMsg) :
     16ErrorAction::ErrorAction(string _name,const char * _errorMsg,bool _doRegister) :
     17Action(_name,_doRegister),
    1718errorMsg(_errorMsg)
    1819{
  • molecuilder/src/Actions/ErrorAction.hpp

    r34ff5e6 r3e8325  
    1515{
    1616public:
    17   ErrorAction(const char *);
     17  ErrorAction(std::string _name,const char * _errorMsg,bool _doRegister=true);
    1818  virtual ~ErrorAction();
    1919
  • molecuilder/src/Actions/MakroAction.cpp

    r34ff5e6 r3e8325  
    66 */
    77
     8#include <string>
     9
    810#include "Actions/MakroAction.hpp"
    911#include "Actions/Action.hpp"
    1012#include "Actions/ActionSequence.hpp"
    1113
    12 MakroAction::MakroAction(ActionSequence* _actions) :
     14using namespace std;
     15
     16MakroAction::MakroAction(string _name,ActionSequence* _actions,bool _doRegister) :
     17Action(_name,_doRegister),
    1318actions(_actions)
    1419{
  • molecuilder/src/Actions/MakroAction.hpp

    r34ff5e6 r3e8325  
    88#ifndef MAKROACTION_HPP_
    99#define MAKROACTION_HPP_
     10
     11#include <string>
    1012
    1113#include "Actions/Action.hpp"
     
    2123{
    2224public:
    23   MakroAction(ActionSequence*);
     25  MakroAction(std::string _name,ActionSequence* _actions,bool _doRegister=true);
    2426  virtual ~MakroAction();
    2527
  • molecuilder/src/Actions/MethodAction.cpp

    r34ff5e6 r3e8325  
    88#include <iostream>
    99#include <boost/function.hpp>
     10#include <string>
    1011
    1112#include "MethodAction.hpp"
     
    1314using namespace std;
    1415
    15 MethodAction::MethodAction(boost::function<void()> _executeMethod) :
     16MethodAction::MethodAction(string _name,boost::function<void()> _executeMethod,bool _doRegister) :
     17   Action(_name,_doRegister),
    1618executeMethod(_executeMethod)
    1719{
  • molecuilder/src/Actions/MethodAction.hpp

    r34ff5e6 r3e8325  
    1010
    1111#include <boost/function.hpp>
     12#include <string>
    1213
    1314#include "Actions/Action.hpp"
     
    1920{
    2021public:
    21   MethodAction(boost::function<void()>);
     22  MethodAction(std::string _name,boost::function<void()> _executeMethod,bool _doRegister=true);
    2223  virtual ~MethodAction();
    2324
Note: See TracChangeset for help on using the changeset viewer.