editor/txmgr/src/nsTransactionStack.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:0154c22b7525
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef nsTransactionStack_h__
7 #define nsTransactionStack_h__
8
9 #include <deque>
10 #include "nsAutoPtr.h"
11
12 class nsCycleCollectionTraversalCallback;
13 class nsTransactionItem;
14
15 class nsTransactionStack
16 {
17 public:
18 enum Type { FOR_UNDO, FOR_REDO };
19
20 explicit nsTransactionStack(Type aType);
21 ~nsTransactionStack();
22
23 void Push(nsTransactionItem *aTransactionItem);
24 already_AddRefed<nsTransactionItem> Pop();
25 already_AddRefed<nsTransactionItem> PopBottom();
26 already_AddRefed<nsTransactionItem> Peek();
27 already_AddRefed<nsTransactionItem> GetItem(int32_t aIndex);
28 void Clear();
29 int32_t GetSize() { return mDeque.size(); }
30
31 void DoUnlink() { Clear(); }
32 void DoTraverse(nsCycleCollectionTraversalCallback &cb);
33
34 private:
35 std::deque<nsRefPtr<nsTransactionItem> > mDeque;
36 const Type mType;
37 };
38
39 #endif // nsTransactionStack_h__

mercurial