00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkBase64OutputStream.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00022 #ifndef __vtkBase64OutputStream_h 00023 #define __vtkBase64OutputStream_h 00024 00025 #include "vtkOutputStream.h" 00026 00027 class VTK_IO_EXPORT vtkBase64OutputStream : public vtkOutputStream 00028 { 00029 public: 00030 vtkTypeRevisionMacro(vtkBase64OutputStream,vtkOutputStream); 00031 static vtkBase64OutputStream *New(); 00032 void PrintSelf(ostream& os, vtkIndent indent); 00033 00037 int StartWriting(); 00038 00040 int Write(const unsigned char* data, unsigned long length); 00041 00046 int EndWriting(); 00047 00048 protected: 00049 vtkBase64OutputStream(); 00050 ~vtkBase64OutputStream(); 00051 00052 // Number of un-encoded bytes left in Buffer from last call to Write. 00053 unsigned int BufferLength; 00054 unsigned char Buffer[2]; 00055 00056 // Methods to encode and write data. 00057 int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2); 00058 int EncodeEnding(unsigned char c0, unsigned char c1); 00059 int EncodeEnding(unsigned char c0); 00060 00061 private: 00062 vtkBase64OutputStream(const vtkBase64OutputStream&); // Not implemented. 00063 void operator=(const vtkBase64OutputStream&); // Not implemented. 00064 }; 00065 00066 #endif