DecompressingInputStream.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 
00023 #ifndef _DWFCORE_DECOMPRESSING_INPUT_STREAM_H
00024 #define _DWFCORE_DECOMPRESSING_INPUT_STREAM_H
00025 
00026 
00031 
00032 
00033     //
00034     // use either the built-in or sytem zlib header
00035     // depending on the pre-processor configuration
00036     //
00037 #ifndef _ZLIB_H
00038 #ifdef  DWFCORE_BUILD_ZLIB
00039 #include "dwfcore/zlib/zlib.h"
00040 #else
00041 #include <zlib.h>
00042 #endif
00043 #endif
00044 
00045 
00046 #include "dwfcore/InputStream.h"
00047 
00048 
00049 
00050 #ifndef DWFCORE_DECOMPRESSING_INPUT_STREAM_DECOMPRESSION_BUFFER_SIZE
00060 #define DWFCORE_DECOMPRESSING_INPUT_STREAM_DECOMPRESSION_BUFFER_SIZE    16384
00061 #endif
00062 
00063 
00064 
00065 namespace DWFCore
00066 {
00067 
00077 class DWFDecompressingInputStream : virtual public DWFCoreMemory
00078                                   , public DWFInputStream
00079 {
00080 
00081 public:
00082 
00095     _DWFCORE_API
00096     DWFDecompressingInputStream( DWFInputStream* pInputStream,
00097                                  bool            bOwnStream )
00098         throw();
00099 
00105     _DWFCORE_API
00106     virtual ~DWFDecompressingInputStream()
00107         throw();
00108 
00126     _DWFCORE_API
00127     size_t available() const
00128         throw( DWFException );
00129 
00141     //                If the bytes returned is less than \a nBytesToRead, it indicates
00152     _DWFCORE_API
00153     size_t read( void*  pBuffer,
00154                  size_t nBytesToRead )
00155         throw( DWFException );
00156 
00165     _DWFCORE_API
00166     off_t seek( int     eOrigin,
00167                 off_t   nOffset )
00168         throw( DWFException );
00169 
00170 private:
00171 
00172     DWFInputStream* _pSourceStream;
00173     bool            _bOwnStream;
00174 
00175     bool            _bDecompressionStreamInit;
00176     z_stream        _oDecompressionStream;
00177 
00178     size_t          _nSourceBufferBytes;
00179     unsigned char*  _pSourceBuffer;
00180 
00181     size_t          _nDecompressedBytes;
00182     size_t          _nDecompressionBufferSize;
00183     size_t          _nDecompressionBufferOffset;
00184     size_t          _nDecompressedBytesBuffered;
00185     unsigned char*  _pDecompressionBuffer;
00186 
00187     bool            _bPending;
00188 
00189 private:
00190 
00191     //
00192     // Unimplemented methods
00193     //
00194     DWFDecompressingInputStream( const DWFDecompressingInputStream& );
00195     DWFDecompressingInputStream& operator=( const DWFDecompressingInputStream& );
00196 };
00197 
00198 }
00199 
00200 
00201 
00202 #endif

Generated on Tue Jan 6 22:39:28 2009 for Autodesk DWF Core Library by  doxygen 1.4.5