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
|
Line | |
---|
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 |
|
---|
11 | #include <string>
|
---|
12 |
|
---|
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 | */
|
---|
21 | class Action
|
---|
22 | {
|
---|
23 | protected:
|
---|
24 | public:
|
---|
25 | Action(std::string _name,bool _doRegister=true);
|
---|
26 | virtual ~Action();
|
---|
27 |
|
---|
28 | virtual void call()=0;
|
---|
29 | virtual void undo()=0;
|
---|
30 | virtual bool canUndo()=0;
|
---|
31 |
|
---|
32 | virtual const std::string getName();
|
---|
33 |
|
---|
34 | private:
|
---|
35 | std::string name;
|
---|
36 | };
|
---|
37 |
|
---|
38 | #endif /* ACTION_H_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.