VTK
vtkIOStream.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkIOStream.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef __vtkIOStream_h
23 #define __vtkIOStream_h
24 
25 #include "vtkConfigure.h"
26 
27 #define __VTK_SYSTEM_INCLUDES__INSIDE
28 #include "vtkWin32Header.h" // For export macros.
29 #undef __VTK_SYSTEM_INCLUDES__INSIDE
30 
31 #ifdef VTK_USE_ANSI_STDLIB
32 
33 #ifdef _MSC_VER
34 #pragma warning (push, 3)
35 #endif
36 
37 # include <iostream> // Include real ansi istream and ostream.
38 # include <fstream> // Include real ansi ifstream and ofstream.
39 # include <iomanip> // Include real ansi io manipulators.
40 
41 // Need these in global namespace so the same code will work with ansi
42 // and old-style streams.
43 using std::dec;
44 using std::hex;
45 using std::setw;
46 using std::setfill;
47 using std::setprecision;
48 using std::cerr;
49 using std::cout;
50 using std::cin;
51 using std::ios;
52 using std::endl;
53 using std::ends;
54 using std::ostream;
55 using std::istream;
56 using std::ofstream;
57 using std::ifstream;
58 using std::fstream;
59 
60 #ifdef _MSC_VER
61 #pragma warning(pop)
62 #endif
63 
64 #else
65 
66 // Include old-style streams.
67 # ifdef _WIN32_WCE
68 # include "vtkWinCE.h" // Include mini-streams for Windows CE.
69 # else
70 # include <iostream.h> // Include old-style istream and ostream.
71 # include <iomanip.h>
72 # include <fstream.h> // Include old-style ifstream and ofstream.
73 # endif
74 #endif
75 
76 //----------------------------------------------------------------------------
77 // Include deprecated strstream headers? If including file has explicitly
78 // defined VTK_INCLUDE_STRSTREAM_HEADERS or VTK_EXCLUDE_STRSTREAM_HEADERS,
79 // then honor the setting. Otherwise, use the legacy defines to figure out
80 // if the deprecated strstream headers should be included...
81 //
82 // To prevent VTK from including the strstream headers, define
83 // VTK_EXCLUDE_STRSTREAM_HEADERS before including any VTK header files
84 // or set the VTK_LEGACY_REMOVE CMake option to ON.
85 //
86 // Clients may include <vtksys/ios/sstream> directly in their code and should
87 // prefer ostringstream and istringstream over ostrstream and istrstream.
88 //
89 #if !defined(VTK_INCLUDE_STRSTREAM_HEADERS)
90 # if defined(VTK_LEGACY_REMOVE)
91 // Remove legacy code - do NOT include the strstream headers
92 # elif defined(VTK_LEGACY_SILENT)
93 // Silently still include legacy code - DO include the strstream headers
94 # define VTK_INCLUDE_STRSTREAM_HEADERS
95 # else
96 // Default case - DO include the strstream headers for strict
97 // backwards compatibility unless client has explicitly defined
98 // VTK_EXCLUDE_STRSTREAM_HEADERS.
99 # if !defined(VTK_EXCLUDE_STRSTREAM_HEADERS)
100 # define VTK_INCLUDE_STRSTREAM_HEADERS
101 # endif
102 # endif
103 #endif
104 
105 #if defined(VTK_INCLUDE_STRSTREAM_HEADERS)
106 
107 # ifdef VTK_USE_ANSI_STDLIB
108 // Include real ansi strstreams.
109 
110 # ifdef _MSC_VER
111 # pragma warning(push, 3)
112 # endif
113 
114 # include <strstream>
115 
116 using std::ostrstream;
117 using std::istrstream;
118 using std::strstream;
119 
120 # ifdef _MSC_VER
121 # pragma warning(pop)
122 # endif
123 
124 # else
125 // Include old-style streams.
126 
127 # ifndef _WIN32_WCE
128 # if defined(_MSC_VER)
129 # include <strstrea.h> // Include old-style strstream from MSVC.
130 # else
131 # include <strstream.h> // Include old-style strstream.
132 # endif
133 # endif
134 
135 # endif
136 
137 #endif
138 
139 //----------------------------------------------------------------------------
140 #if defined(VTK_IOSTREAM_NEED_OPERATORS_LL)
141 
142 # if !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG)
143 VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamSLL&);
144 # if !defined(VTK_DO_NOT_DEFINE_ISTREAM_SLL)
145 inline istream& operator >> (istream& is, vtkIOStreamSLL& value)
146 {
147  return vtkIOStreamScan(is, value);
148 }
149 # endif
150 
151 VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamULL&);
152 # if !defined(VTK_DO_NOT_DEFINE_ISTREAM_ULL)
153 inline istream& operator >> (istream& is, vtkIOStreamULL& value)
154 {
155  return vtkIOStreamScan(is, value);
156 }
157 # endif
158 # endif
159 
160 # if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG)
161 VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamSLL);
162 # if !defined(VTK_DO_NOT_DEFINE_OSTREAM_SLL)
163 inline ostream& operator << (ostream& os, vtkIOStreamSLL value)
164 {
165  return vtkIOStreamPrint(os, value);
166 }
167 # endif
168 
169 VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamULL);
170 # if !defined(VTK_DO_NOT_DEFINE_OSTREAM_ULL)
171 inline ostream& operator << (ostream& os, vtkIOStreamULL value)
172 {
173  return vtkIOStreamPrint(os, value);
174 }
175 # endif
176 # endif
177 
178 #endif
179 
180 #endif // __vtkIOStream_h
#define VTK_COMMON_EXPORT
VTK_COMMON_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)