VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkIOStream.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00022 #ifndef __vtkIOStream_h 00023 #define __vtkIOStream_h 00024 00025 #include "vtkConfigure.h" 00026 00027 #define __VTK_SYSTEM_INCLUDES__INSIDE 00028 #include "vtkWin32Header.h" // For export macros. 00029 #undef __VTK_SYSTEM_INCLUDES__INSIDE 00030 00031 #ifdef VTK_USE_ANSI_STDLIB 00032 00033 #ifdef _MSC_VER 00034 #pragma warning (push, 3) 00035 #endif 00036 00037 # include <iostream> // Include real ansi istream and ostream. 00038 # include <fstream> // Include real ansi ifstream and ofstream. 00039 # include <iomanip> // Include real ansi io manipulators. 00040 00041 // Need these in global namespace so the same code will work with ansi 00042 // and old-style streams. 00043 using std::dec; 00044 using std::hex; 00045 using std::setw; 00046 using std::setfill; 00047 using std::setprecision; 00048 using std::cerr; 00049 using std::cout; 00050 using std::cin; 00051 using std::ios; 00052 using std::endl; 00053 using std::ends; 00054 using std::ostream; 00055 using std::istream; 00056 using std::ofstream; 00057 using std::ifstream; 00058 using std::fstream; 00059 00060 #ifdef _MSC_VER 00061 #pragma warning(pop) 00062 #endif 00063 00064 #else 00065 00066 // Include old-style streams. 00067 # include <iostream.h> // Include old-style istream and ostream. 00068 # include <iomanip.h> 00069 # include <fstream.h> // Include old-style ifstream and ofstream. 00070 #endif 00071 00072 //---------------------------------------------------------------------------- 00073 // Include deprecated strstream headers? If including file has explicitly 00074 // defined VTK_INCLUDE_STRSTREAM_HEADERS or VTK_EXCLUDE_STRSTREAM_HEADERS, 00075 // then honor the setting. Otherwise, use the legacy defines to figure out 00076 // if the deprecated strstream headers should be included... 00077 // 00078 // To prevent VTK from including the strstream headers, define 00079 // VTK_EXCLUDE_STRSTREAM_HEADERS before including any VTK header files 00080 // or set the VTK_LEGACY_REMOVE CMake option to ON. 00081 // 00082 // Clients may include <vtksys/ios/sstream> directly in their code and should 00083 // prefer ostringstream and istringstream over ostrstream and istrstream. 00084 // 00085 #if !defined(VTK_INCLUDE_STRSTREAM_HEADERS) 00086 # if defined(VTK_LEGACY_REMOVE) 00087 // Remove legacy code - do NOT include the strstream headers 00088 # elif defined(VTK_LEGACY_SILENT) 00089 // Silently still include legacy code - DO include the strstream headers 00090 # define VTK_INCLUDE_STRSTREAM_HEADERS 00091 # else 00092 // Default case - DO include the strstream headers for strict 00093 // backwards compatibility unless client has explicitly defined 00094 // VTK_EXCLUDE_STRSTREAM_HEADERS. 00095 # if !defined(VTK_EXCLUDE_STRSTREAM_HEADERS) 00096 # define VTK_INCLUDE_STRSTREAM_HEADERS 00097 # endif 00098 # endif 00099 #endif 00100 00101 #if defined(VTK_INCLUDE_STRSTREAM_HEADERS) 00102 00103 # ifdef VTK_USE_ANSI_STDLIB 00104 // Include real ansi strstreams. 00105 00106 # ifdef _MSC_VER 00107 # pragma warning(push, 3) 00108 # endif 00109 00110 # include <strstream> 00111 00112 using std::ostrstream; 00113 using std::istrstream; 00114 using std::strstream; 00115 00116 # ifdef _MSC_VER 00117 # pragma warning(pop) 00118 # endif 00119 00120 # else 00121 // Include old-style streams. 00122 00123 # ifndef _WIN32_WCE 00124 # if defined(_MSC_VER) 00125 # include <strstrea.h> // Include old-style strstream from MSVC. 00126 # else 00127 # include <strstream.h> // Include old-style strstream. 00128 # endif 00129 # endif 00130 00131 # endif 00132 00133 #endif 00134 00135 //---------------------------------------------------------------------------- 00136 #if defined(VTK_IOSTREAM_NEED_OPERATORS_LL) 00137 00138 # if !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG) 00139 VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamSLL&); 00140 # if !defined(VTK_DO_NOT_DEFINE_ISTREAM_SLL) 00141 inline istream& operator >> (istream& is, vtkIOStreamSLL& value) 00142 { 00143 return vtkIOStreamScan(is, value); 00144 } 00145 # endif 00146 00147 VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamULL&); 00148 # if !defined(VTK_DO_NOT_DEFINE_ISTREAM_ULL) 00149 inline istream& operator >> (istream& is, vtkIOStreamULL& value) 00150 { 00151 return vtkIOStreamScan(is, value); 00152 } 00153 # endif 00154 # endif 00155 00156 # if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG) 00157 VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamSLL); 00158 # if !defined(VTK_DO_NOT_DEFINE_OSTREAM_SLL) 00159 inline ostream& operator << (ostream& os, vtkIOStreamSLL value) 00160 { 00161 return vtkIOStreamPrint(os, value); 00162 } 00163 # endif 00164 00165 VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamULL); 00166 # if !defined(VTK_DO_NOT_DEFINE_OSTREAM_ULL) 00167 inline ostream& operator << (ostream& os, vtkIOStreamULL value) 00168 { 00169 return vtkIOStreamPrint(os, value); 00170 } 00171 # endif 00172 # endif 00173 00174 #endif 00175 00176 #endif // __vtkIOStream_h