[go: up one dir, main page]

Menu

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

Download this file

434 lines (364 with data), 11.2 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
#ifndef H_OOF0
#define H_OOF0
// COPYRIGHT 1994-1999 A.D. Software, All rights reserved
// minimal root public layer of OOFILE database
/**
\file oof0.h
Declare macros used by most of OOFILE.
*/
#ifndef H_OOFPLAT
#include "oofplat.h"
#endif
// for debug mode, use VC debug RTL
// see Debugging Applications - chap 15
#if defined _MSC_VER && !defined __MWERKS__
#ifdef OOF_DEBUG
#define _CRTDBG_MAP_ALLOC
#ifndef _DEBUG
#define _DEBUG
#endif
#endif
#endif
/**
Version number of core OOFILE package including database.
\ingroup oofMacros
*/
#define OOFVERS_CORE 0x01400000 // Version 1.4.0
/* index to version defines
Note that you may lack some files depending on your package
file: VERSION IDENTIFIER
==== ==================
oof0.h OOFVERS_CORE core version
oofrep.h OOFVERS_REP report writer
oofGrphs.h OOFVERS_GRAPH graphing engine
oofgui.h OOFVERS_GUI generic GUI classes used by PP, MFC and other framework integrations
oofpp.h OOFVERS_PP PowerPlant framework (Metrowerks CodeWarrior, on Mac)
oofmfc.h OOFVERS_MFC MFC GUI framework
*/
// -------------- D L L E X P O R T M A C R O S ---------------------
/**
\defgroup oofExportMacros DLL Export Macros
OOF..._EXPORT macros are used to export/import classes or functions to/from DLL <br>
if DLL is created, the OOF..._CREATE_DLL must be set on <br>
if DLL is used, the OOF..._USE_DLL must be set on <br>
if DLL is not used (so static library OOF...LIB.LIB is linked or created) both macros <br>
(OOF..._CREATE_DLL and OOF..._USE_DLL) must be set off; OOF..._EXPORT will
be expanded to an empty string <br>
on non-Windows platforms, the OOF..._EXPORT macros will be expanded to an empty string <br>
\par
'OOF...' prefix stands for OOFILE, OOFGRAPH or OOFREP
\todo check if need to define these for MacOS/X or other Unix dynamic linking
\ingroup oofMacros oofWinSpecific
*/
/**
\def OOFILE_CREATE_DLL
OOFILE database & general classes will be linked in a DLL.
Leave undefined to assume static linking.
\ingroup oofExportMacros
*/
/**
\def OOFREP_CREATE_DLL
Report-writer classes will be linked in a DLL.
Leave undefined to assume static linking.
\ingroup oofExportMacros
*/
/**
\def OOFGRAPH_CREATE_DLL
Graph classes will be linked in a DLL.
Leave undefined to assume static linking.
\ingroup oofExportMacros
*/
/**
\def OOFMFC_STATIC
MFC classes will NOT be linked in a DLL.
Leave undefined to assume DLL linking (common MFC default).
\todo define a OOFMFC_CREATE_DLL to follow same convention as others.
\ingroup oofExportMacros
*/
/**
\def OOFILE_EXPORT
Prefix for OOFILE database & general classes to enable optional DLL linking.
\ingroup oofExportMacros
*/
/**
\def OOFILE_EXPORT
Prefix for OOFILE database & general classes to enable optional DLL linking.
\ingroup oofExportMacros
*/
/**
\def OOFREP_EXPORT
Prefix for report writer classes to enable optional DLL linking.
\ingroup oofExportMacros
*/
/**
\def OOFGRAPH_EXPORT
Prefix for graph classes to enable optional DLL linking.
\ingroup oofExportMacros
*/
/**
\def OOFGUI_EXPORT
Prefix for MFC GUI classes to enable optional DLL linking.
\ingroup oofExportMacros
*/
/**
\def EXPATPP_EXPORT
Prefix for expatpp classes to enable optional DLL linking.
\ingroup oofExportMacros
*/
#ifdef _Windows
#if defined OOFILE_CREATE_DLL && (defined OOFGRAPH_CREATE_DLL || defined OOFREP_CREATE_DLL) ||\
defined OOFGRAPH_CREATE_DLL && (defined OOFILE_CREATE_DLL || defined OOFREP_CREATE_DLL) ||\
defined OOFREP_CREATE_DLL && (defined OOFILE_CREATE_DLL || defined OOFGRAPH_CREATE_DLL)
#error Only one macro OOF..._CREATE_DLL can be defined
#endif
#if defined OOFILE_CREATE_DLL
#define OOFILE_EXPORT _declspec(dllexport)
#elif defined OOFILE_USE_DLL
#define OOFILE_EXPORT _declspec(dllimport)
#else
#define OOFILE_EXPORT
#endif
#if defined OOFGRAPH_CREATE_DLL
#define OOFGRAPH_EXPORT _declspec(dllexport)
#elif defined OOFGRAPH_USE_DLL
#define OOFGRAPH_EXPORT _declspec(dllimport)
#else
#define OOFGRAPH_EXPORT
#endif
#if defined OOFREP_CREATE_DLL
#define OOFREP_EXPORT _declspec(dllexport)
#elif defined OOFREP_USE_DLL
#define OOFREP_EXPORT _declspec(dllimport)
#else
#define OOFREP_EXPORT
#endif
#ifndef EXPATPP_EXPORT
#if defined OOFILE_CREATE_DLL || defined OOFGRAPH_CREATE_DLL || defined OOFREP_CREATE_DLL
#define EXPATPP_EXPORT _declspec(dllexport)
#elif defined OOFILE_USE_DLL || defined OOFGRAPH_USE_DLL || defined OOFREP_USE_DLL
#define EXPATPP_EXPORT _declspec(dllimport)
#else
#define EXPATPP_EXPORT
#endif
#endif
// OOFMFC_STATIC allows us to remove the OOFGUI_EXPORT export declaration
// when static OOFMFC library is created or used
#ifdef OOFMFC_STATIC
#define OOFGUI_EXPORT
#else
#define OOFGUI_EXPORT AFX_EXT_CLASS
#endif
#else
#define OOFILE_EXPORT
#define OOFGRAPH_EXPORT
#define OOFREP_EXPORT
#define OOFGUI_EXPORT
#endif // _Windows
// -------------- B Y T E F L I P P I N G ---------------------
/**
\def OOF_INTEL_BYTE_ORDER
define a constant we can use to determine if byte flipping needed.
auto-defines if your makefile hasn't done so already, where possible.
\warning doesn't detect Linux or Solaris/x86 so MUST define in makefile.
\ingroup oofMacros
*/
#ifndef OOF_INTEL_BYTE_ORDER
#if defined(_MSDOS)
// implying x86
#define OOF_INTEL_BYTE_ORDER 1
#else
#define OOF_INTEL_BYTE_ORDER 0
#endif
#endif
// SOLARIS and OOF_GCC are constants defined in Makefiles
// as these compilers seem to lack platform-specific constants
#include <assert.h>
#include <limits.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(_Windows) && !defined(_WINDOWS_) && !defined(_AFXDLL)
# include <windows.h>
// disable warning that occurs when bool, true & false are used. GDH
// NOTE these need including after Windows and AFX includes
// as somewhere MS enable all warnings again
#if _MSC_VER>=1010
// want to suppress these warnings for ver 4.1 but not other compilers or warnings
// eg: 0x800 for earlier version 1.5
#pragma warning( disable : 4237 ) // bool, true & false
#pragma warning( disable : 4800 ) // bool conversion to int
#pragma warning( disable : 4355 ) // use of 'this' in intitalisation list
#endif
#endif
#ifdef _AFXDLL
#include <afxwin.h> // MFC core and standard components
#endif // _AFXDLL
#ifdef OOF_DEBUG_LOG_NAME
#define OOF_DEBUG_LOG(x) dbConnect::logComment(x)
#else
#define OOF_DEBUG_LOG(x)
#endif
#ifndef H_OOFbool
#include "oofbool.h"
#endif
// -------------- E X C E P T I O N S ---------------------
/**
\def OOF_EXCEPTIONS_AVAILABLE
Indicates compiler supports exceptions.
Can define in makefile or leave it to OOFILE to work out for Win and Mac compilers.
\ingroup oofMacros
*/
/**
\def OOF_SUPPRESS_EXCEPTIONS
Option to prevent using exceptions in OOFILE regardless of compiler or its settings.
\ingroup oofMacros
*/
/**
\def OOF_USING_EXCEPTIONS
Indicates OOFILE is using exceptions.
\ingroup oofMacros
*/
// test if exceptions are available
#ifdef __MWERKS__
#if __option(exceptions)
#define OOF_EXCEPTIONS_AVAILABLE
#endif
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#ifdef _CPPUNWIND
#define OOF_EXCEPTIONS_AVAILABLE
#endif
#endif
// if user hasn't suppressed exceptions and they are worked out as available
// in the tests above
#ifndef OOF_SUPPRESS_EXCEPTIONS
#ifdef OOF_EXCEPTIONS_AVAILABLE
#define OOF_USING_EXCEPTIONS
#endif
#endif
// -------------- N O S T D L I B ---------------------
/**
\def OOF_NO_STDLIB
Define to suppress use of standard library strings and streams.
Use if parts of OOFILE being used in embedded environments such as QuickTime components.
\ingroup oofMacros
*/
#ifdef OOF_NO_STDLIB
#undef OOF_USE_ANSI_STREAMS
#define OOF_USE_ANSI_STREAMS 0
#undef OOF_HAS_ANSI_STRINGS
#define OOF_HAS_ANSI_STRINGS 0
#endif // OOF_NO_STDLIB
// -------------- A N S I S T R E A M S ---------------------
/**
\def OOF_USE_ANSI_STREAMS
\ingroup oofMacros
*/
/**
\def OOF_USE_ANSI_STREAMS
Will compile using older or standard iostreams.
\ingroup oofMacros
*/
#if !defined OOF_USE_ANSI_STREAMS && !defined OOF_NO_STDLIB
#if defined(__MWERKS__)
// Metrowerks on Mac Pro 1 or any Windows, given bug in Windows Pro 1 plugin returns 0x1101
#if defined(_Windows) || __MWERKS__ >= 0x1800
#define OOF_USE_ANSI_STREAMS 1
#else
#define OOF_USE_ANSI_STREAMS 0
#endif
#elif defined(_MSC_VER)
// check for Visual C++ 4.2 or higher
#if _MSC_VER >= 1020
#define OOF_USE_ANSI_STREAMS 1
#else
#define OOF_USE_ANSI_STREAMS 0
#endif
#elif defined(__BCPLUSPLUS__)
// check for Borland C++ Builder 4.0 or higher
// Added by David Merryweather 10.08.1999
#if __BCPLUSPLUS__ >= 0x0540
#define OOF_USE_ANSI_STREAMS 1
#else
#define OOF_USE_ANSI_STREAMS 0
#endif
#else
// assume Unix compilers will define in the Makefile
// if the particular version supports streams, otherwise default
// to them not being supported
#define OOF_USE_ANSI_STREAMS 0
#endif
#endif
// -------------- A N S I S T R I N G S ---------------------
/**
\def OOF_HAS_ANSI_STRINGS
Controls if oofString and others include interfaces for std::string.
\ingroup oofMacros
*/
#ifndef OOF_HAS_ANSI_STRINGS
#if OOF_USE_ANSI_STREAMS
#define OOF_HAS_ANSI_STRINGS 1
// we need them to cope with the str() function alone!
#else
#define OOF_HAS_ANSI_STRINGS 0
#endif
#else
#if OOF_USE_ANSI_STREAMS && !OOF_HAS_ANSI_STRINGS
#pragma error "ANSI Streams require use of ANSI Strings, please don't define OOF_HAS_ANSI_STRINGS as 0"
#endif
#endif
#if !OOF_USE_ANSI_STREAMS
// define new stream names so can use throughout OOFILE
// this is safer than using old names, as some compilers or includes
// may define typedefs for istringstream etc.
class istrstream;
class ostrstream;
typedef istrstream istringstream;
typedef ostrstream ostringstream;
typedef ostrstream stringstream;
#endif
/**
\def MacLiteral
Portable constand used to hide use of Pascal strings in some interfaces.
\ingroup oofMacros
*/
#ifdef _Macintosh
#define MacLiteral(x) "\p"x
// use string concatenation to make into a Pascal literal with \p prefix
#else
#define MacLiteral(x) x
#endif
// -------------- X M L M A C R O S ---------------------
/**
\def OOF_READ_XML
Define to build the core database with ability to parse XML schema and import database from XML.
\ingroup oofMacros
*/
/**
\def OOF_READ_REPORTS()
Define to build the report writer with ability to parse XML layouts.
If defined forces definition of OOF_READ_XML
\ingroup oofMacros
*/
#ifdef OOF_READ_REPORTS
// report-writer uses XML to read in report documents
#ifndef OOF_READ_XML
#define OOF_READ_XML
// so define the macro enabling XML database parsing in oofXML.cpp
#endif
#endif
// -------------- R T T I M A C R O S ---------------------
/**
\def OOF_RTTI_ENABLED
Indicates compiler is building with RTTI.
\ingroup oofMacros
*/
#if defined(__MWERKS__)
#if __option(RTTI)
#define OOF_RTTI_ENABLED
#endif
#elif defined(_MSC_VER)
#ifdef _CPPRTTI
#define OOF_RTTI_ENABLED
#endif
#endif
#endif