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 "vtkOutputStream.h"
26 
28 {
29 public:
31  static vtkBase64OutputStream *New();
32  void PrintSelf(ostream& os, vtkIndent indent);
33 
37  int StartWriting();
38 
40  int Write(const unsigned char* data, unsigned long length);
41 
46  int EndWriting();
47 
48 protected:
51 
52  // Number of un-encoded bytes left in Buffer from last call to Write.
53  unsigned int BufferLength;
54  unsigned char Buffer[2];
55 
56  // Methods to encode and write data.
57  int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
58  int EncodeEnding(unsigned char c0, unsigned char c1);
59  int EncodeEnding(unsigned char c0);
60 
61 private:
62  vtkBase64OutputStream(const vtkBase64OutputStream&); // Not implemented.
63  void operator=(const vtkBase64OutputStream&); // Not implemented.
64 };
65 
66 #endif