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 #include "vtkCommonCoreModule.h"
30 
31 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE
33 #endif
34 
35 class vtkIndent;
36 class vtkObjectBase;
37 class vtkLargeInteger;
39 // workaround clang bug, needs export on forward declaration
40 #ifdef __clang__
42 #else
43 class vtkStdString;
44 #endif
45 
47 {
48  class std_string;
49 public:
51 
53  vtkOStreamWrapper(ostream& os);
56 
57  virtual ~vtkOStreamWrapper();
58 
60  struct EndlType {};
61 
63 
70  vtkOStreamWrapper& operator << (const char*);
76  vtkOStreamWrapper& operator << (long long);
77  vtkOStreamWrapper& operator << (unsigned char);
78  vtkOStreamWrapper& operator << (unsigned short);
79  vtkOStreamWrapper& operator << (unsigned int);
80  vtkOStreamWrapper& operator << (unsigned long);
81  vtkOStreamWrapper& operator << (unsigned long long);
86 
87  // Work-around for IBM Visual Age bug in overload resolution.
88 #if defined(__IBMCPP__)
89  vtkOStreamWrapper& WriteInternal(const char*);
90  vtkOStreamWrapper& WriteInternal(void*);
91  template <typename T>
93  {
94  return this->WriteInternal(p);
95  }
96 #endif
97 
98  vtkOStreamWrapper& operator << (void (*)(void*));
99  vtkOStreamWrapper& operator << (void* (*)(void*));
100  vtkOStreamWrapper& operator << (int (*)(void*));
101  vtkOStreamWrapper& operator << (int* (*)(void*));
102  vtkOStreamWrapper& operator << (float* (*)(void*));
103  vtkOStreamWrapper& operator << (const char* (*)(void*));
104  vtkOStreamWrapper& operator << (void (*)(void*, int*));
105 
106  // Accept std::string without a declaration.
107  template <template <typename, typename, typename> class S>
109  S< char, std::char_traits<char>, std::allocator<char> >& s)
110  {
111  return *this << reinterpret_cast<std_string const&>(s);
112  }
113 
115  vtkOStreamWrapper& write(const char*, unsigned long);
116 
118  ostream& GetOStream();
119 
123  operator ostream&();
124 
126  operator int();
127 
129  void flush();
130 
132 
134  static void UseEndl(const EndlType&) {}
135 protected:
136  // Reference to the real ostream.
137  ostream& ostr;
138 private:
139  vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented.
140  vtkOStreamWrapper& operator << (std_string const&);
141 };
143 
144 #endif
145 // VTK-HeaderTest-Exclude: vtkOStreamWrapper.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
#define VTKCOMMONCORE_EXPORT
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:38
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
Non-templated superclass for vtkSmartPointer.
static void UseEndl(const EndlType &)
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
class for arbitrarily large ints