gecko-dev/editor/txmgr/nsTransactionStack.h

40 строки
1.1 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1998-11-24 03:43:31 +03:00
#ifndef nsTransactionStack_h__
#define nsTransactionStack_h__
#include <deque>
#include "nsAutoPtr.h"
1998-11-24 03:43:31 +03:00
class nsCycleCollectionTraversalCallback;
class nsTransactionItem;
1998-11-24 03:43:31 +03:00
class nsTransactionStack
{
public:
enum Type { FOR_UNDO, FOR_REDO };
1998-11-24 03:43:31 +03:00
explicit nsTransactionStack(Type aType);
~nsTransactionStack();
1998-11-24 03:43:31 +03:00
void Push(nsTransactionItem *aTransactionItem);
already_AddRefed<nsTransactionItem> Pop();
already_AddRefed<nsTransactionItem> PopBottom();
already_AddRefed<nsTransactionItem> Peek();
already_AddRefed<nsTransactionItem> GetItem(int32_t aIndex);
void Clear();
int32_t GetSize() { return mDeque.size(); }
void DoUnlink() { Clear(); }
void DoTraverse(nsCycleCollectionTraversalCallback &cb);
1998-11-24 03:43:31 +03:00
private:
std::deque<nsRefPtr<nsTransactionItem> > mDeque;
const Type mType;
1998-11-24 03:43:31 +03:00
};
#endif // nsTransactionStack_h__