VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOStreamWrapper.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 =========================================================================*/ 00026 #ifndef vtkOStreamWrapper_h 00027 #define vtkOStreamWrapper_h 00028 00029 #include "vtkCommonCoreModule.h" 00030 00031 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE 00032 Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it; 00033 #endif 00034 00035 class vtkIndent; 00036 class vtkObjectBase; 00037 class vtkLargeInteger; 00038 class vtkSmartPointerBase; 00039 // workaround clang bug, needs export on forward declaration 00040 #ifdef __clang__ 00041 class VTKCOMMONCORE_EXPORT vtkStdString; 00042 #else 00043 class vtkStdString; 00044 #endif 00045 00046 class VTKCOMMONCORE_EXPORT vtkOStreamWrapper 00047 { 00048 class std_string; 00049 public: 00051 00053 vtkOStreamWrapper(ostream& os); 00054 vtkOStreamWrapper(vtkOStreamWrapper& r); 00056 00057 virtual ~vtkOStreamWrapper(); 00058 00060 struct EndlType {}; 00061 00063 00064 vtkOStreamWrapper& operator << (const EndlType&); 00065 vtkOStreamWrapper& operator << (const vtkIndent&); 00066 vtkOStreamWrapper& operator << (vtkObjectBase&); 00067 vtkOStreamWrapper& operator << (const vtkLargeInteger&); 00068 vtkOStreamWrapper& operator << (const vtkSmartPointerBase&); 00069 vtkOStreamWrapper& operator << (const vtkStdString&); 00070 vtkOStreamWrapper& operator << (const char*); 00071 vtkOStreamWrapper& operator << (void*); 00072 vtkOStreamWrapper& operator << (char); 00073 vtkOStreamWrapper& operator << (short); 00074 vtkOStreamWrapper& operator << (int); 00075 vtkOStreamWrapper& operator << (long); 00076 vtkOStreamWrapper& operator << (unsigned char); 00077 vtkOStreamWrapper& operator << (unsigned short); 00078 vtkOStreamWrapper& operator << (unsigned int); 00079 vtkOStreamWrapper& operator << (unsigned long); 00080 vtkOStreamWrapper& operator << (float); 00081 vtkOStreamWrapper& operator << (double); 00082 #if defined(VTK_TYPE_USE_LONG_LONG) 00083 vtkOStreamWrapper& operator << (long long); 00084 vtkOStreamWrapper& operator << (unsigned long long); 00085 #endif 00086 #if defined(VTK_TYPE_USE___INT64) 00087 vtkOStreamWrapper& operator << (__int64); 00088 vtkOStreamWrapper& operator << (unsigned __int64); 00089 #endif 00090 vtkOStreamWrapper& operator << (bool); 00092 00093 // Work-around for IBM Visual Age bug in overload resolution. 00094 #if defined(__IBMCPP__) 00095 vtkOStreamWrapper& WriteInternal(const char*); 00096 vtkOStreamWrapper& WriteInternal(void*); 00097 template <typename T> 00098 vtkOStreamWrapper& operator << (T* p) 00099 { 00100 return this->WriteInternal(p); 00101 } 00102 #endif 00103 00104 vtkOStreamWrapper& operator << (void (*)(void*)); 00105 vtkOStreamWrapper& operator << (void* (*)(void*)); 00106 vtkOStreamWrapper& operator << (int (*)(void*)); 00107 vtkOStreamWrapper& operator << (int* (*)(void*)); 00108 vtkOStreamWrapper& operator << (float* (*)(void*)); 00109 vtkOStreamWrapper& operator << (const char* (*)(void*)); 00110 vtkOStreamWrapper& operator << (void (*)(void*, int*)); 00111 00112 // Accept std::string without a declaration. 00113 template <template <typename, typename, typename> class S> 00114 vtkOStreamWrapper& operator << (const 00115 S< char, std::char_traits<char>, std::allocator<char> >& s) 00116 { 00117 return *this << reinterpret_cast<std_string const&>(s); 00118 } 00119 00121 vtkOStreamWrapper& write(const char*, unsigned long); 00122 00124 ostream& GetOStream(); 00125 00129 operator ostream&(); 00130 00132 operator int(); 00133 00135 void flush(); 00136 00138 00140 static void UseEndl(const EndlType&) {} 00141 protected: 00142 // Reference to the real ostream. 00143 ostream& ostr; 00144 private: 00145 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented. 00146 vtkOStreamWrapper& operator << (std_string const&); 00147 }; 00149 00150 #endif 00151 // VTK-HeaderTest-Exclude: vtkOStreamWrapper.h