Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkBase64OutputStream.h

Go to the documentation of this file.
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 =========================================================================*/
00033 #ifndef __vtkBase64OutputStream_h
00034 #define __vtkBase64OutputStream_h
00035 
00036 #include "vtkOutputStream.h"
00037 
00038 class VTK_IO_EXPORT vtkBase64OutputStream : public vtkOutputStream
00039 {
00040 public:
00041   vtkTypeRevisionMacro(vtkBase64OutputStream,vtkOutputStream);
00042   static vtkBase64OutputStream *New();
00043   void PrintSelf(ostream& os, vtkIndent indent);
00044   
00048   int StartWriting();
00049   
00051   int Write(const unsigned char* data, unsigned long length);
00052   
00057   int EndWriting();
00058   
00059 protected:
00060   vtkBase64OutputStream();
00061   ~vtkBase64OutputStream();  
00062   
00063   // Number of un-encoded bytes left in Buffer from last call to Write.
00064   unsigned int BufferLength;
00065   unsigned char Buffer[2];
00066   
00067   // Methods to encode and write data.
00068   int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
00069   int EncodeEnding(unsigned char c0, unsigned char c1);
00070   int EncodeEnding(unsigned char c0);
00071   
00072 private:
00073   vtkBase64OutputStream(const vtkBase64OutputStream&);  // Not implemented.
00074   void operator=(const vtkBase64OutputStream&);  // Not implemented.
00075 };
00076 
00077 #endif