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 #ifndef __VTK_WRAP__
30 
31 #include "vtkCommonCoreModule.h"
32 
33 #ifndef VTK_SYSTEM_INCLUDES_INSIDE
35 #endif
36 
37 class vtkIndent;
38 class vtkObjectBase;
39 class vtkLargeInteger;
41 class vtkStdString;
42 
43 class VTKCOMMONCORE_EXPORT vtkOStreamWrapper
44 {
45  class std_string;
46 public:
48 
52  vtkOStreamWrapper(ostream& os);
55 
56  virtual ~vtkOStreamWrapper();
57 
61  struct EndlType {};
62 
64 
73  vtkOStreamWrapper& operator << (const char*);
79  vtkOStreamWrapper& operator << (long long);
80  vtkOStreamWrapper& operator << (unsigned char);
81  vtkOStreamWrapper& operator << (unsigned short);
82  vtkOStreamWrapper& operator << (unsigned int);
83  vtkOStreamWrapper& operator << (unsigned long);
84  vtkOStreamWrapper& operator << (unsigned long long);
89 
90  // Work-around for IBM Visual Age bug in overload resolution.
91 #if defined(__IBMCPP__)
92  vtkOStreamWrapper& WriteInternal(const char*);
93  vtkOStreamWrapper& WriteInternal(void*);
94  template <typename T>
96  {
97  return this->WriteInternal(p);
98  }
99 #endif
100 
101  vtkOStreamWrapper& operator << (void (*)(void*));
102  vtkOStreamWrapper& operator << (void* (*)(void*));
103  vtkOStreamWrapper& operator << (int (*)(void*));
104  vtkOStreamWrapper& operator << (int* (*)(void*));
105  vtkOStreamWrapper& operator << (float* (*)(void*));
106  vtkOStreamWrapper& operator << (const char* (*)(void*));
107  vtkOStreamWrapper& operator << (void (*)(void*, int*));
108 
109  // Accept std::string without a declaration.
110  template <template <typename, typename, typename> class S>
112  S< char, std::char_traits<char>, std::allocator<char> >& s)
113  {
114  return *this << reinterpret_cast<std_string const&>(s);
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&) {}
150 protected:
151  // Reference to the real ostream.
152  ostream& ostr;
153 private:
154  vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r) = delete;
155  vtkOStreamWrapper& operator << (std_string const&);
156 };
158 
159 #endif
160 #endif
161 // VTK-HeaderTest-Exclude: vtkOStreamWrapper.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
ostream & ostr
Implementation detail to allow macros to provide an endl that may or may not be used.
Do_not_include_vtkOStreamWrapper_directly_vtkSystemIncludes_includes_it
Wrapper for C++ ostream.
a simple class to control print indentation
Definition: vtkIndent.h:39
Type for a fake endl.
abstract base class for most VTK objects
Definition: vtkObjectBase.h:65
Non-templated superclass for vtkSmartPointer.
static void UseEndl(const EndlType &)
Implementation detail to allow macros to provide an endl that may or may not be used.
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
class for arbitrarily large ints