VTK  9.4.20241108
vtkOStreamWrapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
15#ifndef vtkOStreamWrapper_h
16#define vtkOStreamWrapper_h
17
18#include "vtkCommonCoreModule.h"
19
20#ifndef VTK_SYSTEM_INCLUDES_INSIDE
22#endif
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkIndent;
26class vtkObjectBase;
27class vtkLargeInteger;
28template <typename T>
29class vtkSmartPointer;
31class vtkStdString;
32
33class VTKCOMMONCORE_EXPORT VTK_WRAPEXCLUDE vtkOStreamWrapper
34{
35 class std_string;
36
37public:
39
43 vtkOStreamWrapper(ostream& os);
46
48
52 struct EndlType
53 {
54 };
55
57
74 vtkOStreamWrapper& operator<<(unsigned short);
77 vtkOStreamWrapper& operator<<(unsigned long long);
82
83 // Work-around for IBM Visual Age bug in overload resolution.
84#if defined(__IBMCPP__)
85 vtkOStreamWrapper& WriteInternal(const char*);
86 vtkOStreamWrapper& WriteInternal(void*);
87 template <typename T>
89 {
90 return this->WriteInternal(p);
91 }
92#endif
93
94 vtkOStreamWrapper& operator<<(void (*)(void*));
95 vtkOStreamWrapper& operator<<(void* (*)(void*));
96 vtkOStreamWrapper& operator<<(int (*)(void*));
97 vtkOStreamWrapper& operator<<(int* (*)(void*));
98 vtkOStreamWrapper& operator<<(float* (*)(void*));
99 vtkOStreamWrapper& operator<<(const char* (*)(void*));
100 vtkOStreamWrapper& operator<<(void (*)(void*, int*));
101
102 // Accept std::string without a declaration.
103 template <template <typename, typename, typename> class S>
104 vtkOStreamWrapper& operator<<(const S<char, std::char_traits<char>, std::allocator<char>>& s)
105 {
106 return *this << reinterpret_cast<std_string const&>(s);
107 }
108
109 // Accept vtkSmartPointer for output.
110 template <typename T>
112 {
113 this->ostr << (static_cast<T*>(ptr));
114 return *this;
115 }
116
120 vtkOStreamWrapper& write(const char*, unsigned long);
121
125 ostream& GetOStream();
126
132 operator ostream&();
133
137 operator int();
138
142 void flush();
143
145
149 static void UseEndl(const EndlType&) {}
151protected:
152 // Reference to the real ostream.
153 ostream& ostr;
154
155private:
156 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r) = delete;
157 vtkOStreamWrapper& operator<<(std_string const&);
158};
159
160VTK_ABI_NAMESPACE_END
161#endif
162// VTK-HeaderTest-Exclude: vtkOStreamWrapper.h
a simple class to control print indentation
Definition vtkIndent.h:108
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
Non-templated superclass for vtkSmartPointer.
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
Do_not_include_vtkOStreamWrapper_directly_vtkSystemIncludes_includes_it
#define VTK_WRAPEXCLUDE