-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUndoRedo.h
70 lines (56 loc) · 1.16 KB
/
UndoRedo.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
#pragma once
#include"BaseLib/CommonDefines.h"
#include"BaseLib/Export.h"
namespace BaseLib { namespace Policy {
namespace UndoRedoKind {
enum Type
{
UNDO,
REDO,
UNDO_AND_REDO
};
}
class DLL_STATE UndoRedo
{
public:
UndoRedo(UndoRedoKind::Type kind, int undoDepth, int redoDepth)
: kind_(kind)
, undoDepth_(undoDepth)
, redoDepth_(redoDepth)
{ }
virtual ~UndoRedo()
{ }
UndoRedoKind::Type Kind() const
{
return kind_;
}
int UndoDepth() const
{
return undoDepth_;
}
int RedoDepth() const
{
return redoDepth_;
}
static UndoRedo Undo(int depth = 5)
{
return UndoRedo(UndoRedoKind::UNDO, depth, 0);
}
static UndoRedo Redo(int depth = 5)
{
return UndoRedo(UndoRedoKind::REDO, 0, depth);
}
static UndoRedo UndoAndRedo(int depth = 5)
{
return UndoRedo(UndoRedoKind::UNDO_AND_REDO, depth, depth);
}
bool operator==(const UndoRedo& other)
{
return kind_ == other.kind_;
}
private:
UndoRedoKind::Type kind_;
int undoDepth_;
int redoDepth_;
};
}}