00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkOStreamWrapper.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00040 #ifndef __vtkOStreamWrapper_h 00041 #define __vtkOStreamWrapper_h 00042 00043 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE 00044 Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it; 00045 #endif 00046 00047 class vtkIndent; 00048 class vtkObjectBase; 00049 class vtkLargeInteger; 00050 class vtkSmartPointerBase; 00051 00052 class VTK_COMMON_EXPORT vtkOStreamWrapper 00053 { 00054 public: 00056 00058 vtkOStreamWrapper(ostream& os); 00059 vtkOStreamWrapper(vtkOStreamWrapper& r); 00061 00063 struct EndlType {}; 00064 00066 00067 vtkOStreamWrapper& operator << (const EndlType&); 00068 vtkOStreamWrapper& operator << (const vtkIndent&); 00069 vtkOStreamWrapper& operator << (vtkObjectBase&); 00070 vtkOStreamWrapper& operator << (const vtkLargeInteger&); 00071 vtkOStreamWrapper& operator << (const vtkSmartPointerBase&); 00072 vtkOStreamWrapper& operator << (ostream&); 00073 vtkOStreamWrapper& operator << (const char*); 00074 vtkOStreamWrapper& operator << (void*); 00075 vtkOStreamWrapper& operator << (char); 00076 vtkOStreamWrapper& operator << (short); 00077 vtkOStreamWrapper& operator << (int); 00078 vtkOStreamWrapper& operator << (long); 00079 vtkOStreamWrapper& operator << (unsigned char); 00080 vtkOStreamWrapper& operator << (unsigned short); 00081 vtkOStreamWrapper& operator << (unsigned int); 00082 vtkOStreamWrapper& operator << (unsigned long); 00083 vtkOStreamWrapper& operator << (float); 00084 vtkOStreamWrapper& operator << (double); 00086 00087 // Need to switch on bool type because this wrapper is supposed to 00088 // be as transparent as possible to user code. This example should 00089 // not be used to justify using bool elsewhere in VTK. 00090 #ifdef VTK_COMPILER_HAS_BOOL 00091 vtkOStreamWrapper& operator << (bool); 00092 #endif 00093 00094 #ifdef VTK_NEED_ID_TYPE_STREAM_OPERATORS 00095 vtkOStreamWrapper& operator << (vtkIdType); 00096 #endif 00097 vtkOStreamWrapper& operator << (void (*)(void*)); 00098 vtkOStreamWrapper& operator << (void* (*)(void*)); 00099 vtkOStreamWrapper& operator << (int (*)(void*)); 00100 vtkOStreamWrapper& operator << (int* (*)(void*)); 00101 vtkOStreamWrapper& operator << (float* (*)(void*)); 00102 vtkOStreamWrapper& operator << (const char* (*)(void*)); 00103 vtkOStreamWrapper& operator << (void (*)(void*, int*)); 00104 00106 vtkOStreamWrapper& write(const char*, unsigned long); 00107 00109 ostream& GetOStream(); 00110 00114 operator ostream&(); 00115 00117 operator int(); 00118 00120 void flush(); 00121 00124 static void UseEndl(const EndlType&) {} 00125 protected: 00126 // Reference to the real ostream. 00127 ostream& ostr; 00128 private: 00129 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented. 00130 }; 00131 00132 #endif