repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / mediaplayer / support / CommandStack.h
blob3e8414d3db2a192c5ab5cffa2d34490f64f290a9
1 /*
2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
8 #ifndef COMMAND_STACK_H
9 #define COMMAND_STACK_H
11 #include <stack>
13 #include "Notifier.h"
15 class BString;
16 class RWLocker;
17 class Command;
19 class CommandStack : public Notifier {
20 public:
21 CommandStack(RWLocker* locker);
22 virtual ~CommandStack();
24 status_t Perform(Command* command);
26 status_t Undo();
27 status_t Redo();
29 bool GetUndoName(BString& name);
30 bool GetRedoName(BString& name);
32 void Clear();
33 void Save();
34 bool IsSaved();
36 private:
37 status_t _AddCommand(Command* command);
39 RWLocker* fLocker;
41 typedef std::stack<Command*> command_stack;
43 command_stack fUndoHistory;
44 command_stack fRedoHistory;
45 Command* fSavedCommand;
48 #endif // COMMAND_STACK_H