OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkBase64OutputStream.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkBase64OutputStream.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 vtkBase64OutputStream - Writes base64-encoded output to a stream.
19 // .SECTION Description
20 // vtkBase64OutputStream implements base64 encoding with the
21 // vtkOutputStream interface.
22
23 #ifndef __vtkBase64OutputStream_h
24 #define __vtkBase64OutputStream_h
25
26 #include "vtkOutputStream.h"
27
28 class VTK_IO_EXPORT vtkBase64OutputStream : public vtkOutputStream
29 {
30 public:
31   vtkTypeRevisionMacro(vtkBase64OutputStream,vtkOutputStream);
32   static vtkBase64OutputStream *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 Write calls.  The stream position should not be
38   // adjusted by the caller until after an EndWriting call.
39   int StartWriting();
40   
41   // Description:
42   // Write output data of the given length.
43   int Write(const unsigned char* data, unsigned long length);
44   
45   // Description:
46   // Called after all desired calls to Write have been made.  After
47   // this call, the caller is free to change the position of the
48   // stream.  Additional writes should not be done until after another
49   // call to StartWriting.
50   int EndWriting();
51   
52 protected:
53   vtkBase64OutputStream();
54   ~vtkBase64OutputStream();  
55   
56   // Number of un-encoded bytes left in Buffer from last call to Write.
57   unsigned int BufferLength;
58   unsigned char Buffer[2];
59   
60   // Methods to encode and write data.
61   int EncodeTriplet(unsigned char c0, unsigned char c1, unsigned char c2);
62   int EncodeEnding(unsigned char c0, unsigned char c1);
63   int EncodeEnding(unsigned char c0);
64   
65 private:
66   vtkBase64OutputStream(const vtkBase64OutputStream&);  // Not implemented.
67   void operator=(const vtkBase64OutputStream&);  // Not implemented.
68 };
69
70 #endif