-
Notifications
You must be signed in to change notification settings - Fork 0
/
i_command.h
73 lines (61 loc) · 1.17 KB
/
i_command.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef ICOMMAND_H
#define ICOMMAND_H
#include <boost/shared_ptr.hpp>
#include <diagram.h>
using boost::shared_ptr;
namespace cppgef
{
/**
* @class ICommand
* @author vincenzo.cappello
* @date 12/14/10
* @file icommand.h
*
* @brief Base class for commands
*/
class ICommand
{
public:
ICommand()
{
}
virtual ~ICommand()
{
}
/**
* @brief The diagram used by the command
*
* The cppgef::CommandManager class store the command on
* its stack according to this properties.
*
* @return the diagram
*/
virtual shared_ptr< Diagram > getDiagram() = 0;
/**
* @brief The command allow undo/redo
*
* If the command allow undo/redo the cppgef::CommandManager class
* after execute the command store it in the undo stack.
*
* @return true if the command allow undo/redo
*/
virtual bool allowUndo() const = 0;
/**
* @brief Execute the command
*
* Called on first execution and on redo
*
* @return command result, true for success
*/
virtual bool execute() = 0;
/**
* @brief Unexecute the command
*
* Called on undo
*
* @return command result, true for success
*/
virtual bool unexecute() = 0;
};
}
#endif // ICOMMAND_H