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 ***** */
45 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
48 #define morkDerived_kYarn /*i*/ 0x7952 /* ascii 'yR' */
50 /*| morkYarn: a reference counted nsIMdbYarn C struct. This is for use in those
51 **| few cases where single instances of reference counted buffers are needed
52 **| in Mork, and we expect few enough instances that overhead is not a factor
53 **| in decided whether to use such a thing.
55 class morkYarn
: public morkNode
{ // refcounted yarn
57 // public: // slots inherited from morkNode (meant to inform only)
58 // nsIMdbHeap* mNode_Heap;
60 // mork_base mNode_Base; // must equal morkBase_kNode
61 // mork_derived mNode_Derived; // depends on specific node subclass
63 // mork_access mNode_Access; // kOpen, kClosing, kShut, or kDead
64 // mork_usage mNode_Usage; // kHeap, kStack, kMember, kGlobal, kNone
65 // mork_able mNode_Mutable; // can this node be modified?
66 // mork_load mNode_Load; // is this node clean or dirty?
68 // mork_uses mNode_Uses; // refcount for strong refs
69 // mork_refs mNode_Refs; // refcount for strong refs + weak refs
71 public: // state is public because the entire Mork system is private
74 // { ===== begin morkNode interface =====
75 public: // morkNode virtual methods
76 virtual void CloseMorkNode(morkEnv
* ev
); // CloseYarn() only if open
77 virtual ~morkYarn(); // assert that CloseYarn() executed earlier
79 public: // morkYarn construction & destruction
80 morkYarn(morkEnv
* ev
, const morkUsage
& inUsage
, nsIMdbHeap
* ioHeap
);
81 void CloseYarn(morkEnv
* ev
); // called by CloseMorkNode();
83 private: // copying is not allowed
84 morkYarn(const morkYarn
& other
);
85 morkYarn
& operator=(const morkYarn
& other
);
87 public: // dynamic type identification
88 mork_bool
IsYarn() const
89 { return IsNode() && mNode_Derived
== morkDerived_kYarn
; }
90 // } ===== end morkNode methods =====
93 static void NonYarnTypeError(morkEnv
* ev
);
95 public: // typesafe refcounting inlines calling inherited morkNode methods
96 static void SlotWeakYarn(morkYarn
* me
,
97 morkEnv
* ev
, morkYarn
** ioSlot
)
98 { morkNode::SlotWeakNode((morkNode
*) me
, ev
, (morkNode
**) ioSlot
); }
100 static void SlotStrongYarn(morkYarn
* me
,
101 morkEnv
* ev
, morkYarn
** ioSlot
)
102 { morkNode::SlotStrongNode((morkNode
*) me
, ev
, (morkNode
**) ioSlot
); }
105 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
107 #endif /* _MORKYARN_ */