00001 /* 00002 * 00003 * Copyright (C) 2002-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: ofstd 00019 * 00020 * Author: Andreas Barth 00021 * 00022 * Purpose: C++ header to handle standard and old stream libraries. 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:06:06 $ 00026 * CVS/RCS Revision: $Revision: 1.7 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef OFSTREAM_H 00035 #define OFSTREAM_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 00039 #ifdef USE_STD_CXX_INCLUDES 00040 00041 #include <iostream> 00042 #ifdef HAVE_IOS 00043 #include <ios> 00044 #endif 00045 #include <fstream> 00046 #include <iomanip> 00047 // For standard STREAMS library: preference for standard stringstream 00048 #if defined(HAVE_SSTREAM) 00049 #include <sstream> 00050 #define USE_STRINGSTREAM 00051 #elif defined(HAVE_STRSTREAM) 00052 #include <strstream> 00053 #else 00054 #error DCMTK needs stringstream or strstream type 00055 #endif 00056 #ifdef HAVE_STD_NAMESPACE 00057 namespace std { } 00058 using namespace std; 00059 #endif 00060 00061 #else /* USE_STD_CXX_INCLUDES */ 00062 00063 #include <iostream.h> 00064 #include <fstream.h> 00065 // For old STREAMS library: preference for strstream 00066 #if defined(HAVE_STRSTREA_H) || defined(HAVE_STRSTREAM_H) 00067 #ifdef HAVE_STRSTREA_H 00068 #include <strstrea.h> 00069 #else 00070 #include <strstream.h> 00071 #endif 00072 #elif defined(HAVE_SSTREAM_H) 00073 #include <sstream.h> 00074 #define USE_STRINGSTREAM 00075 #else 00076 #error DCMTK needs stringstream or strstream type 00077 #endif 00078 #include <iomanip.h> 00079 00080 #endif 00081 00082 #ifdef USE_STRINGSTREAM 00083 00084 typedef stringstream OFStringStream; 00085 typedef ostringstream OFOStringStream; 00086 typedef istringstream OFIStringStream; 00087 00088 #define OFStringStream_ends "" 00089 #define OFSTRINGSTREAM_GETOFSTRING(oss, string) \ 00090 OFString string((oss).str().c_str()); 00091 // The following two macros define a block structure. Please note that variables 00092 // declared between xxx_GETSTR and xxx_FREESTR are only valid within this scope. 00093 #define OFSTRINGSTREAM_GETSTR(oss, chptr) \ 00094 { \ 00095 string chptr##__ = (oss).str(); \ 00096 const char *chptr = chptr##__.c_str(); 00097 #define OFSTRINGSTREAM_FREESTR(chptr) \ 00098 } 00099 00100 #else /* USE_STRINGSTREAM */ 00101 00102 typedef strstream OFStringStream; 00103 typedef ostrstream OFOStringStream; 00104 typedef istrstream OFIStringStream; 00105 00106 #define OFStringStream_ends ends 00107 #define OFSTRINGSTREAM_GETOFSTRING(oss, string) \ 00108 char * string##__ = (oss).str(); \ 00109 OFString string(string##__); \ 00110 delete[] string##__; 00111 // The following two macros define a block structure. Please note that variables 00112 // declared between xxx_GETSTR and xxx_FREESTR are only valid within this scope. 00113 #define OFSTRINGSTREAM_GETSTR(oss, chptr) \ 00114 { \ 00115 const char *chptr = (oss).str(); 00116 #define OFSTRINGSTREAM_FREESTR(chptr) \ 00117 delete[] (char *)chptr; \ 00118 } 00119 00120 #endif /* USE_STRINGSTREAM */ 00121 00122 #endif /* USE_STD_CXX_INCLUDES */ 00123 00124 00125 /* 00126 * CVS/RCS Log: 00127 * $Log: ofstream.h,v $ 00128 * Revision 1.7 2005/12/08 16:06:06 meichel 00129 * Changed include path schema for all DCMTK header files 00130 * 00131 * Revision 1.6 2004/05/07 10:46:32 meichel 00132 * Removed unneeded semicolon, reported by gcc 3.4 00133 * 00134 * Revision 1.5 2004/01/16 10:30:12 joergr 00135 * Removed acknowledgements with e-mail addresses from CVS log. 00136 * 00137 * Revision 1.4 2003/12/05 10:37:41 joergr 00138 * Removed leading underscore characters from preprocessor symbols (reserved 00139 * symbols). Updated copyright date where appropriate. 00140 * 00141 * Revision 1.3 2002/12/11 15:54:48 meichel 00142 * Added empty namespace std declaration, needed on MSVC. 00143 * 00144 * Revision 1.2 2002/05/02 14:05:50 joergr 00145 * Added support for standard and non-standard string streams (which one is 00146 * supported is detected automatically via the configure mechanism). 00147 * 00148 * Revision 1.1 2002/04/16 13:36:03 joergr 00149 * Added configurable support for C++ ANSI standard includes (e.g. streams). 00150 * 00151 */