/work/obj-fuzz/dist/include/mozilla/TransactionStack.h
Line | Count | Source (jump to first uncovered line) |
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 mozilla_TransactionStack_h |
7 | | #define mozilla_TransactionStack_h |
8 | | |
9 | | #include "nsDeque.h" |
10 | | |
11 | | class nsCycleCollectionTraversalCallback; |
12 | | |
13 | | namespace mozilla { |
14 | | |
15 | | class TransactionItem; |
16 | | |
17 | | class TransactionStack : private nsDeque |
18 | | { |
19 | | public: |
20 | | enum Type { FOR_UNDO, FOR_REDO }; |
21 | | |
22 | | explicit TransactionStack(Type aType); |
23 | | ~TransactionStack(); |
24 | | |
25 | | void Push(TransactionItem* aTransactionItem); |
26 | | void Push(already_AddRefed<TransactionItem> aTransactionItem); |
27 | | already_AddRefed<TransactionItem> Pop(); |
28 | | already_AddRefed<TransactionItem> PopBottom(); |
29 | | already_AddRefed<TransactionItem> Peek(); |
30 | | already_AddRefed<TransactionItem> GetItem(int32_t aIndex); |
31 | | void Clear(); |
32 | 0 | int32_t GetSize() const { return static_cast<int32_t>(nsDeque::GetSize()); } |
33 | 0 | bool IsEmpty() const { return GetSize() == 0; } |
34 | | |
35 | 0 | void DoUnlink() { Clear(); } |
36 | | void DoTraverse(nsCycleCollectionTraversalCallback &cb); |
37 | | |
38 | | private: |
39 | | const Type mType; |
40 | | }; |
41 | | |
42 | | } // namespace mozilla |
43 | | |
44 | | #endif // mozilla_TransactionStack_h |