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 << (unsigned char);
77  vtkOStreamWrapper& operator << (unsigned short);
78  vtkOStreamWrapper& operator << (unsigned int);
79  vtkOStreamWrapper& operator << (unsigned long);
82 #if defined(VTK_TYPE_USE_LONG_LONG)
83  vtkOStreamWrapper& operator << (long long);
84  vtkOStreamWrapper& operator << (unsigned long long);
85 #endif
86 #if defined(VTK_TYPE_USE___INT64)
88  vtkOStreamWrapper& operator << (unsigned __int64);
89 #endif
92 
93  // Work-around for IBM Visual Age bug in overload resolution.
94 #if defined(__IBMCPP__)
95  vtkOStreamWrapper& WriteInternal(const char*);
96  vtkOStreamWrapper& WriteInternal(void*);
97  template <typename T>
99  {
100  return this->WriteInternal(p);
101  }
102 #endif
103 
104  vtkOStreamWrapper& operator << (void (*)(void*));
105  vtkOStreamWrapper& operator << (void* (*)(void*));
106  vtkOStreamWrapper& operator << (int (*)(void*));
107  vtkOStreamWrapper& operator << (int* (*)(void*));
108  vtkOStreamWrapper& operator << (float* (*)(void*));
109  vtkOStreamWrapper& operator << (const char* (*)(void*));
110  vtkOStreamWrapper& operator << (void (*)(void*, int*));
111 
112  // Accept std::string without a declaration.
113  template <template <typename, typename, typename> class S>
115  S< char, std::char_traits<char>, std::allocator<char> >& s)
116  {
117  return *this << reinterpret_cast<std_string const&>(s);
118  }
119 
121  vtkOStreamWrapper& write(const char*, unsigned long);
122 
124  ostream& GetOStream();
125 
129  operator ostream&();
130 
132  operator int();
133 
135  void flush();
136 
138 
140  static void UseEndl(const EndlType&) {}
141 protected:
142  // Reference to the real ostream.
143  ostream& ostr;
144 private:
145  vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented.
146  vtkOStreamWrapper& operator << (std_string const&);
147 };
149 
150 #endif
151 // 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