Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

IO/vtkBase64OutputStream.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkBase64OutputStream.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00037 #ifndef __vtkBase64OutputStream_h
00038 #define __vtkBase64OutputStream_h
00039 
00040 #include "vtkOutputStream.h"
00041 
00042 class VTK_IO_EXPORT vtkBase64OutputStream : public vtkOutputStream
00043 {
00044 public:
00045   vtkTypeRevisionMacro(vtkBase64OutputStream,vtkOutputStream);
00046   static vtkBase64OutputStream *New();
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048   
00052   int StartWriting();
00053   
00055   int Write(const unsigned char* data, unsigned long length);
00056   
00061   int EndWriting();
00062   
00063 protected:
00064   vtkBase64OutputStream();
00065   ~vtkBase64OutputStream();  
00066   
00067   // Number of un-encoded bytes left in Buffer from last call to Write.
00068   unsigned int BufferLength;
00069   unsigned char Buffer[2];
00070   
00071   // Methods to encode and write data.
00072   int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
00073   int EncodeEnding(unsigned char c0, unsigned char c1);
00074   int EncodeEnding(unsigned char c0);
00075   
00076 private:
00077   vtkBase64OutputStream(const vtkBase64OutputStream&);  // Not implemented.
00078   void operator=(const vtkBase64OutputStream&);  // Not implemented.
00079 };
00080 
00081 #endif