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=========================================================================*/
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;
40// workaround clang bug, needs export on forward declaration
41#ifdef __clang__
42class VTKCOMMONCORE_EXPORT vtkStdString;
43#else
44class vtkStdString;
45#endif
46
47class VTKCOMMONCORE_EXPORT vtkOStreamWrapper
48{
49 class std_string;
50public:
52
56 vtkOStreamWrapper(ostream& os);
59
61
65 struct EndlType {};
66
68
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
106 vtkOStreamWrapper& operator << (void* (*)(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>
116 S< char, std::char_traits<char>, std::allocator<char> >& s)
117 {
118 return *this << reinterpret_cast<std_string const&>(s);
119 }
120
124 vtkOStreamWrapper& write(const char*, unsigned long);
125
129 ostream& GetOStream();
130
136 operator ostream&();
137
141 operator int();
142
146 void flush();
147
149
153 static void UseEndl(const EndlType&) {}
154protected:
155 // Reference to the real ostream.
156 ostream& ostr;
157private:
158 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r) VTK_DELETE_FUNCTION;
159 vtkOStreamWrapper& operator << (std_string const&);
160};
162
163#endif
164// VTK-HeaderTest-Exclude: vtkOStreamWrapper.h
a simple class to control print indentation
Definition: vtkIndent.h:40
class for arbitrarily large ints
Wrapper for C++ ostream.
vtkOStreamWrapper & write(const char *, unsigned long)
Forward the write method to the real stream.
virtual ~vtkOStreamWrapper()
static void UseEndl(const EndlType &)
Implementation detail to allow macros to provide an endl that may or may not be used.
vtkOStreamWrapper(ostream &os)
Construct class to reference a real ostream.
ostream & GetOStream()
Get a reference to the real ostream.
void flush()
Forward the flush method to the real ostream.
vtkOStreamWrapper(vtkOStreamWrapper &r)
abstract base class for most VTK objects
Definition: vtkObjectBase.h:66
Non-templated superclass for vtkSmartPointer.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
Type for a fake endl.
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it