vfs: check userland buffers before reading them.
[haiku.git] / src / apps / haikudepot / edits_generic / EditManager.h
blob31dcb959969ae812bf1ee187bee83e276d720468
1 /*
2 * Copyright 2006-2012, Stephan Aßmus <superstippi@gmx.de>
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef EDIT_MANAGER_H
6 #define EDIT_MANAGER_H
8 #include "EditStack.h"
9 #include "UndoableEdit.h"
11 class BString;
12 class EditContext;
15 class EditManager {
16 public:
17 class Listener {
18 public:
19 virtual ~Listener();
20 virtual void EditManagerChanged(
21 const EditManager* manager) = 0;
24 public:
25 EditManager();
26 virtual ~EditManager();
28 status_t Perform(UndoableEdit* edit,
29 EditContext& context);
30 status_t Perform(const UndoableEditRef& edit,
31 EditContext& context);
33 status_t Undo(EditContext& context);
34 status_t Redo(EditContext& context);
36 bool GetUndoName(BString& name);
37 bool GetRedoName(BString& name);
39 void Clear();
40 void Save();
41 bool IsSaved();
43 bool AddListener(Listener* listener);
44 void RemoveListener(Listener* listener);
46 private:
47 status_t _AddEdit(const UndoableEditRef& edit);
49 void _NotifyListeners();
51 private:
52 EditStack fUndoHistory;
53 EditStack fRedoHistory;
54 UndoableEditRef fEditAtSave;
56 typedef List<Listener*, true, 4> ListenerList;
57 ListenerList fListeners;
60 #endif // EDIT_MANAGER_H