xref: /haiku/src/kits/tracker/FSUndoRedo.h (revision 7a74a5df454197933bc6e80a542102362ee98703)
1 #ifndef _FS_UNDO_REDO_H
2 #define _FS_UNDO_REDO_H
3 
4 
5 #include "ObjectList.h"
6 #include <Entry.h>
7 
8 
9 namespace BPrivate {
10 
11 class UndoItem;
12 
13 class Undo {
14 	public:
15 		~Undo();
16 		void UpdateEntry(BEntry* entry, const char* destName);
17 		void Remove();
18 
19 	protected:
20 		UndoItem* fUndo;
21 };
22 
23 
24 class MoveCopyUndo : public Undo {
25 	public:
26 		MoveCopyUndo(BObjectList<entry_ref>* sourceList, BDirectory &dest,
27 			BList* pointList, uint32 moveMode);
28 };
29 
30 
31 class NewFolderUndo : public Undo {
32 	public:
33 		NewFolderUndo(const entry_ref &ref);
34 };
35 
36 
37 class RenameUndo : public Undo {
38 	public:
39 		RenameUndo(BEntry &entry, const char* newName);
40 };
41 
42 
43 class RenameVolumeUndo : public Undo {
44 	public:
45 		RenameVolumeUndo(BVolume &volume, const char* newName);
46 };
47 
48 
49 static
50 inline bool FSIsUndoMoveMode(uint32 moveMode)
51 {
52 	return (moveMode & '\xff\0\0\0') == 'U\0\0\0';
53 }
54 
55 
56 static
57 inline uint32 FSUndoMoveMode(uint32 moveMode)
58 {
59 	return (moveMode & ~'\xff\0\0\0') | 'U\0\0\0';
60 }
61 
62 
63 static
64 inline uint32 FSMoveMode(uint32 moveMode)
65 {
66 	return (moveMode & ~'\xff\0\0\0') | 'T\0\0\0';
67 }
68 
69 
70 extern void FSUndo();
71 extern void FSRedo();
72 
73 }	// namespace BPrivate
74 
75 #endif	// _FS_UNDO_REDO_H
76