Back to index

lightning-sunbird  0.9+nobinonly
nsSHTransaction.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is the Mozilla browser.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications, Inc.
00020  * Portions created by the Initial Developer are Copyright (C) 1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Radha Kulkarni <radha@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 // Local Includes
00041 #include "nsSHTransaction.h"
00042 
00043 //*****************************************************************************
00044 //***    nsSHTransaction: Object Management
00045 //*****************************************************************************
00046 
00047 nsSHTransaction::nsSHTransaction() : mPersist(PR_TRUE), mPrev(nsnull) 
00048 {
00049 }
00050 
00051 
00052 nsSHTransaction::~nsSHTransaction()
00053 {
00054 }
00055 
00056 //*****************************************************************************
00057 //    nsSHTransaction: nsISupports
00058 //*****************************************************************************
00059 
00060 NS_IMPL_ADDREF(nsSHTransaction)
00061 NS_IMPL_RELEASE(nsSHTransaction)
00062 
00063 NS_INTERFACE_MAP_BEGIN(nsSHTransaction)
00064    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
00065    NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
00066 NS_INTERFACE_MAP_END
00067 
00068 //*****************************************************************************
00069 //    nsSHTransaction: nsISHTransaction
00070 //*****************************************************************************
00071 
00072 NS_IMETHODIMP
00073 nsSHTransaction::Create(nsISHEntry* aSHEntry, nsISHTransaction* aPrev)
00074 {
00075    SetSHEntry(aSHEntry);
00076        if(aPrev)
00077       aPrev->SetNext(this);
00078 
00079    SetPrev(aPrev);
00080        return NS_OK;
00081 }
00082 
00083 NS_IMETHODIMP
00084 nsSHTransaction::GetSHEntry(nsISHEntry ** aResult)
00085 {
00086    NS_ENSURE_ARG_POINTER(aResult);
00087        *aResult = mSHEntry;
00088        NS_IF_ADDREF(*aResult);
00089        return NS_OK;
00090 }
00091 
00092 
00093 NS_IMETHODIMP
00094 nsSHTransaction::SetSHEntry(nsISHEntry * aSHEntry)
00095 {
00096        mSHEntry = aSHEntry;
00097        return NS_OK;
00098 }
00099 
00100 
00101 NS_IMETHODIMP
00102 nsSHTransaction::GetNext(nsISHTransaction * * aResult)
00103 {
00104    NS_ENSURE_ARG_POINTER(aResult);
00105    *aResult = mNext;
00106    NS_IF_ADDREF(*aResult);
00107    return NS_OK;
00108 }
00109 
00110 
00111 NS_IMETHODIMP
00112 nsSHTransaction::SetNext(nsISHTransaction * aNext)
00113 {
00114    NS_ENSURE_SUCCESS(aNext->SetPrev(this), NS_ERROR_FAILURE);
00115 
00116    mNext = aNext;
00117    return NS_OK;
00118 }
00119 
00120 NS_IMETHODIMP
00121 nsSHTransaction::SetPrev(nsISHTransaction * aPrev)
00122 {
00123        /* This is weak reference to parent. Do not Addref it */
00124      mPrev = aPrev;
00125         return NS_OK;
00126 }
00127 
00128 nsresult
00129 nsSHTransaction::GetPrev(nsISHTransaction ** aResult)
00130 {
00131    NS_ENSURE_ARG_POINTER(aResult);
00132    *aResult  = mPrev;
00133    NS_IF_ADDREF(*aResult);
00134    return NS_OK;
00135 }
00136 
00137 NS_IMETHODIMP
00138 nsSHTransaction::SetPersist(PRBool aPersist)
00139 {
00140    mPersist = aPersist;
00141    return NS_OK;
00142 }
00143 
00144 NS_IMETHODIMP
00145 nsSHTransaction::GetPersist(PRBool* aPersist)
00146 {
00147    NS_ENSURE_ARG_POINTER(aPersist);
00148 
00149    *aPersist = mPersist;
00150    return NS_OK;
00151 }