1/*
2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Stephan A��mus <superstippi@gmx.de>
7 */
8#ifndef COMMAND_STACK_H
9#define COMMAND_STACK_H
10
11#include <stack>
12
13#include "Notifier.h"
14
15class BString;
16class RWLocker;
17class Command;
18
19class CommandStack : public Notifier {
20 public:
21								CommandStack(RWLocker* locker);
22	virtual						~CommandStack();
23
24			status_t			Perform(Command* command);
25
26			status_t			Undo();
27			status_t			Redo();
28
29			bool				GetUndoName(BString& name);
30			bool				GetRedoName(BString& name);
31
32			void				Clear();
33			void				Save();
34			bool				IsSaved();
35
36 private:
37			status_t			_AddCommand(Command* command);
38
39			RWLocker*			fLocker;
40
41	typedef std::stack<Command*> command_stack;
42
43			command_stack		fUndoHistory;
44			command_stack		fRedoHistory;
45			Command*			fSavedCommand;
46};
47
48#endif // COMMAND_STACK_H
49