1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : *
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is the Mozilla browser.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Netscape Communications, Inc.
20 : * Portions created by the Initial Developer are Copyright (C) 1999
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Radha Kulkarni <radha@netscape.com>
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either of the GNU General Public License Version 2 or later (the "GPL"),
28 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : // Local Includes
41 : #include "nsSHTransaction.h"
42 :
43 : //*****************************************************************************
44 : //*** nsSHTransaction: Object Management
45 : //*****************************************************************************
46 :
47 0 : nsSHTransaction::nsSHTransaction() : mPersist(true), mPrev(nsnull)
48 : {
49 0 : }
50 :
51 :
52 0 : nsSHTransaction::~nsSHTransaction()
53 : {
54 0 : }
55 :
56 : //*****************************************************************************
57 : // nsSHTransaction: nsISupports
58 : //*****************************************************************************
59 :
60 0 : NS_IMPL_ADDREF(nsSHTransaction)
61 0 : NS_IMPL_RELEASE(nsSHTransaction)
62 :
63 0 : NS_INTERFACE_MAP_BEGIN(nsSHTransaction)
64 0 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
65 0 : NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
66 0 : NS_INTERFACE_MAP_END
67 :
68 : //*****************************************************************************
69 : // nsSHTransaction: nsISHTransaction
70 : //*****************************************************************************
71 :
72 : NS_IMETHODIMP
73 0 : nsSHTransaction::Create(nsISHEntry* aSHEntry, nsISHTransaction* aPrev)
74 : {
75 0 : SetSHEntry(aSHEntry);
76 0 : if(aPrev)
77 0 : aPrev->SetNext(this);
78 :
79 0 : SetPrev(aPrev);
80 0 : return NS_OK;
81 : }
82 :
83 : NS_IMETHODIMP
84 0 : nsSHTransaction::GetSHEntry(nsISHEntry ** aResult)
85 : {
86 0 : NS_ENSURE_ARG_POINTER(aResult);
87 0 : *aResult = mSHEntry;
88 0 : NS_IF_ADDREF(*aResult);
89 0 : return NS_OK;
90 : }
91 :
92 :
93 : NS_IMETHODIMP
94 0 : nsSHTransaction::SetSHEntry(nsISHEntry * aSHEntry)
95 : {
96 0 : mSHEntry = aSHEntry;
97 0 : return NS_OK;
98 : }
99 :
100 :
101 : NS_IMETHODIMP
102 0 : nsSHTransaction::GetNext(nsISHTransaction * * aResult)
103 : {
104 0 : NS_ENSURE_ARG_POINTER(aResult);
105 0 : *aResult = mNext;
106 0 : NS_IF_ADDREF(*aResult);
107 0 : return NS_OK;
108 : }
109 :
110 :
111 : NS_IMETHODIMP
112 0 : nsSHTransaction::SetNext(nsISHTransaction * aNext)
113 : {
114 0 : if (aNext) {
115 0 : NS_ENSURE_SUCCESS(aNext->SetPrev(this), NS_ERROR_FAILURE);
116 : }
117 :
118 0 : mNext = aNext;
119 0 : return NS_OK;
120 : }
121 :
122 : NS_IMETHODIMP
123 0 : nsSHTransaction::SetPrev(nsISHTransaction * aPrev)
124 : {
125 : /* This is weak reference to parent. Do not Addref it */
126 0 : mPrev = aPrev;
127 0 : return NS_OK;
128 : }
129 :
130 : nsresult
131 0 : nsSHTransaction::GetPrev(nsISHTransaction ** aResult)
132 : {
133 0 : NS_ENSURE_ARG_POINTER(aResult);
134 0 : *aResult = mPrev;
135 0 : NS_IF_ADDREF(*aResult);
136 0 : return NS_OK;
137 : }
138 :
139 : NS_IMETHODIMP
140 0 : nsSHTransaction::SetPersist(bool aPersist)
141 : {
142 0 : mPersist = aPersist;
143 0 : return NS_OK;
144 : }
145 :
146 : NS_IMETHODIMP
147 0 : nsSHTransaction::GetPersist(bool* aPersist)
148 : {
149 0 : NS_ENSURE_ARG_POINTER(aPersist);
150 :
151 0 : *aPersist = mPersist;
152 0 : return NS_OK;
153 : }
|