VTK
vtkBase64OutputStream.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBase64OutputStream.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 =========================================================================*/
23 #ifndef vtkBase64OutputStream_h
24 #define vtkBase64OutputStream_h
25 
26 #include "vtkIOCoreModule.h" // For export macro
27 #include "vtkOutputStream.h"
28 
29 class VTKIOCORE_EXPORT vtkBase64OutputStream : public vtkOutputStream
30 {
31 public:
33  static vtkBase64OutputStream *New();
34  void PrintSelf(ostream& os, vtkIndent indent);
35 
41  int StartWriting();
42 
46  int Write(void const* data, size_t length);
47 
54  int EndWriting();
55 
56 protected:
59 
60  // Number of un-encoded bytes left in Buffer from last call to Write.
61  unsigned int BufferLength;
62  unsigned char Buffer[2];
63 
64  // Methods to encode and write data.
65  int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
66  int EncodeEnding(unsigned char c0, unsigned char c1);
67  int EncodeEnding(unsigned char c0);
68 
69 private:
70  vtkBase64OutputStream(const vtkBase64OutputStream&) VTK_DELETE_FUNCTION;
71  void operator=(const vtkBase64OutputStream&) VTK_DELETE_FUNCTION;
72 };
73 
74 #endif
virtual int EndWriting()
Called after all desired calls to Write have been made.
a simple class to control print indentation
Definition: vtkIndent.h:39
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
Wraps a binary output stream with a VTK interface.
virtual int StartWriting()
Called after the stream position has been set by the caller, but before any Write calls...
virtual int Write(void const *data, size_t length)
Write output data of the given length.
static vtkOutputStream * New()
Writes base64-encoded output to a stream.