VTK  9.1.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
36class vtkIndent;
37class vtkObjectBase;
38class vtkLargeInteger;
39template <typename T>
40class vtkSmartPointer;
42class vtkStdString;
43
44class VTKCOMMONCORE_EXPORT VTK_WRAPEXCLUDE vtkOStreamWrapper
45{
46 class std_string;
47
48public:
50
54 vtkOStreamWrapper(ostream& os);
57
59
63 struct EndlType
64 {
65 };
66
68
85 vtkOStreamWrapper& operator<<(unsigned short);
88 vtkOStreamWrapper& operator<<(unsigned long long);
93
94 // Work-around for IBM Visual Age bug in overload resolution.
95#if defined(__IBMCPP__)
96 vtkOStreamWrapper& WriteInternal(const char*);
97 vtkOStreamWrapper& WriteInternal(void*);
98 template <typename T>
100 {
101 return this->WriteInternal(p);
102 }
103#endif
104
105 vtkOStreamWrapper& operator<<(void (*)(void*));
106 vtkOStreamWrapper& operator<<(void* (*)(void*));
108 vtkOStreamWrapper& operator<<(int* (*)(void*));
109 vtkOStreamWrapper& operator<<(float* (*)(void*));
110 vtkOStreamWrapper& operator<<(const char* (*)(void*));
111 vtkOStreamWrapper& operator<<(void (*)(void*, int*));
112
113 // Accept std::string without a declaration.
114 template <template <typename, typename, typename> class S>
115 vtkOStreamWrapper& operator<<(const S<char, std::char_traits<char>, std::allocator<char>>& s)
116 {
117 return *this << reinterpret_cast<std_string const&>(s);
118 }
119
120 // Accept vtkSmartPointer for output.
121 template <typename T>
123 {
124 this->ostr << (static_cast<T*>(ptr));
125 return *this;
126 }
127
131 vtkOStreamWrapper& write(const char*, unsigned long);
132
136 ostream& GetOStream();
137
143 operator ostream&();
144
148 operator int();
149
153 void flush();
154
156
160 static void UseEndl(const EndlType&) {}
162protected:
163 // Reference to the real ostream.
164 ostream& ostr;
165
166private:
167 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r) = delete;
168 vtkOStreamWrapper& operator<<(std_string const&);
169};
170
171#endif
172// VTK-HeaderTest-Exclude: vtkOStreamWrapper.h
a simple class to control print indentation
Definition: vtkIndent.h:113
class for arbitrarily large ints
Wrapper for C++ ostream.
vtkOStreamWrapper & operator<<(const vtkIndent &)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(vtkObjectBase &)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(int *(*)(void *))
vtkOStreamWrapper & operator<<(char)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(short)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(float *(*)(void *))
vtkOStreamWrapper & operator<<(void *)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(const vtkLargeInteger &)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(const vtkSmartPointerBase &)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(const char *(*)(void *))
vtkOStreamWrapper & write(const char *, unsigned long)
Forward the write method to the real stream.
vtkOStreamWrapper & operator<<(const vtkSmartPointer< T > &ptr)
vtkOStreamWrapper & operator<<(const char *)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(const vtkStdString &)
Forward this output operator to the real ostream.
virtual ~vtkOStreamWrapper()
static void UseEndl(const EndlType &)
Implementation detail to allow macros to provide an endl that may or may not be used.
vtkOStreamWrapper & operator<<(double)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(unsigned long long)
Forward this output operator to the real ostream.
vtkOStreamWrapper(ostream &os)
Construct class to reference a real ostream.
ostream & GetOStream()
Get a reference to the real ostream.
vtkOStreamWrapper & operator<<(void(*)(void *))
void flush()
Forward the flush method to the real ostream.
vtkOStreamWrapper & operator<<(unsigned long)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(int(*)(void *))
vtkOStreamWrapper & operator<<(const EndlType &)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(unsigned char)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(long long)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(bool)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(float)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(unsigned short)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(long)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(int)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(const S< char, std::char_traits< char >, std::allocator< char > > &s)
vtkOStreamWrapper & operator<<(void *(*)(void *))
vtkOStreamWrapper(vtkOStreamWrapper &r)
Construct class to reference a real ostream.
vtkOStreamWrapper & operator<<(unsigned int)
Forward this output operator to the real ostream.
vtkOStreamWrapper & operator<<(void(*)(void *, int *))
abstract base class for most VTK objects
Definition: vtkObjectBase.h:70
Non-templated superclass for vtkSmartPointer.
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
Type for a fake endl.
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
Do_not_include_vtkOStreamWrapper_directly_vtkSystemIncludes_includes_it
#define VTK_WRAPEXCLUDE