VTK
vtkOStreamWrapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOStreamWrapper.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 =========================================================================*/
26 #ifndef __vtkOStreamWrapper_h
27 #define __vtkOStreamWrapper_h
28 
29 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE
31 #endif
32 
33 class vtkIndent;
34 class vtkObjectBase;
35 class vtkLargeInteger;
37 class vtkStdString;
38 
40 {
41 public:
43 
45  vtkOStreamWrapper(ostream& os);
48 
49  virtual ~vtkOStreamWrapper();
50 
52  struct EndlType {};
53 
55 
63  vtkOStreamWrapper& operator << (const char*);
69  vtkOStreamWrapper& operator << (unsigned char);
70  vtkOStreamWrapper& operator << (unsigned short);
71  vtkOStreamWrapper& operator << (unsigned int);
72  vtkOStreamWrapper& operator << (unsigned long);
75 #if defined(VTK_TYPE_USE_LONG_LONG)
76  vtkOStreamWrapper& operator << (long long);
77  vtkOStreamWrapper& operator << (unsigned long long);
78 #endif
79 #if defined(VTK_TYPE_USE___INT64)
81  vtkOStreamWrapper& operator << (unsigned __int64);
82 #endif
83 
84 
85  // Need to switch on bool type because this wrapper is supposed to
86  // be as transparent as possible to user code. This example should
87  // not be used to justify using bool elsewhere in VTK.
88 #ifdef VTK_COMPILER_HAS_BOOL
90 #endif
91 
92  // Work-around for IBM Visual Age bug in overload resolution.
93 #if defined(__IBMCPP__)
94  vtkOStreamWrapper& WriteInternal(const char*);
95  vtkOStreamWrapper& WriteInternal(void*);
96  template <typename T>
98  {
99  return this->WriteInternal(p);
100  }
101 #endif
102 
103  vtkOStreamWrapper& operator << (void (*)(void*));
104  vtkOStreamWrapper& operator << (void* (*)(void*));
105  vtkOStreamWrapper& operator << (int (*)(void*));
106  vtkOStreamWrapper& operator << (int* (*)(void*));
107  vtkOStreamWrapper& operator << (float* (*)(void*));
108  vtkOStreamWrapper& operator << (const char* (*)(void*));
109  vtkOStreamWrapper& operator << (void (*)(void*, int*));
110 
112  vtkOStreamWrapper& write(const char*, unsigned long);
113 
115  ostream& GetOStream();
116 
120  operator ostream&();
121 
123  operator int();
124 
126  void flush();
127 
129 
131  static void UseEndl(const EndlType&) {}
132 protected:
133  // Reference to the real ostream.
134  ostream& ostr;
135 private:
136  vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented.
137 };
139 
140 #endif
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it
Wrapper for C++ ostream. Internal VTK use only.
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_COMMON_EXPORT
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
Non-templated superclass for vtkSmartPointer.
static void UseEndl(const EndlType &)
class for arbitrarily large ints
VTK_COMMON_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)