Back to index

lightning-sunbird  0.9+nobinonly
morkRowCellCursor.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-  */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _MORKROWCELLCURSOR_
00039 #define _MORKROWCELLCURSOR_ 1
00040 
00041 #ifndef _MORK_
00042 #include "mork.h"
00043 #endif
00044 
00045 #ifndef _MORKCURSOR_
00046 #include "morkCursor.h"
00047 #endif
00048 
00049 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
00050 
00051 class orkinRowCellCursor;
00052 #define morkDerived_kRowCellCursor  /*i*/ 0x6343 /* ascii 'cC' */
00053 
00054 class morkRowCellCursor : public morkCursor, public nsIMdbRowCellCursor { // row iterator
00055 
00056 // public: // slots inherited from morkObject (meant to inform only)
00057   // nsIMdbHeap*     mNode_Heap;
00058   // mork_able    mNode_Mutable; // can this node be modified?
00059   // mork_load    mNode_Load;    // is this node clean or dirty?
00060   // mork_base    mNode_Base;    // must equal morkBase_kNode
00061   // mork_derived mNode_Derived; // depends on specific node subclass
00062   // mork_access  mNode_Access;  // kOpen, kClosing, kShut, or kDead
00063   // mork_usage   mNode_Usage;   // kHeap, kStack, kMember, kGlobal, kNone
00064   // mork_uses    mNode_Uses;    // refcount for strong refs
00065   // mork_refs    mNode_Refs;    // refcount for strong refs + weak refs
00066 
00067   // morkFactory* mObject_Factory;  // weak ref to suite factory
00068 
00069   // mork_seed  mCursor_Seed;
00070   // mork_pos   mCursor_Pos;
00071   // mork_bool  mCursor_DoFailOnSeedOutOfSync;
00072   // mork_u1    mCursor_Pad[ 3 ]; // explicitly pad to u4 alignment
00073 
00074 public: // state is public because the entire Mork system is private
00075 
00076   NS_DECL_ISUPPORTS_INHERITED
00077   morkRowObject*   mRowCellCursor_RowObject;  // strong ref to row
00078   mork_column      mRowCellCursor_Col;        // col of cell last at mCursor_Pos
00079   
00080 // { ===== begin morkNode interface =====
00081 public: // morkNode virtual methods
00082   virtual void CloseMorkNode(morkEnv* ev); // CloseRowCellCursor()
00083   virtual ~morkRowCellCursor(); // assert that close executed earlier
00084   
00085 public: // morkRowCellCursor construction & destruction
00086   morkRowCellCursor(morkEnv* ev, const morkUsage& inUsage,
00087     nsIMdbHeap* ioHeap, morkRowObject* ioRowObject);
00088   void CloseRowCellCursor(morkEnv* ev); // called by CloseMorkNode();
00089 
00090   // { ----- begin attribute methods -----
00091   NS_IMETHOD SetRow(nsIMdbEnv* ev, nsIMdbRow* ioRow); // sets pos to -1
00092   NS_IMETHOD GetRow(nsIMdbEnv* ev, nsIMdbRow** acqRow);
00093   // } ----- end attribute methods -----
00094 
00095   // { ----- begin cell creation methods -----
00096   NS_IMETHOD MakeCell( // get cell at current pos in the row
00097     nsIMdbEnv* ev, // context
00098     mdb_column* outColumn, // column for this particular cell
00099     mdb_pos* outPos, // position of cell in row sequence
00100     nsIMdbCell** acqCell); // the cell at inPos
00101   // } ----- end cell creation methods -----
00102 
00103   // { ----- begin cell seeking methods -----
00104   NS_IMETHOD SeekCell( // same as SetRow() followed by MakeCell()
00105     nsIMdbEnv* ev, // context
00106     mdb_pos inPos, // position of cell in row sequence
00107     mdb_column* outColumn, // column for this particular cell
00108     nsIMdbCell** acqCell); // the cell at inPos
00109   // } ----- end cell seeking methods -----
00110 
00111   // { ----- begin cell iteration methods -----
00112   NS_IMETHOD NextCell( // get next cell in the row
00113     nsIMdbEnv* ev, // context
00114     nsIMdbCell** acqCell, // changes to the next cell in the iteration
00115     mdb_column* outColumn, // column for this particular cell
00116     mdb_pos* outPos); // position of cell in row sequence
00117     
00118   NS_IMETHOD PickNextCell( // get next cell in row within filter set
00119     nsIMdbEnv* ev, // context
00120     nsIMdbCell* ioCell, // changes to the next cell in the iteration
00121     const mdbColumnSet* inFilterSet, // col set of actual caller interest
00122     mdb_column* outColumn, // column for this particular cell
00123     mdb_pos* outPos); // position of cell in row sequence
00124 
00125   // Note that inFilterSet should not have too many (many more than 10?)
00126   // cols, since this might imply a potential excessive consumption of time
00127   // over many cursor calls when looking for column and filter intersection.
00128   // } ----- end cell iteration methods -----
00129 
00130 
00131 private: // copying is not allowed
00132   morkRowCellCursor(const morkRowCellCursor& other);
00133   morkRowCellCursor& operator=(const morkRowCellCursor& other);
00134 
00135 public: // dynamic type identification
00136   mork_bool IsRowCellCursor() const
00137   { return IsNode() && mNode_Derived == morkDerived_kRowCellCursor; }
00138 // } ===== end morkNode methods =====
00139 
00140 public: // errors
00141   static void NilRowObjectError(morkEnv* ev);
00142   static void NonRowCellCursorTypeError(morkEnv* ev);
00143 
00144 public: // typesafe refcounting inlines calling inherited morkNode methods
00145   static void SlotWeakRowCellCursor(morkRowCellCursor* me,
00146     morkEnv* ev, morkRowCellCursor** ioSlot)
00147   { morkNode::SlotWeakNode((morkNode*) me, ev, (morkNode**) ioSlot); }
00148   
00149   static void SlotStrongRowCellCursor(morkRowCellCursor* me,
00150     morkEnv* ev, morkRowCellCursor** ioSlot)
00151   { morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }
00152 };
00153 
00154 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
00155 
00156 #endif /* _MORKROWCELLCURSOR_ */