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 =========================================================================*/
22 #ifndef vtkBase64OutputStream_h
23 #define vtkBase64OutputStream_h
24 
25 #include "vtkIOCoreModule.h" // For export macro
26 #include "vtkOutputStream.h"
27 
29 {
30 public:
32  static vtkBase64OutputStream *New();
33  void PrintSelf(ostream& os, vtkIndent indent);
34 
38  int StartWriting();
39 
41  int Write(void const* data, size_t length);
42 
47  int EndWriting();
48 
49 protected:
52 
53  // Number of un-encoded bytes left in Buffer from last call to Write.
54  unsigned int BufferLength;
55  unsigned char Buffer[2];
56 
57  // Methods to encode and write data.
58  int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
59  int EncodeEnding(unsigned char c0, unsigned char c1);
60  int EncodeEnding(unsigned char c0);
61 
62 private:
63  vtkBase64OutputStream(const vtkBase64OutputStream&); // Not implemented.
64  void operator=(const vtkBase64OutputStream&); // Not implemented.
65 };
66 
67 #endif
virtual int EndWriting()
#define VTKIOCORE_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
Wraps a binary output stream with a VTK interface.
virtual int StartWriting()
virtual int Write(void const *data, size_t length)
static vtkOutputStream * New()
Writes base64-encoded output to a stream.