~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/db/mork/src/morkCursor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-  */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
9
 *
 
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.
 
14
 *
 
15
 * The Original Code is mozilla.org code.
 
16
 *
 
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.
 
21
 *
 
22
 * Contributor(s):
 
23
 *
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of
 
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
29
 * of those above. If you wish to allow use of your version of this file only
 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
31
 * use your version of this file under the terms of the NPL, indicate your
 
32
 * decision by deleting the provisions above and replace them with the notice
 
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
34
 * the provisions above, a recipient may use your version of this file under
 
35
 * the terms of any one of the NPL, the GPL or the LGPL.
 
36
 *
 
37
 * ***** END LICENSE BLOCK ***** */
 
38
 
 
39
#ifndef _MDB_
 
40
#include "mdb.h"
 
41
#endif
 
42
 
 
43
#ifndef _MORK_
 
44
#include "mork.h"
 
45
#endif
 
46
 
 
47
#ifndef _MORKNODE_
 
48
#include "morkNode.h"
 
49
#endif
 
50
 
 
51
#ifndef _MORKMAP_
 
52
#include "morkMap.h"
 
53
#endif
 
54
 
 
55
#ifndef _MORKENV_
 
56
#include "morkEnv.h"
 
57
#endif
 
58
 
 
59
#ifndef _MORKCURSOR_
 
60
#include "morkCursor.h"
 
61
#endif
 
62
 
 
63
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
 
64
 
 
65
// ````` ````` ````` ````` ````` 
 
66
// { ===== begin morkNode interface =====
 
67
 
 
68
/*public virtual*/ void
 
69
morkCursor::CloseMorkNode(morkEnv* ev) // CloseCursor() only if open
 
70
{
 
71
  if ( this->IsOpenNode() )
 
72
  {
 
73
    this->MarkClosing();
 
74
    this->CloseCursor(ev);
 
75
    this->MarkShut();
 
76
  }
 
77
}
 
78
 
 
79
/*public virtual*/
 
80
morkCursor::~morkCursor() // assert CloseCursor() executed earlier
 
81
{
 
82
}
 
83
 
 
84
/*public non-poly*/
 
85
morkCursor::morkCursor(morkEnv* ev,
 
86
  const morkUsage& inUsage, nsIMdbHeap* ioHeap)
 
87
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
 
88
, mCursor_Seed( 0 )
 
89
, mCursor_Pos( -1 )
 
90
, mCursor_DoFailOnSeedOutOfSync( morkBool_kFalse )
 
91
{
 
92
  if ( ev->Good() )
 
93
    mNode_Derived = morkDerived_kCursor;
 
94
}
 
95
 
 
96
NS_IMPL_ISUPPORTS_INHERITED1(morkCursor, morkObject, nsIMdbCursor)
 
97
 
 
98
/*public non-poly*/ void
 
99
morkCursor::CloseCursor(morkEnv* ev) // called by CloseMorkNode();
 
100
{
 
101
  if ( this )
 
102
  {
 
103
    if ( this->IsNode() )
 
104
    {
 
105
      mCursor_Seed = 0;
 
106
      mCursor_Pos = -1;
 
107
      this->MarkShut();
 
108
    }
 
109
    else
 
110
      this->NonNodeError(ev);
 
111
  }
 
112
  else
 
113
    ev->NilPointerError();
 
114
}
 
115
 
 
116
// { ----- begin ref counting for well-behaved cyclic graphs -----
 
117
NS_IMETHODIMP
 
118
morkCursor::GetWeakRefCount(nsIMdbEnv* mev, // weak refs
 
119
  mdb_count* outCount)
 
120
{
 
121
  *outCount = WeakRefsOnly();
 
122
  return NS_OK;
 
123
}  
 
124
NS_IMETHODIMP
 
125
morkCursor::GetStrongRefCount(nsIMdbEnv* mev, // strong refs
 
126
  mdb_count* outCount)
 
127
{
 
128
  *outCount = StrongRefsOnly();
 
129
  return NS_OK;
 
130
}
 
131
// ### TODO - clean up this cast, if required
 
132
NS_IMETHODIMP
 
133
morkCursor::AddWeakRef(nsIMdbEnv* mev)
 
134
{
 
135
  return morkNode::AddWeakRef((morkEnv *) mev);
 
136
}
 
137
NS_IMETHODIMP
 
138
morkCursor::AddStrongRef(nsIMdbEnv* mev)
 
139
{
 
140
  return morkNode::AddStrongRef((morkEnv *) mev);
 
141
}
 
142
 
 
143
NS_IMETHODIMP
 
144
morkCursor::CutWeakRef(nsIMdbEnv* mev)
 
145
{
 
146
  return morkNode::CutWeakRef((morkEnv *) mev);
 
147
}
 
148
NS_IMETHODIMP
 
149
morkCursor::CutStrongRef(nsIMdbEnv* mev)
 
150
{
 
151
  return morkNode::CutStrongRef((morkEnv *) mev);
 
152
}
 
153
 
 
154
  
 
155
NS_IMETHODIMP
 
156
morkCursor::CloseMdbObject(nsIMdbEnv* mev)
 
157
{
 
158
  return morkNode::CloseMdbObject((morkEnv *) mev);
 
159
}
 
160
 
 
161
NS_IMETHODIMP
 
162
morkCursor::IsOpenMdbObject(nsIMdbEnv* mev, mdb_bool* outOpen)
 
163
{
 
164
  *outOpen = IsOpenNode();
 
165
  return NS_OK;
 
166
}
 
167
NS_IMETHODIMP
 
168
morkCursor::IsFrozenMdbObject(nsIMdbEnv* mev, mdb_bool* outIsReadonly)
 
169
{
 
170
  *outIsReadonly = IsFrozen();
 
171
  return NS_OK;
 
172
}
 
173
// } ===== end morkNode methods =====
 
174
// ````` ````` ````` ````` ````` 
 
175
 
 
176
NS_IMETHODIMP
 
177
morkCursor::GetCount(nsIMdbEnv* mev, mdb_count* outCount)
 
178
{
 
179
  NS_ASSERTION(PR_FALSE, "not implemented");
 
180
  return NS_ERROR_NOT_IMPLEMENTED;
 
181
}
 
182
 
 
183
NS_IMETHODIMP
 
184
morkCursor::GetSeed(nsIMdbEnv* mev, mdb_seed* outSeed)
 
185
{
 
186
  NS_ASSERTION(PR_FALSE, "not implemented");
 
187
  return NS_ERROR_NOT_IMPLEMENTED;
 
188
}
 
189
 
 
190
NS_IMETHODIMP
 
191
morkCursor::SetPos(nsIMdbEnv* mev, mdb_pos inPos)
 
192
{
 
193
  NS_ASSERTION(PR_FALSE, "not implemented");
 
194
  return NS_ERROR_NOT_IMPLEMENTED;
 
195
}
 
196
 
 
197
NS_IMETHODIMP
 
198
morkCursor::GetPos(nsIMdbEnv* mev, mdb_pos* outPos)
 
199
{
 
200
  NS_ASSERTION(PR_FALSE, "not implemented");
 
201
  return NS_ERROR_NOT_IMPLEMENTED;
 
202
}
 
203
 
 
204
NS_IMETHODIMP
 
205
morkCursor::SetDoFailOnSeedOutOfSync(nsIMdbEnv* mev, mdb_bool inFail)
 
206
{
 
207
  NS_ASSERTION(PR_FALSE, "not implemented");
 
208
  return NS_ERROR_NOT_IMPLEMENTED;
 
209
}
 
210
 
 
211
NS_IMETHODIMP
 
212
morkCursor::GetDoFailOnSeedOutOfSync(nsIMdbEnv* mev, mdb_bool* outFail)
 
213
{
 
214
  NS_ASSERTION(PR_FALSE, "not implemented");
 
215
  return NS_ERROR_NOT_IMPLEMENTED;
 
216
}
 
217
 
 
218
 
 
219
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789