[go: up one dir, main page]

Menu

[r19]: / trunk / include / core / oof2.h  Maximize  Restore  History

Download this file

304 lines (228 with data), 5.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
#ifndef H_OOF2
#define H_OOF2
// COPYRIGHT 1994 A.D. Software, All rights reserved
// backend parent layer of OOFILE database
// this header just contains various useful classes for databases
// mainly used internally
// NOTE inline definitions included at end of this header file
#ifndef H_OOF1
#include "oof1.h"
#endif
#ifndef H_OOFARRAY
#include "oofarray.h"
#endif
// forward declarations
class OOF_bit;
class dbField;
class dbBLOB;
class dbTable;
class OOF_simpleRecordBackend;
class dbRelRefBase;
class dbRelationship;
/**
abstract base for handling record contexts
\ingroup oofDatabase
*/
class OOFILE_EXPORT dbContext
{
public:
virtual ~dbContext() {};
};
/**
Array of longs which expands automatically with refcount so easily shared.
\ingroup oofUtils
*/
class OOFILE_EXPORT OOF_SharedArray : public OOF_ExpandableLongArray, public OOF_mixRefCount {
public:
OOF_SharedArray(unsigned long defaultValue=0, unsigned long numSlots=0, unsigned int expandBySlots=4);
};
/**
Array of dummy name strings including generator function.
Used solely by OOF_DummyString and can't be instantiated by others.
\ingroup oofUtils
*/
class OOFILE_EXPORT OOF_DummyStorage
{
private: // yes, wholly owned by OOF_DummyString and not used elsewhere!
OOF_DummyStorage();
public: // g++ won't let a static have private dtor
~OOF_DummyStorage();
private:
void ReleaseAllStorage(); // to be called by OOF_DummyString
void SetPrefix(const OOF_String&);
const OOF_String& Dummy(unsigned long);
void DeleteAllStrings();
// data storage
OOF_ExpandableLongArray mStringCache;
OOF_String mPrefix;
friend class OOF_DummyString;
};
/**
statically stored self-incrementing const char*'s
\ingroup oofUtils
*/
class OOFILE_EXPORT OOF_DummyString : public oofString {
public:
// constructors
OOF_DummyString(const char* dummyPrefix=0);
// getters
const OOF_String& nextDummy();
static void releaseAllStorage();
protected:
// data storage
unsigned long mSuffix;
static OOF_DummyStorage sStrings;
};
typedef OOF_DummyString oofDummyString; // for external use
/**
abstract base for public interface to selections.
\ingroup oofInternals
*/
class OOFILE_EXPORT OOF_Selection {
public:
virtual ~OOF_Selection() {};
virtual OOF_Selection* clone() const=0;
/// \name combinatorial operators
//@{
virtual void difference_with(const OOF_Selection*)=0;
virtual void intersection_with(const OOF_Selection*)=0;
virtual void intersection_with(oidT)=0;
virtual void union_with(const OOF_Selection*)=0;
virtual void union_with_no_overlap(const OOF_Selection*)=0;
virtual void union_with(oidT)=0;
virtual void invert()=0;
//@}
/// \name reflective operators
//@{
virtual bool isEmpty() const=0;
virtual bool contains(oidT) const=0;
virtual bool find(oidT, unsigned long& foundAt) const=0;
virtual unsigned long count() const=0;
virtual bool isAllRecs() const=0;
virtual const dbTable* prototypicalTable() const=0;
//@}
};
// -------------------------------------------------------
// d b S e l e c t i o n
// -------------------------------------------------------
inline void
dbSelection::difference_with(dbTable* rhs)
{
difference_with(*rhs);
}
inline void
dbSelection::operator -=(const dbSelection& rhs)
{
difference_with(rhs);
}
inline void
dbSelection::operator -=(dbTable& rhs)
{
difference_with(rhs);
}
inline void
dbSelection::operator -=(dbTable* rhs)
{
difference_with(*rhs);
}
inline void
dbSelection::operator %=(dbTable& rhs)
{
difference_with(rhs);
}
inline void
dbSelection::operator %=(const dbSelection& rhs)
{
difference_with(rhs);
}
inline void
dbSelection::operator %=(dbTable* rhs)
{
difference_with(*rhs);
}
inline void
dbSelection::operator &=(const dbSelection& rhs)
{
intersection_with(rhs);
}
inline void
dbSelection::intersection_with(dbTable* rhs)
{
intersection_with(*rhs);
}
inline void
dbSelection::operator &=(dbTable& rhs)
{
intersection_with(rhs);
}
inline void
dbSelection::operator &=(dbTable* rhs)
{
intersection_with(*rhs);
}
inline void
dbSelection::operator +=(const dbSelection& rhs)
{
union_with(rhs);
}
inline void
dbSelection::operator |=(const dbSelection& rhs)
{
union_with(rhs);
}
inline void
dbSelection::union_with(dbTable* rhs)
{
union_with(*rhs);
}
inline void
dbSelection::union_with_no_overlap(dbTable* rhs)
{
union_with_no_overlap(*rhs);
}
inline void
dbSelection::operator +=(dbTable& rhs)
{
union_with(rhs);
}
inline void
dbSelection::operator +=(dbTable* rhs)
{
union_with(*rhs);
}
inline void
dbSelection::operator |=(dbTable& rhs)
{
union_with(rhs);
}
inline void
dbSelection::operator |=(dbTable* rhs)
{
union_with(*rhs);
}
inline void
dbSelection::operator+=(oidT offset)
{
union_with(offset);
}
inline void
dbSelection::operator~()
{
invert();
}
inline void
dbSelection::operator!()
{
invert();
}
inline const OOF_Selection*
dbSelection::internalSelection() const
{
return mSelection;
}
inline const dbTable*
dbSelection::prototypicalTable() const
{
return mSelection->prototypicalTable();
}
#endif