Last change
on this file since 3e8325 was 3e8325, checked in by Tillmann Crueger <crueger@…>, 16 years ago |
Added a central registry that allows access to actions by name.
|
-
Property mode
set to
100644
|
File size:
697 bytes
|
Rev | Line | |
---|
[d20ed5] | 1 | /*
|
---|
| 2 | * Action.h
|
---|
| 3 | *
|
---|
| 4 | * Created on: Dec 8, 2009
|
---|
| 5 | * Author: crueger
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef ACTION_H_
|
---|
| 9 | #define ACTION_H_
|
---|
| 10 |
|
---|
[3e8325] | 11 | #include <string>
|
---|
| 12 |
|
---|
[da09909] | 13 | /**
|
---|
| 14 | * Base class for all actions.
|
---|
| 15 | *
|
---|
| 16 | * Actions describe something that has to be done.
|
---|
| 17 | * Actions can be passed around, stored, performed and undone (Command-Pattern).
|
---|
| 18 | *
|
---|
| 19 | * TODO: Add queues of actions that have been performed to allow easy implementation of multiple-step undo
|
---|
| 20 | */
|
---|
[d20ed5] | 21 | class Action
|
---|
| 22 | {
|
---|
| 23 | protected:
|
---|
[32df34] | 24 | public:
|
---|
[3e8325] | 25 | Action(std::string _name,bool _doRegister=true);
|
---|
[d20ed5] | 26 | virtual ~Action();
|
---|
| 27 |
|
---|
| 28 | virtual void call()=0;
|
---|
| 29 | virtual void undo()=0;
|
---|
| 30 | virtual bool canUndo()=0;
|
---|
| 31 |
|
---|
[3e8325] | 32 | virtual const std::string getName();
|
---|
| 33 |
|
---|
| 34 | private:
|
---|
| 35 | std::string name;
|
---|
[d20ed5] | 36 | };
|
---|
| 37 |
|
---|
| 38 | #endif /* ACTION_H_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.