1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1999
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
55 #include "morkCursor.h"
58 #ifndef _MORKSORTINGROWCURSOR_
59 #include "morkSortingRowCursor.h"
62 #ifndef _ORKINTABLEROWCURSOR_
63 #include "orkinTableRowCursor.h"
67 #include "morkStore.h"
71 #include "morkTable.h"
75 #include "morkSorting.h"
82 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
84 // ````` ````` ````` ````` `````
85 // { ===== begin morkNode interface =====
87 /*public virtual*/ void
88 morkSortingRowCursor::CloseMorkNode(morkEnv
* ev
) // CloseSortingRowCursor() only if open
90 if ( this->IsOpenNode() )
93 this->CloseSortingRowCursor(ev
);
99 morkSortingRowCursor::~morkSortingRowCursor() // CloseSortingRowCursor() executed earlier
101 MORK_ASSERT(this->IsShutNode());
105 morkSortingRowCursor::morkSortingRowCursor(morkEnv
* ev
,
106 const morkUsage
& inUsage
,
107 nsIMdbHeap
* ioHeap
, morkTable
* ioTable
, mork_pos inRowPos
,
108 morkSorting
* ioSorting
)
109 : morkTableRowCursor(ev
, inUsage
, ioHeap
, ioTable
, inRowPos
)
110 , mSortingRowCursor_Sorting( 0 )
116 morkSorting::SlotWeakSorting(ioSorting
, ev
, &mSortingRowCursor_Sorting
);
119 // mNode_Derived = morkDerived_kTableRowCursor;
120 // mNode_Derived must stay equal to kTableRowCursor
124 ev
->NilPointerError();
128 /*public non-poly*/ void
129 morkSortingRowCursor::CloseSortingRowCursor(morkEnv
* ev
)
133 if ( this->IsNode() )
137 morkSorting::SlotWeakSorting((morkSorting
*) 0, ev
, &mSortingRowCursor_Sorting
);
138 this->CloseTableRowCursor(ev
);
142 this->NonNodeError(ev
);
145 ev
->NilPointerError();
148 // } ===== end morkNode methods =====
149 // ````` ````` ````` ````` `````
152 morkSortingRowCursor::NonSortingRowCursorTypeError(morkEnv
* ev
)
154 ev
->NewError("non morkSortingRowCursor");
158 morkSortingRowCursor::AcquireUniqueRowCursorHandle(morkEnv
* ev
)
160 return this->AcquireTableRowCursorHandle(ev
);
164 morkSortingRowCursor::CanHaveDupRowMembers(morkEnv
* ev
)
166 return morkBool_kFalse
; // false is correct
170 morkSortingRowCursor::GetMemberCount(morkEnv
* ev
)
172 morkTable
* table
= mTableRowCursor_Table
;
174 return table
->mTable_RowArray
.mArray_Fill
;
178 // morkSorting* sorting = mSortingRowCursor_Sorting;
180 // return sorting->mSorting_RowArray.mArray_Fill;
186 morkSortingRowCursor::NextRow(morkEnv
* ev
, mdbOid
* outOid
, mdb_pos
* outPos
)
191 morkSorting
* sorting
= mSortingRowCursor_Sorting
;
194 if ( sorting
->IsOpenNode() )
196 morkArray
* array
= &sorting
->mSorting_RowArray
;
203 if ( pos
< (mork_pos
)(array
->mArray_Fill
))
205 mCursor_Pos
= pos
; // update for next time
206 morkRow
* row
= (morkRow
*) array
->At(pos
);
212 *outOid
= row
->mRow_Oid
;
215 row
->NonRowTypeError(ev
);
218 ev
->NilPointerError();
222 outOid
->mOid_Scope
= 0;
223 outOid
->mOid_Id
= morkId_kMinusOne
;
227 sorting
->NonOpenNodeError(ev
);
230 ev
->NilPointerError();
236 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789