VTK  9.0.0
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 =========================================================================*/
27 #ifndef vtkOStreamWrapper_h
28 #define vtkOStreamWrapper_h
29 
30 #include "vtkCommonCoreModule.h"
31 
32 #ifndef VTK_SYSTEM_INCLUDES_INSIDE
34 #endif
35 
36 class vtkIndent;
37 class vtkObjectBase;
38 class vtkLargeInteger;
40 class vtkStdString;
41 
42 class VTKCOMMONCORE_EXPORT VTK_WRAPEXCLUDE vtkOStreamWrapper
43 {
44  class std_string;
45 
46 public:
48 
52  vtkOStreamWrapper(ostream& os);
55 
56  virtual ~vtkOStreamWrapper();
57 
61  struct EndlType
62  {
63  };
64 
66 
75  vtkOStreamWrapper& operator<<(const char*);
81  vtkOStreamWrapper& operator<<(long long);
82  vtkOStreamWrapper& operator<<(unsigned char);
83  vtkOStreamWrapper& operator<<(unsigned short);
84  vtkOStreamWrapper& operator<<(unsigned int);
85  vtkOStreamWrapper& operator<<(unsigned long);
86  vtkOStreamWrapper& operator<<(unsigned long long);
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 
111  // Accept std::string without a declaration.
112  template <template <typename, typename, typename> class S>
113  vtkOStreamWrapper& operator<<(const S<char, std::char_traits<char>, std::allocator<char>>& s)
114  {
115  return *this << reinterpret_cast<std_string const&>(s);
116  }
117 
121  vtkOStreamWrapper& write(const char*, unsigned long);
122 
126  ostream& GetOStream();
127 
133  operator ostream&();
134 
138  operator int();
139 
143  void flush();
144 
146 
150  static void UseEndl(const EndlType&) {}
152 protected:
153  // Reference to the real ostream.
154  ostream& ostr;
155 
156 private:
157  vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r) = delete;
158  vtkOStreamWrapper& operator<<(std_string const&);
159 };
160 
161 #endif
162 // VTK-HeaderTest-Exclude: vtkOStreamWrapper.h
vtkSmartPointerBase
Non-templated superclass for vtkSmartPointer.
Definition: vtkSmartPointerBase.h:32
vtkOStreamWrapper::EndlType
Type for a fake endl.
Definition: vtkOStreamWrapper.h:61
VTK_WRAPEXCLUDE
#define VTK_WRAPEXCLUDE
Definition: vtkWrappingHints.h:41
vtkObjectBase
abstract base class for most VTK objects
Definition: vtkObjectBase.h:69
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
operator<<
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
vtkOStreamWrapper
Wrapper for C++ ostream. Internal VTK use only.
Definition: vtkOStreamWrapper.h:42
vtkOStreamWrapper::UseEndl
static void UseEndl(const EndlType &)
Implementation detail to allow macros to provide an endl that may or may not be used.
Definition: vtkOStreamWrapper.h:150
Do_not_include_vtkOStreamWrapper_directly_vtkSystemIncludes_includes_it
Do_not_include_vtkOStreamWrapper_directly_vtkSystemIncludes_includes_it
Definition: vtkOStreamWrapper.h:33
vtkOStreamWrapper::operator<<
vtkOStreamWrapper & operator<<(const S< char, std::char_traits< char >, std::allocator< char >> &s)
Definition: vtkOStreamWrapper.h:113
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkOStreamWrapper::ostr
ostream & ostr
Definition: vtkOStreamWrapper.h:154
vtkLargeInteger
class for arbitrarily large ints
Definition: vtkLargeInteger.h:26