VTK
dox/IO/Core/vtkBase64InputStream.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkBase64InputStream.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 __vtkBase64InputStream_h
00023 #define __vtkBase64InputStream_h
00024 
00025 #include "vtkIOCoreModule.h" // For export macro
00026 #include "vtkInputStream.h"
00027 
00028 class VTKIOCORE_EXPORT vtkBase64InputStream : public vtkInputStream
00029 {
00030 public:
00031   vtkTypeMacro(vtkBase64InputStream,vtkInputStream);
00032   static vtkBase64InputStream *New();
00033   void PrintSelf(ostream& os, vtkIndent indent);
00034 
00038   void StartReading();
00039 
00042   int Seek(vtkTypeInt64 offset);
00043 
00045   size_t Read(void* data, size_t length);
00046 
00048 
00052   void EndReading();
00053 protected:
00054   vtkBase64InputStream();
00055   ~vtkBase64InputStream();
00057 
00058   // Number of decoded bytes left in Buffer from last call to Read.
00059   int BufferLength;
00060   unsigned char Buffer[2];
00061 
00062   // Reads 4 bytes from the input stream and decodes them into 3 bytes.
00063   int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
00064 
00065 private:
00066   vtkBase64InputStream(const vtkBase64InputStream&);  // Not implemented.
00067   void operator=(const vtkBase64InputStream&);  // Not implemented.
00068 };
00069 
00070 #endif