The Mozilla
Organization
Our Mission
Who We Are
Getting Involved
Community
Editorials
What's New
Newsbot
Development
Roadmap
Module Owners
Blue Sky
Projects
Status
Tools
Products
Source Code
Binaries
Documentation
License Terms
Bug Reports
Quality
Search
Feedback


Date last modified: Wed Feb 10 16:03:33 PST 1999


Transaction Interface Class:


class nsITransaction  : public nsISupports{
public:

  virtual nsresult Do(void) = 0;
  virtual nsresult Undo(void) = 0;
  virtual nsresult Redo(void) = 0;
  virtual nsresult GetIsTransient(PRBool *aIsTransient) = 0;
  virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction) = 0;
  virtual nsresult Write(nsIOutputStream *aOutputStream) = 0;
  virtual nsresult GetUndoString(nsString **aString) = 0;
  virtual nsresult GetRedoString(nsString **aString) = 0;
};


Transaction Interface Methods:

nsresult Do(void)

Executes the transaction.

nsresult Undo(void)

Restores the state to what it was before the transaction was executed.

nsresult Redo(void)

Executes the transaction again. Can only be called on a transaction that was previously undone.

In most cases, the Redo() method will actually call the Do() method to execute the transaction again.

nsresult GetIsTransient(PRBool *aIsTransient)

Retrieves the transaction's transient state. This method is called by the transaction manager after the transaction's Do() method is executed. If the transient state is false, a reference to the transaction is held by the transaction manager so that the transactions' Undo() and Redo() methods can be called. If the transient state is true, the transaction manager returns immediately after the transaction's Do() method is executed, no references to the transaction are maintained. Transient transactions cannot be undone or redone by the transaction manager.

Parameters

aIsTransient - will contain the transaction's transient state.

nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction)

Attempts to merge a transaction into "this" transaction. Both transactions must be in their undo state, Do() methods already executed. The transaction manager calls this method to coalesce a new transaction with the transaction on the top of the undo stack.

Parameters:

aDidMerge - will contain merge result. True if transactions were merged successfully. False if merge is not possible or failed. If true, the transaction manager will Release() the new transacton instead of pushing it on the undo stack.

aTransaction - the previously executed transaction to merge.

nsresult Write(nsIOutputStream *aOutputStream)

Write a stream representation of the current state of the transaction.

Parameter:

aOutputStream - the stream to write to.

nsresult GetUndoString(nsString **aString)

Returns the string to display for the undo menu item.

Parameter

aString - will point to string to display.

virtual nsresult GetRedoString(nsString **aString)

Returns the string to display for the redo menu item.

Parameter

aString - will point to string to display.




Copyright © 1998 The Mozilla Organization.