00001 /* 00002 * 00003 * Copyright (C) 1997-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: ofstd 00015 * 00016 * Author: Marco Eichelberg 00017 * 00018 * Purpose: encapsulation of old style vs. ISO C++ standard includes 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:15:50 $ 00022 * CVS/RCS Revision: $Revision: 1.15 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 // this file is not and should not be protected against multiple inclusion 00030 00031 #include "dcmtk/config/osconfig.h" 00032 00033 /* DCMTK by default does not anymore pollute the default namespace by 00034 * importing namespace std. Earlier releases did this to simplify compatibility 00035 * with older compilers where STL classes were not consistently defined 00036 * in namespace std. We now have configure macros which should care for this. 00037 * If user code still relies on namespace std to be included, compile with 00038 * macro USING_STD_NAMESPACE defined. 00039 */ 00040 #ifdef USING_STD_NAMESPACE 00041 namespace std { } 00042 using namespace std; 00043 #endif 00044 00045 // define STD_NAMESPACE to std:: if the standard namespace exists 00046 #ifndef STD_NAMESPACE 00047 #ifdef HAVE_STD_NAMESPACE 00048 #define STD_NAMESPACE std:: 00049 #else 00050 #define STD_NAMESPACE 00051 #endif 00052 #endif 00053 00054 /* Header files as defined in ISO/IEC 14882:1998, Section 17.4.1.2, Table 11 00055 * These are header files for the Standard C++ Library. 00056 */ 00057 00058 // define INCLUDE_ALGORITHM to include "ofalgo.h" 00059 #ifdef INCLUDE_ALGORITHM 00060 #include "dcmtk/ofstd/ofalgo.h" 00061 #endif 00062 00063 // we don't yet support <bitset>, <complex>, <deque>, <exception>, <functional> 00064 00065 // all stream related headers are handled by "ofstream.h" 00066 #if defined(INCLUDE_IOSFWD) || defined(INCLUDE_IOSTREAM) || defined(INCLUDE_ISTREAM) || \ 00067 defined(INCLUDE_OSTREAM) || defined(INCLUDE_IOMANIP) || defined(INCLUDE_IOS) || \ 00068 defined(INCLUDE_FSTREAM) || defined(INCLUDE_SSTREAM) 00069 #include "dcmtk/ofstd/ofstream.h" 00070 #endif 00071 00072 // we don't yet support <iterator>, <limits> 00073 00074 // define INCLUDE_LIST to include "oflist.h" 00075 #ifdef INCLUDE_LIST 00076 #include "dcmtk/ofstd/oflist.h" 00077 #endif 00078 00079 // we don't yet support <locale>, <map>, <memory>, <numeric>, <queue>, <set> 00080 00081 // define INCLUDE_NEW to include <new> or <new.h> if available 00082 #ifdef INCLUDE_NEW 00083 #ifdef USE_STD_CXX_INCLUDES 00084 #include <new> 00085 #elif defined(HAVE_NEW_H) 00086 #include <new.h> 00087 #endif 00088 #endif 00089 00090 // define INCLUDE_STACK to include "ofstack.h" 00091 #ifdef INCLUDE_STACK 00092 #include "dcmtk/ofstd/ofstack.h" 00093 #endif 00094 00095 // we don't yet support <stdexcept> 00096 00097 // define INCLUDE_STREAMBUF to include <streambuf> or <streambuf.h> if available 00098 #ifdef INCLUDE_STREAMBUF 00099 #ifdef USE_STD_CXX_INCLUDES 00100 #include <streambuf> 00101 #elif defined(HAVE_STREAMBUF_H) 00102 #include <streambuf.h> 00103 #endif 00104 #endif 00105 00106 // define INCLUDE_STRING to include "ofstring.h" 00107 #ifdef INCLUDE_STRING 00108 #include "dcmtk/ofstd/ofstring.h" 00109 #endif 00110 00111 // we don't yet support <typeinfo>, <valarray>, <vector> 00112 00113 00114 /* Header files as defined in ISO/IEC 14882:1998, Section 17.4.1.2, Table 12 00115 * These are header files for the Standard C Library. 00116 */ 00117 00118 // define INCLUDE_CASSERT to include <cassert> or <assert.h> if available 00119 #ifdef INCLUDE_CASSERT 00120 #ifdef USE_STD_CXX_INCLUDES 00121 #include <cassert> 00122 #elif defined(HAVE_ASSERT_H) 00123 BEGIN_EXTERN_C 00124 #include <assert.h> 00125 END_EXTERN_C 00126 #endif 00127 #endif 00128 00129 // define INCLUDE_CCTYPE to include <cctype> or <ctype.h> if available 00130 #ifdef INCLUDE_CCTYPE 00131 #ifdef USE_STD_CXX_INCLUDES 00132 #include <cctype> 00133 #elif defined(HAVE_CTYPE_H) 00134 BEGIN_EXTERN_C 00135 #include <ctype.h> 00136 END_EXTERN_C 00137 #endif 00138 #endif 00139 00140 // define INCLUDE_CERRNO to include <cerrno> or <errno.h> if available 00141 #ifdef INCLUDE_CERRNO 00142 #ifdef USE_STD_CXX_INCLUDES 00143 #include <cerrno> 00144 #elif defined(HAVE_ERRNO_H) 00145 BEGIN_EXTERN_C 00146 #include <errno.h> 00147 END_EXTERN_C 00148 #endif 00149 #endif 00150 00151 // define INCLUDE_CFLOAT to include <cfloat> or <float.h> if available 00152 #ifdef INCLUDE_CFLOAT 00153 #ifdef USE_STD_CXX_INCLUDES 00154 #include <cfloat> 00155 #elif defined(HAVE_FLOAT_H) 00156 BEGIN_EXTERN_C 00157 #include <float.h> 00158 END_EXTERN_C 00159 #endif 00160 #endif 00161 00162 // define INCLUDE_CISO646 to include <ciso646> or <iso646.h> if available 00163 #ifdef INCLUDE_CISO646 00164 #ifdef USE_STD_CXX_INCLUDES 00165 #include <ciso646> 00166 #elif defined(HAVE_ISO646_H) 00167 BEGIN_EXTERN_C 00168 #include <iso646.h> 00169 END_EXTERN_C 00170 #endif 00171 #endif 00172 00173 // define INCLUDE_CLIMITS to include <climits> or <limits.h> if available 00174 #ifdef INCLUDE_CLIMITS 00175 #ifdef USE_STD_CXX_INCLUDES 00176 #include <climits> 00177 #elif defined(HAVE_LIMITS_H) 00178 BEGIN_EXTERN_C 00179 #include <limits.h> 00180 END_EXTERN_C 00181 #endif 00182 #endif 00183 00184 // define INCLUDE_CLOCALE to include <clocale> or <locale.h> if available 00185 #ifdef INCLUDE_CLOCALE 00186 #ifdef USE_STD_CXX_INCLUDES 00187 #include <clocale> 00188 #elif defined(HAVE_LOCALE_H) 00189 BEGIN_EXTERN_C 00190 #include <locale.h> 00191 END_EXTERN_C 00192 #endif 00193 #endif 00194 00195 // define INCLUDE_CMATH to include <cmath> or <math.h> if available 00196 #ifdef INCLUDE_CMATH 00197 #ifdef USE_STD_CXX_INCLUDES 00198 #include <cmath> 00199 #elif defined(HAVE_MATH_H) 00200 #ifndef INCLUDE_MATH_H_AS_CXX 00201 // some systems use C++ language features in <math.h> 00202 BEGIN_EXTERN_C 00203 #endif 00204 #include <math.h> 00205 #ifndef INCLUDE_MATH_H_AS_CXX 00206 END_EXTERN_C 00207 #endif 00208 #endif 00209 #endif 00210 00211 // define INCLUDE_CSETJMP to include <csetjmp> or <setjmp.h> if available 00212 #ifdef INCLUDE_CSETJMP 00213 #ifdef USE_STD_CXX_INCLUDES 00214 #include <csetjmp> 00215 #elif defined(HAVE_SETJMP_H) 00216 BEGIN_EXTERN_C 00217 #include <setjmp.h> 00218 END_EXTERN_C 00219 #endif 00220 #endif 00221 00222 // define INCLUDE_CSIGNAL to include <csignal> or <signal.h> if available 00223 #ifdef INCLUDE_CSIGNAL 00224 #ifdef USE_STD_CXX_INCLUDES 00225 #include <csignal> 00226 #elif defined(HAVE_SIGNAL_H) 00227 BEGIN_EXTERN_C 00228 #include <signal.h> 00229 END_EXTERN_C 00230 #endif 00231 #endif 00232 00233 // define INCLUDE_CSTDARG to include <cstdarg> or <stdarg.h> if available 00234 #ifdef INCLUDE_CSTDARG 00235 #ifdef USE_STD_CXX_INCLUDES 00236 #include <cstdarg> 00237 #elif defined(HAVE_STDARG_H) 00238 BEGIN_EXTERN_C 00239 #include <stdarg.h> 00240 END_EXTERN_C 00241 #endif 00242 #endif 00243 00244 // define INCLUDE_CSTDDEF to include <cstddef> or <stddef.h> if available 00245 #ifdef INCLUDE_CSTDDEF 00246 #ifdef USE_STD_CXX_INCLUDES 00247 #include <cstddef> 00248 #elif defined(HAVE_STDDEF_H) 00249 BEGIN_EXTERN_C 00250 #include <stddef.h> 00251 END_EXTERN_C 00252 #endif 00253 #endif 00254 00255 // define INCLUDE_CSTDIO to include <cstdio> or <stdio.h> if available 00256 #ifdef INCLUDE_CSTDIO 00257 #ifdef USE_STD_CXX_INCLUDES 00258 #include <cstdio> 00259 #elif defined(HAVE_STDIO_H) 00260 BEGIN_EXTERN_C 00261 #include <stdio.h> 00262 END_EXTERN_C 00263 #endif 00264 // MSVC6 doesn't know vsnprintf(), but it does know _vsnprintf() 00265 #if defined(_WIN32) && !defined(HAVE_VSNPRINTF) 00266 #define vsnprintf _vsnprintf 00267 #endif 00268 #endif 00269 00270 // define INCLUDE_CSTDLIB to include <cstdlib> or <stdlib.h> if available 00271 #ifdef INCLUDE_CSTDLIB 00272 #ifdef USE_STD_CXX_INCLUDES 00273 #include <cstdlib> 00274 #elif defined(HAVE_STDLIB_H) 00275 /* workaround for bug in Borland C++ Builder */ 00276 #ifndef __BORLANDC__ 00277 BEGIN_EXTERN_C 00278 #endif 00279 #include <stdlib.h> 00280 #ifndef __BORLANDC__ 00281 END_EXTERN_C 00282 #endif 00283 #endif 00284 #endif 00285 00286 // define INCLUDE_CSTRING to include <cstring> or <string.h> if available 00287 #ifdef INCLUDE_CSTRING 00288 #ifdef USE_STD_CXX_INCLUDES 00289 #include <cstring> 00290 #elif defined(HAVE_STRING_H) 00291 BEGIN_EXTERN_C 00292 #include <string.h> 00293 END_EXTERN_C 00294 #endif 00295 // Some platforms define additional string functions like bzero or 00296 // strcasecmp in <strings.h>, so we always include this file if available. 00297 #ifdef HAVE_STRINGS_H 00298 BEGIN_EXTERN_C 00299 #include <strings.h> 00300 END_EXTERN_C 00301 #endif 00302 #endif 00303 00304 // define INCLUDE_CTIME to include <ctime> or <time.h> if available 00305 #ifdef INCLUDE_CTIME 00306 #ifdef USE_STD_CXX_INCLUDES 00307 #include <ctime> 00308 #elif defined(HAVE_TIME_H) 00309 BEGIN_EXTERN_C 00310 #include <time.h> 00311 END_EXTERN_C 00312 #endif 00313 #endif 00314 00315 // define INCLUDE_CWCTYPE to include <cwctype> or <wctype.h> if available 00316 #ifdef INCLUDE_CWCTYPE 00317 #ifdef USE_STD_CXX_INCLUDES 00318 #include <cwctype> 00319 #elif defined(HAVE_WCTYPE_H) 00320 BEGIN_EXTERN_C 00321 #include <wctype.h> 00322 END_EXTERN_C 00323 #endif 00324 #endif 00325 00326 00327 /* Headers other than ISO C++, such as BSD and Posix.1 headers */ 00328 00329 // define INCLUDE_LIBC to include <libc.h> if available 00330 #ifdef INCLUDE_LIBC 00331 #ifdef HAVE_LIBC_H 00332 #ifndef INCLUDE_LIBC_H_AS_CXX 00333 BEGIN_EXTERN_C 00334 #endif 00335 #include <libc.h> 00336 #ifndef INCLUDE_LIBC_H_AS_CXX 00337 END_EXTERN_C 00338 #endif 00339 #endif 00340 #endif 00341 00342 // define INCLUDE_UNISTD to include <unistd.h> if available 00343 #ifdef INCLUDE_UNISTD 00344 #ifdef HAVE_UNISTD_H 00345 BEGIN_EXTERN_C 00346 #include <unistd.h> 00347 END_EXTERN_C 00348 #endif 00349 #endif 00350 00351 00352 00353 00354 /* 00355 * CVS/RCS Log: 00356 * $Log: ofstdinc.h,v $ 00357 * Revision 1.15 2010-10-14 13:15:50 joergr 00358 * Updated copyright header. Added reference to COPYRIGHT file. 00359 * 00360 * Revision 1.14 2010-03-11 08:37:24 uli 00361 * Use _vsnprintf() on MSVC6 since it doesn't know vsnprintf(). 00362 * 00363 * Revision 1.13 2007-02-19 15:16:16 meichel 00364 * Namespace std is not imported into the default namespace anymore, 00365 * unless DCMTK is compiled with macro USING_STD_NAMESPACE defined. 00366 * 00367 * Revision 1.12 2006/08/14 16:42:02 meichel 00368 * Defined two new macros: STD_NAMESPACE is defined to std:: if the standard 00369 * namespace exists and empty otherwise. OFendl is defined as std::endl if 00370 * the standard namespace exists and as endl otherwise. 00371 * 00372 * Revision 1.11 2005/12/08 16:06:05 meichel 00373 * Changed include path schema for all DCMTK header files 00374 * 00375 * Revision 1.10 2004/08/03 11:45:09 meichel 00376 * Added macros INCLUDE_LIBC and INCLUDE_UNISTD that correctly include libc.h 00377 * 00378 * Revision 1.9 2004/05/07 10:46:32 meichel 00379 * Removed unneeded semicolon, reported by gcc 3.4 00380 * 00381 * Revision 1.8 2003/12/11 13:40:22 meichel 00382 * Added support for including <new> or <new.h> 00383 * 00384 * Revision 1.7 2003/10/13 13:38:44 meichel 00385 * Activated Borland stdlib workaround for compiler versions other than 4. 00386 * 00387 * Revision 1.6 2002/12/16 16:20:45 meichel 00388 * Added configure test that checks if extern "C" inclusion 00389 * of <math.h> fails, e.g. on HP/UX 10 and WIN32 00390 * 00391 * Revision 1.5 2002/12/11 15:54:47 meichel 00392 * Added empty namespace std declaration, needed on MSVC. 00393 * 00394 * Revision 1.4 2002/11/28 17:16:39 meichel 00395 * Including <math.h> without extern "C" on Win32 to avoid problem with MSVC5. 00396 * 00397 * Revision 1.3 2002/11/27 17:21:18 meichel 00398 * Fixed bug in ofstack inclusion code 00399 * 00400 * Revision 1.2 2002/11/27 12:33:34 meichel 00401 * Now including <strings.h> even if <string.h> is present. 00402 * 00403 * Revision 1.1 2002/11/27 11:20:52 meichel 00404 * Added new file ofstdinc.h that encapsulates the inclusion 00405 * of old style vs. ISO C++ standard header files. 00406 * 00407 * 00408 */