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

« back to all changes in this revision

Viewing changes to mozilla/db/mork/src/orkinCell.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 _MORKHANDLE_
 
52
#include "morkHandle.h"
 
53
#endif
 
54
 
 
55
#ifndef _MORKCELL_
 
56
#include "morkCell.h"
 
57
#endif
 
58
 
 
59
#ifndef _MORKCELLOBJECT_
 
60
#include "morkCellObject.h"
 
61
#endif
 
62
 
 
63
#ifndef _MORKROWOBJECT_
 
64
#include "morkRowObject.h"
 
65
#endif
 
66
 
 
67
#ifndef _ORKINCELL_
 
68
#include "orkinCell.h"
 
69
#endif
 
70
 
 
71
#ifndef _MORKENV_
 
72
#include "morkEnv.h"
 
73
#endif
 
74
 
 
75
#ifndef _MORKPOOL_
 
76
#include "morkPool.h"
 
77
#endif
 
78
 
 
79
#ifndef _MORKROW_
 
80
#include "morkRow.h"
 
81
#endif
 
82
 
 
83
#ifndef _MORKATOM_
 
84
#include "morkAtom.h"
 
85
#endif
 
86
 
 
87
#ifndef _MORKSPACE_
 
88
#include "morkSpace.h"
 
89
#endif
 
90
 
 
91
#ifndef _MORKROWSPACE_
 
92
#include "morkRowSpace.h"
 
93
#endif
 
94
 
 
95
#ifndef _MORKSTORE_
 
96
#include "morkStore.h"
 
97
#endif
 
98
 
 
99
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
 
100
 
 
101
/* public virtual*/
 
102
orkinCell:: ~orkinCell() // morkHandle destructor does everything
 
103
{
 
104
}
 
105
 
 
106
/*protected non-poly construction*/
 
107
orkinCell::orkinCell(morkEnv* ev, // morkUsage is morkUsage_kPool
 
108
    morkHandleFace* ioFace,    // must not be nil, cookie for this handle
 
109
    morkCellObject* ioObject)  // must not be nil, the object for this handle
 
110
: morkHandle(ev, ioFace, ioObject, morkMagic_kCell)
 
111
{
 
112
  // do not modify mNode_Derived; leave it equal to morkDerived_kHandle
 
113
}
 
114
 
 
115
 
 
116
/*static */ orkinCell*
 
117
orkinCell::MakeCell(morkEnv* ev, morkCellObject* ioObject)
 
118
{
 
119
  mork_bool isEnv = ev->IsEnv();
 
120
  MORK_ASSERT(isEnv);
 
121
  if ( isEnv )
 
122
  {
 
123
    morkHandleFace* face = ev->NewHandle(sizeof(orkinCell));
 
124
    if ( face )
 
125
      return new(face) orkinCell(ev, face, ioObject);
 
126
    else
 
127
      ev->OutOfMemoryError();
 
128
  }
 
129
    
 
130
  return (orkinCell*) 0;
 
131
}
 
132
 
 
133
// ResyncWithRow() moved to the morkCellObject class:
 
134
// mork_bool
 
135
// orkinCell::ResyncWithRow(morkEnv* ev)
 
136
// {
 
137
//   morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
138
//   morkRow* row = cellObj->mCellObject_Row;
 
139
//   mork_pos pos = 0;
 
140
//   morkCell* cell = row->GetCell(ev, cellObj->mCellObject_Col, &pos);
 
141
//   if ( cell )
 
142
//   {
 
143
//     cellObj->mCellObject_Pos = pos;
 
144
//     cellObj->mCellObject_Cell = cell;
 
145
//     cellObj->mCellObject_RowSeed = row->mRow_Seed;
 
146
//   }
 
147
//   else
 
148
//   {
 
149
//     cellObj->mCellObject_Cell = 0;
 
150
//     cellObj->MissingRowColumnError(ev);
 
151
//   }
 
152
//   return ev->Good();
 
153
// }
 
154
 
 
155
morkEnv*
 
156
orkinCell::CanUseCell(nsIMdbEnv* mev, mork_bool inMutable,
 
157
  mdb_err* outErr, morkCell** outCell) const
 
158
{
 
159
  morkEnv* outEnv = 0;
 
160
  morkCell* cell = 0;
 
161
  morkEnv* ev = morkEnv::FromMdbEnv(mev);
 
162
  if ( ev )
 
163
  {
 
164
    morkCellObject* cellObj = (morkCellObject*)
 
165
      this->GetGoodHandleObject(ev, inMutable, morkMagic_kCell,
 
166
        /*inClosedOkay*/ morkBool_kFalse);
 
167
    if ( cellObj )
 
168
    {
 
169
      if ( cellObj->IsCellObject() )
 
170
      {
 
171
        if ( cellObj->IsMutable() || !inMutable )
 
172
        {
 
173
          morkRowObject* rowObj = cellObj->mCellObject_RowObject;
 
174
          if ( rowObj )
 
175
          {
 
176
            morkRow* row = cellObj->mCellObject_Row;
 
177
            if ( row )
 
178
            {
 
179
              if ( rowObj->mRowObject_Row == row )
 
180
              {
 
181
                mork_u2 oldSeed = cellObj->mCellObject_RowSeed;
 
182
                if ( row->mRow_Seed == oldSeed || cellObj->ResyncWithRow(ev) )
 
183
                {
 
184
                  cell = cellObj->mCellObject_Cell;
 
185
                  if ( cell )
 
186
                  {
 
187
                    outEnv = ev;
 
188
                  }
 
189
                  else
 
190
                    cellObj->NilCellError(ev);
 
191
                }
 
192
              }
 
193
              else
 
194
                cellObj->WrongRowObjectRowError(ev);
 
195
            }
 
196
            else
 
197
              cellObj->NilRowError(ev);
 
198
          }
 
199
          else
 
200
            cellObj->NilRowObjectError(ev);
 
201
        }
 
202
        else
 
203
          cellObj->NonMutableNodeError(ev);
 
204
      }
 
205
      else
 
206
        cellObj->NonCellObjectTypeError(ev);
 
207
    }
 
208
    *outErr = ev->AsErr();
 
209
  }
 
210
  MORK_ASSERT(outEnv);
 
211
  *outCell = cell;
 
212
  
 
213
  return outEnv;
 
214
}
 
215
 
 
216
// { ===== begin nsIMdbISupports methods =====
 
217
NS_IMPL_QUERY_INTERFACE0(orkinCell)
 
218
 
 
219
/*virtual*/ nsrefcnt
 
220
orkinCell::AddRef() // add strong ref with no
 
221
{
 
222
  morkEnv* ev = mHandle_Env;
 
223
  if ( ev && ev->IsEnv() )
 
224
    return this->Handle_AddStrongRef(ev->AsMdbEnv());
 
225
  else
 
226
    return morkEnv_kNonEnvTypeError;
 
227
}
 
228
 
 
229
/*virtual*/ nsrefcnt
 
230
orkinCell::Release() // cut strong ref
 
231
{
 
232
  morkEnv* ev = mHandle_Env;
 
233
  if ( ev && ev->IsEnv() )
 
234
    return this->Handle_CutStrongRef(ev->AsMdbEnv());
 
235
  else
 
236
    return morkEnv_kNonEnvTypeError;
 
237
}
 
238
// } ===== end nsIMdbISupports methods =====
 
239
 
 
240
// { ===== begin nsIMdbObject methods =====
 
241
 
 
242
// { ----- begin attribute methods -----
 
243
/*virtual*/ mdb_err
 
244
orkinCell::IsFrozenMdbObject(nsIMdbEnv* mev, mdb_bool* outIsReadonly)
 
245
{
 
246
  return this->Handle_IsFrozenMdbObject(mev, outIsReadonly);
 
247
}
 
248
// same as nsIMdbPort::GetIsPortReadonly() when this object is inside a port.
 
249
// } ----- end attribute methods -----
 
250
 
 
251
// { ----- begin factory methods -----
 
252
/*virtual*/ mdb_err
 
253
orkinCell::GetMdbFactory(nsIMdbEnv* mev, nsIMdbFactory** acqFactory)
 
254
{
 
255
  return this->Handle_GetMdbFactory(mev, acqFactory);
 
256
 
257
// } ----- end factory methods -----
 
258
 
 
259
// { ----- begin ref counting for well-behaved cyclic graphs -----
 
260
/*virtual*/ mdb_err
 
261
orkinCell::GetWeakRefCount(nsIMdbEnv* mev, // weak refs
 
262
  mdb_count* outCount)
 
263
{
 
264
  return this->Handle_GetWeakRefCount(mev, outCount);
 
265
}  
 
266
/*virtual*/ mdb_err
 
267
orkinCell::GetStrongRefCount(nsIMdbEnv* mev, // strong refs
 
268
  mdb_count* outCount)
 
269
{
 
270
  return this->Handle_GetStrongRefCount(mev, outCount);
 
271
}
 
272
 
 
273
/*virtual*/ mdb_err
 
274
orkinCell::AddWeakRef(nsIMdbEnv* mev)
 
275
{
 
276
  return this->Handle_AddWeakRef(mev);
 
277
}
 
278
/*virtual*/ mdb_err
 
279
orkinCell::AddStrongRef(nsIMdbEnv* mev)
 
280
{
 
281
  return this->Handle_AddStrongRef(mev);
 
282
}
 
283
 
 
284
/*virtual*/ mdb_err
 
285
orkinCell::CutWeakRef(nsIMdbEnv* mev)
 
286
{
 
287
  return this->Handle_CutWeakRef(mev);
 
288
}
 
289
/*virtual*/ mdb_err
 
290
orkinCell::CutStrongRef(nsIMdbEnv* mev)
 
291
{
 
292
  return this->Handle_CutStrongRef(mev);
 
293
}
 
294
 
 
295
/*virtual*/ mdb_err
 
296
orkinCell::CloseMdbObject(nsIMdbEnv* mev)
 
297
{
 
298
  return this->Handle_CloseMdbObject(mev);
 
299
}
 
300
 
 
301
/*virtual*/ mdb_err
 
302
orkinCell::IsOpenMdbObject(nsIMdbEnv* mev, mdb_bool* outOpen)
 
303
{
 
304
  return this->Handle_IsOpenMdbObject(mev, outOpen);
 
305
}
 
306
// } ----- end ref counting -----
 
307
 
 
308
// } ===== end nsIMdbObject methods =====
 
309
 
 
310
// { ===== begin nsIMdbBlob methods =====
 
311
 
 
312
// { ----- begin attribute methods -----
 
313
/*virtual*/ mdb_err
 
314
orkinCell::SetBlob(nsIMdbEnv* mev,
 
315
  nsIMdbBlob* ioBlob)
 
316
{
 
317
  MORK_USED_1(ioBlob);
 
318
  mdb_err outErr = 0;
 
319
  morkCell* cell = 0;
 
320
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
321
    &outErr, &cell);
 
322
  if ( ev )
 
323
  {
 
324
    // remember row->MaybeDirtySpaceStoreAndRow();
 
325
 
 
326
    ev->StubMethodOnlyError();
 
327
    outErr = ev->AsErr();
 
328
  }
 
329
    
 
330
  return outErr;
 
331
} // reads inBlob slots
 
332
// when inBlob is in the same suite, this might be fastest cell-to-cell
 
333
 
 
334
/*virtual*/ mdb_err
 
335
orkinCell::ClearBlob( // make empty (so content has zero length)
 
336
  nsIMdbEnv* mev)
 
337
{
 
338
  mdb_err outErr = 0;
 
339
  morkCell* cell = 0;
 
340
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
341
    &outErr, &cell);
 
342
  if ( ev )
 
343
  {
 
344
    // remember row->MaybeDirtySpaceStoreAndRow();
 
345
 
 
346
    ev->StubMethodOnlyError();
 
347
    outErr = ev->AsErr();
 
348
  }
 
349
    
 
350
  return outErr;
 
351
}
 
352
// clearing a yarn is like SetYarn() with empty yarn instance content
 
353
 
 
354
/*virtual*/ mdb_err
 
355
orkinCell::GetBlobFill(nsIMdbEnv* mev,
 
356
  mdb_fill* outFill)
 
357
// Same value that would be put into mYarn_Fill, if one called GetYarn()
 
358
// with a yarn instance that had mYarn_Buf==nil and mYarn_Size==0.
 
359
{
 
360
  mdb_err outErr = 0;
 
361
  mdb_fill fill = 0;
 
362
  morkCell* cell = 0;
 
363
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
364
    &outErr, &cell);
 
365
  if ( ev )
 
366
  {
 
367
    ev->StubMethodOnlyError();
 
368
    outErr = ev->AsErr();
 
369
  }
 
370
  if ( outFill )
 
371
    *outFill = fill;
 
372
    
 
373
  return outErr;
 
374
}  // size of blob 
 
375
 
 
376
/*virtual*/ mdb_err
 
377
orkinCell::SetYarn(nsIMdbEnv* mev, 
 
378
  const mdbYarn* inYarn)
 
379
{
 
380
  mdb_err outErr = 0;
 
381
  morkCell* cell = 0;
 
382
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
383
    &outErr, &cell);
 
384
  if ( ev )
 
385
  {
 
386
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
387
    morkRow* row = cellObj->mCellObject_Row;
 
388
    if ( row )
 
389
    {
 
390
      morkStore* store = row->GetRowSpaceStore(ev);
 
391
      if ( store )
 
392
      {
 
393
        cell->SetYarn(ev, inYarn, store);
 
394
        if ( row->IsRowClean() && store->mStore_CanDirty )
 
395
          row->MaybeDirtySpaceStoreAndRow();
 
396
      }
 
397
    }
 
398
    else
 
399
      ev->NilPointerError();
 
400
 
 
401
    outErr = ev->AsErr();
 
402
  }
 
403
    
 
404
  return outErr;
 
405
}   // reads from yarn slots
 
406
// make this text object contain content from the yarn's buffer
 
407
 
 
408
/*virtual*/ mdb_err
 
409
orkinCell::GetYarn(nsIMdbEnv* mev, 
 
410
  mdbYarn* outYarn)
 
411
{
 
412
  mdb_err outErr = 0;
 
413
  morkCell* cell = 0;
 
414
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
415
    &outErr, &cell);
 
416
  if ( ev )
 
417
  {
 
418
    morkAtom* atom = cell->GetAtom();
 
419
    atom->GetYarn(outYarn);
 
420
    outErr = ev->AsErr();
 
421
  }
 
422
    
 
423
  return outErr;
 
424
}  // writes some yarn slots 
 
425
// copy content into the yarn buffer, and update mYarn_Fill and mYarn_Form
 
426
 
 
427
/*virtual*/ mdb_err
 
428
orkinCell::AliasYarn(nsIMdbEnv* mev, 
 
429
  mdbYarn* outYarn)
 
430
{
 
431
  mdb_err outErr = 0;
 
432
  morkCell* cell = 0;
 
433
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
434
    &outErr, &cell);
 
435
  if ( ev )
 
436
  {
 
437
    morkAtom* atom = cell->GetAtom();
 
438
    atom->AliasYarn(outYarn);
 
439
    outErr = ev->AsErr();
 
440
  }
 
441
    
 
442
  return outErr;
 
443
} // writes ALL yarn slots
 
444
 
 
445
// } ----- end attribute methods -----
 
446
 
 
447
// } ===== end nsIMdbBlob methods =====
 
448
 
 
449
// { ===== begin nsIMdbCell methods =====
 
450
 
 
451
// { ----- begin attribute methods -----
 
452
/*virtual*/ mdb_err
 
453
orkinCell::SetColumn(nsIMdbEnv* mev, mdb_column inColumn)
 
454
{
 
455
  MORK_USED_1(inColumn);
 
456
  mdb_err outErr = 0;
 
457
  morkCell* cell = 0;
 
458
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
459
    &outErr, &cell);
 
460
  if ( ev )
 
461
  {
 
462
    // remember row->MaybeDirtySpaceStoreAndRow();
 
463
 
 
464
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
465
    MORK_USED_1(cellObj);
 
466
    
 
467
    ev->StubMethodOnlyError();
 
468
    outErr = ev->AsErr();
 
469
  }
 
470
    
 
471
  return outErr;
 
472
 
473
 
 
474
/*virtual*/ mdb_err
 
475
orkinCell::GetColumn(nsIMdbEnv* mev, mdb_column* outColumn)
 
476
{
 
477
  mdb_err outErr = 0;
 
478
  mdb_column col = 0;
 
479
  morkCell* cell = 0;
 
480
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
481
    &outErr, &cell);
 
482
  if ( ev )
 
483
  {
 
484
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
485
    col = cellObj->mCellObject_Col;
 
486
    outErr = ev->AsErr();
 
487
  }
 
488
  if ( outColumn )
 
489
    *outColumn = col;
 
490
  return outErr;
 
491
}
 
492
 
 
493
/*virtual*/ mdb_err
 
494
orkinCell::GetCellInfo(  // all cell metainfo except actual content
 
495
  nsIMdbEnv* mev, 
 
496
  mdb_column* outColumn,           // the column in the containing row
 
497
  mdb_fill*   outBlobFill,         // the size of text content in bytes
 
498
  mdbOid*     outChildOid,         // oid of possible row or table child
 
499
  mdb_bool*   outIsRowChild)  // nonzero if child, and a row child
 
500
// Checking all cell metainfo is a good way to avoid forcing a large cell
 
501
// in to memory when you don't actually want to use the content.
 
502
{
 
503
  mdb_err outErr = 0;
 
504
  mdb_bool isRowChild = morkBool_kFalse;
 
505
  mdbOid childOid;
 
506
  childOid.mOid_Scope = 0;
 
507
  childOid.mOid_Id = 0;
 
508
  mork_fill blobFill = 0;
 
509
  mdb_column column = 0;
 
510
  morkCell* cell = 0;
 
511
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
512
    &outErr, &cell);
 
513
  if ( ev )
 
514
  {
 
515
    morkCellObject* cellObj;
 
516
    cellObj = (morkCellObject*) mHandle_Object;
 
517
    ev->StubMethodOnlyError();
 
518
    outErr = ev->AsErr();
 
519
  }
 
520
  if ( outIsRowChild )
 
521
    *outIsRowChild = isRowChild;
 
522
  if ( outChildOid )
 
523
    *outChildOid = childOid;
 
524
   if ( outBlobFill )
 
525
     *outBlobFill = blobFill;
 
526
  if ( outColumn )
 
527
    *outColumn = column;
 
528
    
 
529
  return outErr;
 
530
}
 
531
 
 
532
 
 
533
/*virtual*/ mdb_err
 
534
orkinCell::GetRow(nsIMdbEnv* mev, // parent row for this cell
 
535
  nsIMdbRow** acqRow)
 
536
{
 
537
  mdb_err outErr = 0;
 
538
  nsIMdbRow* outRow = 0;
 
539
  morkCell* cell = 0;
 
540
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
541
    &outErr, &cell);
 
542
  if ( ev )
 
543
  {
 
544
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
545
    morkRowObject* rowObj = cellObj->mCellObject_RowObject;
 
546
    outRow = rowObj->AcquireRowHandle(ev);
 
547
    
 
548
    outErr = ev->AsErr();
 
549
  }
 
550
  if ( acqRow )
 
551
    *acqRow = outRow;
 
552
  return outErr;
 
553
}
 
554
 
 
555
/*virtual*/ mdb_err
 
556
orkinCell::GetPort(nsIMdbEnv* mev, // port containing cell
 
557
  nsIMdbPort** acqPort)
 
558
{
 
559
  mdb_err outErr = 0;
 
560
  nsIMdbPort* outPort = 0;
 
561
  morkCell* cell = 0;
 
562
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
563
    &outErr, &cell);
 
564
  if ( ev )
 
565
  {
 
566
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
567
    morkRow* row = cellObj->mCellObject_Row;
 
568
    if ( row )
 
569
    {
 
570
      morkStore* store = row->GetRowSpaceStore(ev);
 
571
      if ( store )
 
572
        outPort = store->AcquireStoreHandle(ev);
 
573
    }
 
574
    else
 
575
      ev->NilPointerError();
 
576
 
 
577
    outErr = ev->AsErr();
 
578
  }
 
579
  if ( acqPort )
 
580
    *acqPort = outPort;
 
581
  return outErr;
 
582
}
 
583
// } ----- end attribute methods -----
 
584
 
 
585
// { ----- begin children methods -----
 
586
/*virtual*/ mdb_err
 
587
orkinCell::HasAnyChild( // does cell have a child instead of text?
 
588
  nsIMdbEnv* mev,
 
589
  mdbOid* outOid,  // out id of row or table (or unbound if no child)
 
590
  mdb_bool* outIsRow) // nonzero if child is a row (rather than a table)
 
591
{
 
592
  mdb_err outErr = 0;
 
593
  mdb_bool isRow = morkBool_kFalse;
 
594
  outOid->mOid_Scope = 0;
 
595
  outOid->mOid_Id = morkId_kMinusOne;
 
596
  morkCell* cell = 0;
 
597
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
598
    &outErr, &cell);
 
599
  if ( ev )
 
600
  {
 
601
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
602
    morkAtom* atom = cellObj->GetCellAtom(ev);
 
603
    if ( atom )
 
604
    {
 
605
      isRow = atom->IsRowOid();
 
606
      if ( isRow || atom->IsTableOid() )
 
607
        *outOid = ((morkOidAtom*) atom)->mOidAtom_Oid;
 
608
    }
 
609
      
 
610
    outErr = ev->AsErr();
 
611
  }
 
612
  if ( outIsRow )
 
613
    *outIsRow = isRow;
 
614
    
 
615
  return outErr;
 
616
}
 
617
 
 
618
/*virtual*/ mdb_err
 
619
orkinCell::GetAnyChild( // access table of specific attribute
 
620
  nsIMdbEnv* mev, // context
 
621
  nsIMdbRow** acqRow, // child row (or null)
 
622
  nsIMdbTable** acqTable) // child table (or null)
 
623
{
 
624
  mdb_err outErr = 0;
 
625
  nsIMdbRow* outRow = 0;
 
626
  nsIMdbTable* outTable = 0;
 
627
  morkCell* cell = 0;
 
628
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
629
    &outErr, &cell);
 
630
  if ( ev )
 
631
  {
 
632
    morkCellObject* cellObj;
 
633
    cellObj = (morkCellObject*) mHandle_Object;
 
634
    ev->StubMethodOnlyError();
 
635
    outErr = ev->AsErr();
 
636
  }
 
637
  MORK_ASSERT(acqTable);
 
638
  if ( acqTable )
 
639
    *acqTable = outTable;
 
640
  MORK_ASSERT(acqRow);
 
641
  if ( acqRow )
 
642
    *acqRow = outRow;
 
643
    
 
644
  return outErr;
 
645
}
 
646
 
 
647
 
 
648
/*virtual*/ mdb_err
 
649
orkinCell::SetChildRow( // access table of specific attribute
 
650
  nsIMdbEnv* mev, // context
 
651
  nsIMdbRow* ioRow)
 
652
{
 
653
  MORK_USED_1(ioRow);
 
654
  mdb_err outErr = 0;
 
655
  morkCell* cell = 0;
 
656
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
657
    &outErr, &cell);
 
658
  if ( ev )
 
659
  {
 
660
    // remember row->MaybeDirtySpaceStoreAndRow();
 
661
 
 
662
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
663
    MORK_USED_1(cellObj);
 
664
 
 
665
    ev->StubMethodOnlyError();
 
666
    outErr = ev->AsErr();
 
667
  }
 
668
    
 
669
  return outErr;
 
670
} // inRow must be bound inside this same db port
 
671
 
 
672
/*virtual*/ mdb_err
 
673
orkinCell::GetChildRow( // access row of specific attribute
 
674
  nsIMdbEnv* mev, // context
 
675
  nsIMdbRow** acqRow) // acquire child row (or nil if no child)
 
676
{
 
677
  mdb_err outErr = 0;
 
678
  nsIMdbRow* outRow = 0;
 
679
  morkCell* cell = 0;
 
680
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
681
    &outErr, &cell);
 
682
  if ( ev )
 
683
  {
 
684
    morkCellObject* cellObj;
 
685
    cellObj = (morkCellObject*) mHandle_Object;
 
686
    ev->StubMethodOnlyError();
 
687
    outErr = ev->AsErr();
 
688
  }
 
689
  if ( acqRow )
 
690
    *acqRow = outRow;
 
691
    
 
692
  return outErr;
 
693
}
 
694
 
 
695
 
 
696
/*virtual*/ mdb_err
 
697
orkinCell::SetChildTable( // access table of specific attribute
 
698
  nsIMdbEnv* mev, // context
 
699
  nsIMdbTable* inTable) // table must be bound inside this same db port
 
700
{
 
701
  MORK_USED_1(inTable);
 
702
  mdb_err outErr = 0;
 
703
  morkCell* cell = 0;
 
704
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
705
    &outErr, &cell);
 
706
  if ( ev )
 
707
  {
 
708
    // remember row->MaybeDirtySpaceStoreAndRow();
 
709
 
 
710
    morkCellObject* cellObj = (morkCellObject*) mHandle_Object;
 
711
    MORK_USED_1(cellObj);
 
712
 
 
713
    ev->StubMethodOnlyError();
 
714
    outErr = ev->AsErr();
 
715
  }
 
716
    
 
717
  return outErr;
 
718
}
 
719
 
 
720
/*virtual*/ mdb_err
 
721
orkinCell::GetChildTable( // access table of specific attribute
 
722
  nsIMdbEnv* mev, // context
 
723
  nsIMdbTable** acqTable) // acquire child tabdle (or nil if no chil)
 
724
{
 
725
  mdb_err outErr = 0;
 
726
  nsIMdbTable* outTable = 0;
 
727
  morkCell* cell = 0;
 
728
  morkEnv* ev = this->CanUseCell(mev, /*inMutable*/ morkBool_kTrue,
 
729
    &outErr, &cell);
 
730
  if ( ev )
 
731
  {
 
732
    morkCellObject* cellObj;
 
733
    cellObj = (morkCellObject*) mHandle_Object;
 
734
    ev->StubMethodOnlyError();
 
735
    outErr = ev->AsErr();
 
736
  }
 
737
  if ( acqTable )
 
738
    *acqTable = outTable;
 
739
    
 
740
  return outErr;
 
741
}
 
742
// } ----- end children methods -----
 
743
 
 
744
// } ===== end nsIMdbCell methods =====
 
745
 
 
746
 
 
747
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789