1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/txmgr/src/nsTransactionStack.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsTransactionStack_h__ 1.10 +#define nsTransactionStack_h__ 1.11 + 1.12 +#include <deque> 1.13 +#include "nsAutoPtr.h" 1.14 + 1.15 +class nsCycleCollectionTraversalCallback; 1.16 +class nsTransactionItem; 1.17 + 1.18 +class nsTransactionStack 1.19 +{ 1.20 +public: 1.21 + enum Type { FOR_UNDO, FOR_REDO }; 1.22 + 1.23 + explicit nsTransactionStack(Type aType); 1.24 + ~nsTransactionStack(); 1.25 + 1.26 + void Push(nsTransactionItem *aTransactionItem); 1.27 + already_AddRefed<nsTransactionItem> Pop(); 1.28 + already_AddRefed<nsTransactionItem> PopBottom(); 1.29 + already_AddRefed<nsTransactionItem> Peek(); 1.30 + already_AddRefed<nsTransactionItem> GetItem(int32_t aIndex); 1.31 + void Clear(); 1.32 + int32_t GetSize() { return mDeque.size(); } 1.33 + 1.34 + void DoUnlink() { Clear(); } 1.35 + void DoTraverse(nsCycleCollectionTraversalCallback &cb); 1.36 + 1.37 +private: 1.38 + std::deque<nsRefPtr<nsTransactionItem> > mDeque; 1.39 + const Type mType; 1.40 +}; 1.41 + 1.42 +#endif // nsTransactionStack_h__