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