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 # ifdef _WIN32_WCE 00068 # include "vtkWinCE.h" // Include mini-streams for Windows CE. 00069 # else 00070 # include <iostream.h> // Include old-style istream and ostream. 00071 # include <iomanip.h> 00072 # include <fstream.h> // Include old-style ifstream and ofstream. 00073 # endif 00074 #endif 00075 00076 //---------------------------------------------------------------------------- 00077 // Include deprecated strstream headers? If including file has explicitly 00078 // defined VTK_INCLUDE_STRSTREAM_HEADERS or VTK_EXCLUDE_STRSTREAM_HEADERS, 00079 // then honor the setting. Otherwise, use the legacy defines to figure out 00080 // if the deprecated strstream headers should be included... 00081 // 00082 // To prevent VTK from including the strstream headers, define 00083 // VTK_EXCLUDE_STRSTREAM_HEADERS before including any VTK header files 00084 // or set the VTK_LEGACY_REMOVE CMake option to ON. 00085 // 00086 // Clients may include <vtksys/ios/sstream> directly in their code and should 00087 // prefer ostringstream and istringstream over ostrstream and istrstream. 00088 // 00089 #if !defined(VTK_INCLUDE_STRSTREAM_HEADERS) 00090 # if defined(VTK_LEGACY_REMOVE) 00091 // Remove legacy code - do NOT include the strstream headers 00092 # elif defined(VTK_LEGACY_SILENT) 00093 // Silently still include legacy code - DO include the strstream headers 00094 # define VTK_INCLUDE_STRSTREAM_HEADERS 00095 # else 00096 // Default case - DO include the strstream headers for strict 00097 // backwards compatibility unless client has explicitly defined 00098 // VTK_EXCLUDE_STRSTREAM_HEADERS. 00099 # if !defined(VTK_EXCLUDE_STRSTREAM_HEADERS) 00100 # define VTK_INCLUDE_STRSTREAM_HEADERS 00101 # endif 00102 # endif 00103 #endif 00104 00105 #if defined(VTK_INCLUDE_STRSTREAM_HEADERS) 00106 00107 # ifdef VTK_USE_ANSI_STDLIB 00108 // Include real ansi strstreams. 00109 00110 # ifdef _MSC_VER 00111 # pragma warning(push, 3) 00112 # endif 00113 00114 # include <strstream> 00115 00116 using std::ostrstream; 00117 using std::istrstream; 00118 using std::strstream; 00119 00120 # ifdef _MSC_VER 00121 # pragma warning(pop) 00122 # endif 00123 00124 # else 00125 // Include old-style streams. 00126 00127 # ifndef _WIN32_WCE 00128 # if defined(_MSC_VER) 00129 # include <strstrea.h> // Include old-style strstream from MSVC. 00130 # else 00131 # include <strstream.h> // Include old-style strstream. 00132 # endif 00133 # endif 00134 00135 # endif 00136 00137 #endif 00138 00139 //---------------------------------------------------------------------------- 00140 #if defined(VTK_IOSTREAM_NEED_OPERATORS_LL) 00141 00142 # if !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG) 00143 VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamSLL&); 00144 # if !defined(VTK_DO_NOT_DEFINE_ISTREAM_SLL) 00145 inline istream& operator >> (istream& is, vtkIOStreamSLL& value) 00146 { 00147 return vtkIOStreamScan(is, value); 00148 } 00149 # endif 00150 00151 VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamULL&); 00152 # if !defined(VTK_DO_NOT_DEFINE_ISTREAM_ULL) 00153 inline istream& operator >> (istream& is, vtkIOStreamULL& value) 00154 { 00155 return vtkIOStreamScan(is, value); 00156 } 00157 # endif 00158 # endif 00159 00160 # if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG) 00161 VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamSLL); 00162 # if !defined(VTK_DO_NOT_DEFINE_OSTREAM_SLL) 00163 inline ostream& operator << (ostream& os, vtkIOStreamSLL value) 00164 { 00165 return vtkIOStreamPrint(os, value); 00166 } 00167 # endif 00168 00169 VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamULL); 00170 # if !defined(VTK_DO_NOT_DEFINE_OSTREAM_ULL) 00171 inline ostream& operator << (ostream& os, vtkIOStreamULL value) 00172 { 00173 return vtkIOStreamPrint(os, value); 00174 } 00175 # endif 00176 # endif 00177 00178 #endif 00179 00180 #endif // __vtkIOStream_h