Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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   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 =========================================================================*/
00026 #ifndef __vtkBase64OutputStream_h
00027 #define __vtkBase64OutputStream_h
00028 
00029 #include "vtkOutputStream.h"
00030 
00031 class VTK_IO_EXPORT vtkBase64OutputStream : public vtkOutputStream
00032 {
00033 public:
00034   vtkTypeRevisionMacro(vtkBase64OutputStream,vtkOutputStream);
00035   static vtkBase64OutputStream *New();
00036   void PrintSelf(ostream& os, vtkIndent indent);
00037   
00041   int StartWriting();
00042   
00044   int Write(const unsigned char* data, unsigned long length);
00045   
00050   int EndWriting();
00051   
00052 protected:
00053   vtkBase64OutputStream();
00054   ~vtkBase64OutputStream();  
00055   
00056   // Number of un-encoded bytes left in Buffer from last call to Write.
00057   unsigned int BufferLength;
00058   unsigned char Buffer[2];
00059   
00060   // Methods to encode and write data.
00061   int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
00062   int EncodeEnding(unsigned char c0, unsigned char c1);
00063   int EncodeEnding(unsigned char c0);
00064   
00065 private:
00066   vtkBase64OutputStream(const vtkBase64OutputStream&);  // Not implemented.
00067   void operator=(const vtkBase64OutputStream&);  // Not implemented.
00068 };
00069 
00070 #endif