Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions | Protected Member Functions
TransactionFactory Class Reference

This class instantiates and optionally recycles edit transactions A recycler would be a separate static object, since this class does not get instantiated. More...

#include <TransactionFactory.h>

List of all members.

Static Public Member Functions

static nsresult GetNewTransaction (REFNSIID aTxnType, EditTxn **aResult)
 return a transaction object of aTxnType, refcounted

Protected Member Functions

 TransactionFactory ()
virtual ~TransactionFactory ()

Detailed Description

This class instantiates and optionally recycles edit transactions A recycler would be a separate static object, since this class does not get instantiated.

Definition at line 49 of file TransactionFactory.h.


Constructor & Destructor Documentation

Definition at line 60 of file TransactionFactory.cpp.

{
}
TransactionFactory::~TransactionFactory ( ) [protected, virtual]

Definition at line 64 of file TransactionFactory.cpp.

{
}

Member Function Documentation

nsresult TransactionFactory::GetNewTransaction ( REFNSIID  aTxnType,
EditTxn **  aResult 
) [static]

return a transaction object of aTxnType, refcounted

Returns:
NS_ERROR_NO_INTERFACE if aTxnType is unknown, NS_ERROR_OUT_OF_MEMORY if the allocations fails.

Definition at line 69 of file TransactionFactory.cpp.

{
  nsresult result = NS_OK;
  *aResult = nsnull;
  if (aTxnType.Equals(InsertTextTxn::GetCID()))
    *aResult = new InsertTextTxn();
  else if (aTxnType.Equals(DeleteTextTxn::GetCID()))
    *aResult = new DeleteTextTxn();
  else if (aTxnType.Equals(CreateElementTxn::GetCID()))
    *aResult = new CreateElementTxn();
  else if (aTxnType.Equals(InsertElementTxn::GetCID()))
    *aResult = new InsertElementTxn();
  else if (aTxnType.Equals(DeleteElementTxn::GetCID()))
    *aResult = new DeleteElementTxn();
  else if (aTxnType.Equals(DeleteRangeTxn::GetCID()))
    *aResult = new DeleteRangeTxn();
  else if (aTxnType.Equals(ChangeAttributeTxn::GetCID()))
    *aResult = new ChangeAttributeTxn();
#ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
  else if (aTxnType.Equals(ChangeCSSInlineStyleTxn::GetCID()))
    *aResult = new ChangeCSSInlineStyleTxn();
#endif // MOZILLA_PLAINTEXT_EDITOR_ONLY
  else if (aTxnType.Equals(SplitElementTxn::GetCID()))
    *aResult = new SplitElementTxn();
  else if (aTxnType.Equals(JoinElementTxn::GetCID()))
    *aResult = new JoinElementTxn();
  else if (aTxnType.Equals(EditAggregateTxn::GetCID()))
    *aResult = new EditAggregateTxn();
  else if (aTxnType.Equals(IMETextTxn::GetCID()))
    *aResult = new IMETextTxn();
  else if (aTxnType.Equals(AddStyleSheetTxn::GetCID()))
    *aResult = new AddStyleSheetTxn();
  else if (aTxnType.Equals(RemoveStyleSheetTxn::GetCID()))
    *aResult = new RemoveStyleSheetTxn();
#ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
  else if (aTxnType.Equals(SetDocTitleTxn::GetCID()))
    *aResult = new SetDocTitleTxn();
#endif // MOZILLA_PLAINTEXT_EDITOR_ONLY
  else if (aTxnType.Equals(PlaceholderTxn::GetCID()))
    *aResult = new PlaceholderTxn();
  else
    result = NS_ERROR_NO_INTERFACE;
  
  if (NS_SUCCEEDED(result) && !*aResult)
    result = NS_ERROR_OUT_OF_MEMORY;

  if (NS_SUCCEEDED(result))
    NS_ADDREF(*aResult);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:


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