OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkBase64InputStream.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkBase64InputStream.h,v $
5   Language:  C++
6   Date:      $Date: 2002/10/16 18:23:06 $
7   Version:   $Revision: 1.1 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkBase64InputStream - Reads base64-encoded input from a stream.
19 // .SECTION Description
20 // vtkBase64InputStream implements base64 decoding with the
21 // vtkInputStream interface.
22
23 #ifndef __vtkBase64InputStream_h
24 #define __vtkBase64InputStream_h
25
26 #include "vtkInputStream.h"
27
28 class VTK_IO_EXPORT vtkBase64InputStream : public vtkInputStream
29 {
30 public:
31   vtkTypeRevisionMacro(vtkBase64InputStream,vtkInputStream);
32   static vtkBase64InputStream *New();
33   void PrintSelf(ostream& os, vtkIndent indent);
34   
35   // Description:
36   // Called after the stream position has been set by the caller, but
37   // before any Seek or Read calls.  The stream position should not be
38   // adjusted by the caller until after an EndReading call.
39   void StartReading();
40   
41   // Description:
42   // Seek to the given offset in the input data.  Returns 1 for
43   // success, 0 for failure.
44   int Seek(unsigned long offset);
45   
46   // Description:
47   // Read input data of the given length.  Returns amount actually
48   // read.
49   unsigned long Read(unsigned char* data, unsigned long length);
50   
51   // Description:
52   // Called after all desired calls to Seek and Read have been made.
53   // After this call, the caller is free to change the position of the
54   // stream.  Additional reads should not be done until after another
55   // call to StartReading.
56   void EndReading();
57 protected:
58   vtkBase64InputStream();
59   ~vtkBase64InputStream();  
60   
61   // Number of decoded bytes left in Buffer from last call to Read.
62   int BufferLength;
63   unsigned char Buffer[2];
64   
65   // Reads 4 bytes from the input stream and decodes them into 3 bytes.
66   int DecodeTriplet(unsigned char& c0, unsigned char& c1, unsigned char& c2);
67
68 private:
69   vtkBase64InputStream(const vtkBase64InputStream&);  // Not implemented.
70   void operator=(const vtkBase64InputStream&);  // Not implemented.
71 };
72
73 #endif