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 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE 00030 Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it; 00031 #endif 00032 00033 class vtkIndent; 00034 class vtkObjectBase; 00035 class vtkLargeInteger; 00036 class vtkSmartPointerBase; 00037 class vtkStdString; 00038 00039 class VTK_COMMON_EXPORT vtkOStreamWrapper 00040 { 00041 public: 00043 00045 vtkOStreamWrapper(ostream& os); 00046 vtkOStreamWrapper(vtkOStreamWrapper& r); 00048 00049 virtual ~vtkOStreamWrapper(); 00050 00052 struct EndlType {}; 00053 00055 00056 vtkOStreamWrapper& operator << (const EndlType&); 00057 vtkOStreamWrapper& operator << (const vtkIndent&); 00058 vtkOStreamWrapper& operator << (vtkObjectBase&); 00059 vtkOStreamWrapper& operator << (const vtkLargeInteger&); 00060 vtkOStreamWrapper& operator << (const vtkSmartPointerBase&); 00061 vtkOStreamWrapper& operator << (const vtkStdString&); 00062 vtkOStreamWrapper& operator << (ostream&); 00063 vtkOStreamWrapper& operator << (const char*); 00064 vtkOStreamWrapper& operator << (void*); 00065 vtkOStreamWrapper& operator << (char); 00066 vtkOStreamWrapper& operator << (short); 00067 vtkOStreamWrapper& operator << (int); 00068 vtkOStreamWrapper& operator << (long); 00069 vtkOStreamWrapper& operator << (unsigned char); 00070 vtkOStreamWrapper& operator << (unsigned short); 00071 vtkOStreamWrapper& operator << (unsigned int); 00072 vtkOStreamWrapper& operator << (unsigned long); 00073 vtkOStreamWrapper& operator << (float); 00074 vtkOStreamWrapper& operator << (double); 00075 #if defined(VTK_TYPE_USE_LONG_LONG) 00076 vtkOStreamWrapper& operator << (long long); 00077 vtkOStreamWrapper& operator << (unsigned long long); 00078 #endif 00079 #if defined(VTK_TYPE_USE___INT64) 00080 vtkOStreamWrapper& operator << (__int64); 00081 vtkOStreamWrapper& operator << (unsigned __int64); 00082 #endif 00083 00084 00085 // Need to switch on bool type because this wrapper is supposed to 00086 // be as transparent as possible to user code. This example should 00087 // not be used to justify using bool elsewhere in VTK. 00088 #ifdef VTK_COMPILER_HAS_BOOL 00089 vtkOStreamWrapper& operator << (bool); 00090 #endif 00091 00092 // Work-around for IBM Visual Age bug in overload resolution. 00093 #if defined(__IBMCPP__) 00094 vtkOStreamWrapper& WriteInternal(const char*); 00095 vtkOStreamWrapper& WriteInternal(void*); 00096 template <typename T> 00097 vtkOStreamWrapper& operator << (T* p) 00098 { 00099 return this->WriteInternal(p); 00100 } 00101 #endif 00102 00103 vtkOStreamWrapper& operator << (void (*)(void*)); 00104 vtkOStreamWrapper& operator << (void* (*)(void*)); 00105 vtkOStreamWrapper& operator << (int (*)(void*)); 00106 vtkOStreamWrapper& operator << (int* (*)(void*)); 00107 vtkOStreamWrapper& operator << (float* (*)(void*)); 00108 vtkOStreamWrapper& operator << (const char* (*)(void*)); 00109 vtkOStreamWrapper& operator << (void (*)(void*, int*)); 00110 00112 vtkOStreamWrapper& write(const char*, unsigned long); 00113 00115 ostream& GetOStream(); 00116 00120 operator ostream&(); 00121 00123 operator int(); 00124 00126 void flush(); 00127 00129 00131 static void UseEndl(const EndlType&) {} 00132 protected: 00133 // Reference to the real ostream. 00134 ostream& ostr; 00135 private: 00136 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented. 00137 }; 00139 00140 #endif