Scribus
Open source desktop publishing at your fingertips
Transaction Class Referenceabstract

#include <transaction.h>

Inheritance diagram for Transaction:

Classes

class  TransactionStateBase
 

Public Types

enum  Status { STATE_OPEN, STATE_WILLFAIL, STATE_FAILED, STATE_COMMITTED }
 

Public Member Functions

 Transaction (TransactionStateBase *data)
 
virtual ~Transaction ()
 
 operator bool () const
 
virtual bool commit ()=0
 
virtual bool cancel ()=0
 
virtual void markFailed ()
 
virtual void reset ()
 
int getState () const
 
bool isNull () const
 
bool isStarted () const
 
bool isOpened () const
 

Protected Attributes

QExplicitlySharedDataPointer< TransactionStateBasem_data
 

Detailed Description

Interface class for objects representing a going transaction. Will be specialized by classes like Undomanager for use as a result type in their beginTransaction() method.

Constructor & Destructor Documentation

virtual Transaction::~Transaction ( )
inlinevirtual

Automatically commits if forgotten. Override as appropiate. Since the superclass destructor is called last, you can cancel in the subclass destructor; the commit here then will do nothing. Don't forget to set m_data to NULL if you free the m_data pointer!

Member Function Documentation

virtual bool Transaction::cancel ( )
pure virtual

Cancels this transaction if in STATE_OPEN or STATE_WILLFAIL; otherwise do nothing Returns true iff the transaction was canceled.

Implemented in UndoTransaction.

virtual bool Transaction::commit ( )
pure virtual

Commits this transaction if in STATE_OPEN. If in STATE_WILLFAIL, cancel the transaction instead; otherwise do nothing. Returns true iff the transaction was committed or canceled.

Implemented in UndoTransaction.

void Transaction::markFailed ( )
virtual

Marks this transaction as failed.

Transaction::operator bool ( ) const
inline

Test if transaction has some valid data

void Transaction::reset ( void  )
virtual

Reset underlyng transaciton data


The documentation for this class was generated from the following files: