~kiwec/ke

ke/src/History.h -rw-r--r-- 405 bytes
1cc8481d — Wolf Clément Fix compilation 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <stack>
#include "Event.h"

class Buffer;

/// Store events and handle undo/redo
class History {
	std::stack<Event*> m_done;
	std::stack<Event*> m_undone;

	/// True when in undo() or redo()
	bool m_working = false;

public:
	/// Add an event to history
	void log_event(Event* ev);

	/// Undo latest event
	bool undo(Buffer& buf);

	/// Redo latest event
	bool redo(Buffer& buf);
};