VTK
dox/IO/Core/vtkBase64OutputStream.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkBase64OutputStream.h
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 "vtkIOCoreModule.h" // For export macro
00026 #include "vtkOutputStream.h"
00027 
00028 class VTKIOCORE_EXPORT vtkBase64OutputStream : public vtkOutputStream
00029 {
00030 public:
00031   vtkTypeMacro(vtkBase64OutputStream,vtkOutputStream);
00032   static vtkBase64OutputStream *New();
00033   void PrintSelf(ostream& os, vtkIndent indent);
00034 
00038   int StartWriting();
00039 
00041   int Write(void const* data, size_t length);
00042 
00047   int EndWriting();
00048 
00049 protected:
00050   vtkBase64OutputStream();
00051   ~vtkBase64OutputStream();
00052 
00053   // Number of un-encoded bytes left in Buffer from last call to Write.
00054   unsigned int BufferLength;
00055   unsigned char Buffer[2];
00056 
00057   // Methods to encode and write data.
00058   int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
00059   int EncodeEnding(unsigned char c0, unsigned char c1);
00060   int EncodeEnding(unsigned char c0);
00061 
00062 private:
00063   vtkBase64OutputStream(const vtkBase64OutputStream&);  // Not implemented.
00064   void operator=(const vtkBase64OutputStream&);  // Not implemented.
00065 };
00066 
00067 #endif