Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / db / mork / src / orkinPortTableCursor.h
blobcae4f7c8b28e440781adc17d0e7c0dfb288409aa
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
13 * License.
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.
22 * Contributor(s):
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 ***** */
38 #ifndef _ORKINPORTTABLECURSOR_
39 #define _ORKINPORTTABLECURSOR_ 1
41 #ifndef _MDB_
42 #include "mdb.h"
43 #endif
45 #ifndef _MORK_
46 #include "mork.h"
47 #endif
49 #ifndef _MORKNODE_
50 #include "morkNode.h"
51 #endif
53 #ifndef _MORKHANDLE_
54 #include "morkHandle.h"
55 #endif
57 #ifndef _MORKPORTTABLECURSOR_
58 #include "morkPortTableCursor.h"
59 #endif
61 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
63 class morkPortTableCursor;
64 #define morkMagic_kPortTableCursor 0x50744375 /* ascii 'PtCu' */
66 /*| orkinPortTableCursor: cursor class for iterating port tables
67 **|
68 **|| port: the cursor is associated with a specific port, which can be
69 **| set to a different port (which resets the position to -1 so the
70 **| next table acquired is the first in the port.
71 **|
72 |*/
73 class orkinPortTableCursor :
74 public morkHandle, public nsIMdbPortTableCursor { // nsIMdbCursor
76 // { ===== begin morkNode interface =====
77 public: // morkNode virtual methods
78 // virtual void CloseMorkNode(morkEnv* ev); // morkHandle is fine
79 virtual ~orkinPortTableCursor(); // morkHandle destructor does everything
81 protected: // construction is protected (use the static Make() method)
82 orkinPortTableCursor(morkEnv* ev, // note morkUsage is always morkUsage_kPool
83 morkHandleFace* ioFace, // must not be nil, cookie for this handle
84 morkPortTableCursor* ioObject); // must not be nil, the object for this handle
86 // void CloseHandle(morkEnv* ev); // don't need to specialize closing
88 private: // copying is not allowed
89 orkinPortTableCursor(const morkHandle& other);
90 orkinPortTableCursor& operator=(const morkHandle& other);
92 // public: // dynamic type identification
93 // mork_bool IsHandle() const //
94 // { return IsNode() && mNode_Derived == morkDerived_kHandle; }
95 // } ===== end morkNode methods =====
97 protected: // morkHandle memory management operators
98 void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev) CPP_THROW_NEW
99 { return ioPool.NewHandle(ev, inSize, &ioZone); }
101 void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev) CPP_THROW_NEW
102 { return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
104 void* operator new(size_t inSize, morkHandleFace* ioFace) CPP_THROW_NEW
105 { MORK_USED_1(inSize); return ioFace; }
108 public: // construction:
110 static orkinPortTableCursor* MakePortTableCursor(morkEnv* ev,
111 morkPortTableCursor* ioObject);
113 public: // utilities:
115 morkEnv* CanUsePortTableCursor(nsIMdbEnv* mev, mork_bool inMutable,
116 mdb_err* outErr) const;
118 public: // type identification
119 mork_bool IsOrkinPortTableCursor() const
120 { return mHandle_Magic == morkMagic_kPortTableCursor; }
122 mork_bool IsOrkinPortTableCursorHandle() const
123 { return this->IsHandle() && this->IsOrkinPortTableCursor(); }
125 NS_DECL_ISUPPORTS
126 // { ===== begin nsIMdbObject methods =====
128 // { ----- begin attribute methods -----
129 NS_IMETHOD IsFrozenMdbObject(nsIMdbEnv* ev, mdb_bool* outIsReadonly);
130 // same as nsIMdbPort::GetIsPortReadonly() when this object is inside a port.
131 // } ----- end attribute methods -----
133 // { ----- begin factory methods -----
134 NS_IMETHOD GetMdbFactory(nsIMdbEnv* ev, nsIMdbFactory** acqFactory);
135 // } ----- end factory methods -----
137 // { ----- begin ref counting for well-behaved cyclic graphs -----
138 NS_IMETHOD GetWeakRefCount(nsIMdbEnv* ev, // weak refs
139 mdb_count* outCount);
140 NS_IMETHOD GetStrongRefCount(nsIMdbEnv* ev, // strong refs
141 mdb_count* outCount);
143 NS_IMETHOD AddWeakRef(nsIMdbEnv* ev);
144 NS_IMETHOD AddStrongRef(nsIMdbEnv* ev);
146 NS_IMETHOD CutWeakRef(nsIMdbEnv* ev);
147 NS_IMETHOD CutStrongRef(nsIMdbEnv* ev);
149 NS_IMETHOD CloseMdbObject(nsIMdbEnv* ev); // called at strong refs zero
150 NS_IMETHOD IsOpenMdbObject(nsIMdbEnv* ev, mdb_bool* outOpen);
151 // } ----- end ref counting -----
153 // } ===== end nsIMdbObject methods =====
155 // { ===== begin nsIMdbCursor methods =====
157 // { ----- begin attribute methods -----
158 NS_IMETHOD GetCount(nsIMdbEnv* ev, mdb_count* outCount); // readonly
159 NS_IMETHOD GetSeed(nsIMdbEnv* ev, mdb_seed* outSeed); // readonly
161 NS_IMETHOD SetPos(nsIMdbEnv* ev, mdb_pos inPos); // mutable
162 NS_IMETHOD GetPos(nsIMdbEnv* ev, mdb_pos* outPos);
164 NS_IMETHOD SetDoFailOnSeedOutOfSync(nsIMdbEnv* ev, mdb_bool inFail);
165 NS_IMETHOD GetDoFailOnSeedOutOfSync(nsIMdbEnv* ev, mdb_bool* outFail);
166 // } ----- end attribute methods -----
168 // } ===== end nsIMdbCursor methods =====
170 // { ===== begin nsIMdbPortTableCursor methods =====
172 // { ----- begin attribute methods -----
173 NS_IMETHOD SetPort(nsIMdbEnv* ev, nsIMdbPort* ioPort); // sets pos to -1
174 NS_IMETHOD GetPort(nsIMdbEnv* ev, nsIMdbPort** acqPort);
176 NS_IMETHOD SetRowScope(nsIMdbEnv* ev, // sets pos to -1
177 mdb_scope inRowScope);
178 NS_IMETHOD GetRowScope(nsIMdbEnv* ev, mdb_scope* outRowScope);
179 // setting row scope to zero iterates over all row scopes in port
181 NS_IMETHOD SetTableKind(nsIMdbEnv* ev, // sets pos to -1
182 mdb_kind inTableKind);
183 NS_IMETHOD GetTableKind(nsIMdbEnv* ev, mdb_kind* outTableKind);
184 // setting table kind to zero iterates over all table kinds in row scope
185 // } ----- end attribute methods -----
187 // { ----- begin table iteration methods -----
188 NS_IMETHOD NextTable( // get table at next position in the db
189 nsIMdbEnv* ev, // context
190 nsIMdbTable** acqTable); // the next table in the iteration
191 // } ----- end table iteration methods -----
193 // } ===== end nsIMdbPortTableCursor methods =====
196 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
198 #endif /* _ORKINPORTTABLECURSOR_ */