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

« back to all changes in this revision

Viewing changes to mozilla/db/mork/src/orkinEnv.h

  • 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 _ORKINENV_
 
40
#define _ORKINENV_ 1
 
41
 
 
42
#ifndef _MDB_
 
43
#include "mdb.h"
 
44
#endif
 
45
 
 
46
#ifndef _MORK_
 
47
#include "mork.h"
 
48
#endif
 
49
 
 
50
#ifndef _MORKNODE_
 
51
#include "morkNode.h"
 
52
#endif
 
53
 
 
54
#ifndef _MORKHANDLE_
 
55
#include "morkHandle.h"
 
56
#endif
 
57
 
 
58
#ifndef _MORKEnv_
 
59
#include "morkEnv.h"
 
60
#endif
 
61
 
 
62
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
 
63
 
 
64
#define morkMagic_kEnv 0x456E7669 /* ascii 'Envi' */
 
65
 
 
66
/*| orkinEnv:
 
67
|*/
 
68
class orkinEnv : public morkHandle, public nsIMdbEnv { // nsIMdbObject
 
69
 
 
70
// { ===== begin morkNode interface =====
 
71
public: // morkNode virtual methods
 
72
  virtual void CloseMorkNode(morkEnv* ev); // override to clean up mork env
 
73
  virtual ~orkinEnv(); // morkHandle destructor does everything
 
74
  
 
75
protected: // construction is protected (use the static Make() method)
 
76
  orkinEnv(morkEnv* ev, // note morkUsage is always morkUsage_kPool
 
77
    morkHandleFace* ioFace,    // must not be nil, cookie for this handle
 
78
    morkEnv* ioObject); // must not be nil, the object for this handle
 
79
    
 
80
  // void CloseHandle(morkEnv* ev); // don't need to specialize closing
 
81
 
 
82
private: // copying is not allowed
 
83
  orkinEnv(const morkHandle& other);
 
84
  orkinEnv& operator=(const morkHandle& other);
 
85
 
 
86
// public: // dynamic type identification
 
87
  // mork_bool IsHandle() const //
 
88
  // { return IsNode() && mNode_Derived == morkDerived_kHandle; }
 
89
// } ===== end morkNode methods =====
 
90
 
 
91
protected: // morkHandle memory management operators
 
92
  void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev) CPP_THROW_NEW
 
93
  { return ioPool.NewHandle(ev, inSize, &ioZone); }
 
94
  
 
95
  void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev) CPP_THROW_NEW
 
96
  { return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
 
97
  
 
98
  void* operator new(size_t inSize, morkHandleFace* ioFace) CPP_THROW_NEW
 
99
  { MORK_USED_1(inSize); return ioFace; }
 
100
  
 
101
  
 
102
public: // construction:
 
103
 
 
104
  static orkinEnv* MakeEnv(morkEnv* ev, morkEnv* ioObject);
 
105
 
 
106
public: // utilities:
 
107
 
 
108
  morkEnv* CanUseEnv(mork_bool inMutable, mdb_err* outErr) const;
 
109
 
 
110
public: // type identification
 
111
  mork_bool IsOrkinEnv() const
 
112
  { return mHandle_Magic == morkMagic_kEnv; }
 
113
 
 
114
  mork_bool IsOrkinEnvHandle() const
 
115
  { return this->IsHandle() && this->IsOrkinEnv(); }
 
116
 
 
117
public:
 
118
 
 
119
  NS_DECL_ISUPPORTS
 
120
// { ===== begin nsIMdbObject methods =====
 
121
 
 
122
  // { ----- begin attribute methods -----
 
123
  NS_IMETHOD IsFrozenMdbObject(nsIMdbEnv* ev, mdb_bool* outIsReadonly);
 
124
  // same as nsIMdbPort::GetIsPortReadonly() when this object is inside a port.
 
125
  // } ----- end attribute methods -----
 
126
 
 
127
  // { ----- begin factory methods -----
 
128
  NS_IMETHOD GetMdbFactory(nsIMdbEnv* ev, nsIMdbFactory** acqFactory); 
 
129
  // } ----- end factory methods -----
 
130
 
 
131
  // { ----- begin ref counting for well-behaved cyclic graphs -----
 
132
  NS_IMETHOD GetWeakRefCount(nsIMdbEnv* ev, // weak refs
 
133
    mdb_count* outCount);  
 
134
  NS_IMETHOD GetStrongRefCount(nsIMdbEnv* ev, // strong refs
 
135
    mdb_count* outCount);
 
136
 
 
137
  NS_IMETHOD AddWeakRef(nsIMdbEnv* ev);
 
138
  NS_IMETHOD AddStrongRef(nsIMdbEnv* ev);
 
139
 
 
140
  NS_IMETHOD CutWeakRef(nsIMdbEnv* ev);
 
141
  NS_IMETHOD CutStrongRef(nsIMdbEnv* ev);
 
142
  
 
143
  NS_IMETHOD CloseMdbObject(nsIMdbEnv* ev); // called at strong refs zero
 
144
  NS_IMETHOD IsOpenMdbObject(nsIMdbEnv* ev, mdb_bool* outOpen);
 
145
  // } ----- end ref counting -----
 
146
  
 
147
// } ===== end nsIMdbObject methods =====
 
148
 
 
149
// { ===== begin nsIMdbEnv methods =====
 
150
 
 
151
  // { ----- begin attribute methods -----
 
152
  NS_IMETHOD GetErrorCount(mdb_count* outCount,
 
153
    mdb_bool* outShouldAbort);
 
154
  NS_IMETHOD GetWarningCount(mdb_count* outCount,
 
155
    mdb_bool* outShouldAbort);
 
156
  
 
157
  NS_IMETHOD GetEnvBeVerbose(mdb_bool* outBeVerbose);
 
158
  NS_IMETHOD SetEnvBeVerbose(mdb_bool inBeVerbose);
 
159
  
 
160
  NS_IMETHOD GetDoTrace(mdb_bool* outDoTrace);
 
161
  NS_IMETHOD SetDoTrace(mdb_bool inDoTrace);
 
162
  
 
163
  NS_IMETHOD GetAutoClear(mdb_bool* outAutoClear);
 
164
  NS_IMETHOD SetAutoClear(mdb_bool inAutoClear);
 
165
  
 
166
  NS_IMETHOD GetErrorHook(nsIMdbErrorHook** acqErrorHook);
 
167
  NS_IMETHOD SetErrorHook(
 
168
    nsIMdbErrorHook* ioErrorHook); // becomes referenced
 
169
  
 
170
  NS_IMETHOD GetHeap(nsIMdbHeap** acqHeap);
 
171
  NS_IMETHOD SetHeap(
 
172
    nsIMdbHeap* ioHeap); // becomes referenced
 
173
  // } ----- end attribute methods -----
 
174
  
 
175
  NS_IMETHOD ClearErrors(); // clear errors beore re-entering db API
 
176
  NS_IMETHOD ClearWarnings(); // clear warnings
 
177
  NS_IMETHOD ClearErrorsAndWarnings(); // clear both errors & warnings
 
178
// } ===== end nsIMdbEnv methods =====
 
179
};
 
180
 
 
181
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
 
182
 
 
183
#endif /* _ORKINENV_ */