![]() |
|
|
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:Executes the transaction. Restores the state to what it was before the transaction was executed. 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.
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.
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.
Write a stream representation of the current state of the transaction. Parameter: aOutputStream - the stream to write to.
Returns the string to display for the undo menu item. Parameter aString - will point to string to display.
Returns the string to display for the redo menu item. Parameter aString - will point to string to display.
|
|||||||
| Copyright © 1998 The Mozilla Organization. | ||||||||